Resolve asprintf undeclared error and add cross-platform support #46
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR includes two changes:
Cross-platform support in output_file.cpp and backed_block.cpp
#ifndef _WIN32
around<unistd.h>
and definedPAGESIZE
(4096 for Windows,sysconf(_SC_PAGESIZE)
elsewhere) inoutput_file.cpp
for non-POSIX compatibility.aligned_offset
logic to use thePAGESIZE
macro for consistent alignment.calloc
args inbacked_block.cpp
fromsizeof(struct backed_block_list), 1
to1, sizeof(struct backed_block_list)
for clarity.Portability fixes in simg2simg.cpp, sparse.cpp, and append2simg.cpp
calloc
args (e.g.,sizeof(struct sparse_file*), files
tofiles, sizeof(struct sparse_file*)
) across all three files.asprintf
with a customcustom_asprintf
usingsnprintf
inappend2simg.cpp
to resolve "append2simg.cpp:67:9: error: 'asprintf' was not declared in this scope". Thecustom_asprintf
implementation fixes this compilation failure.Fixes issue #44 with these commits.
Testing:
ubuntu-latest
andwindows-latest
. Builds pass without issues.Closes Issue #44.