Fix compilation of tool in Linux.

This commit is contained in:
2025-10-13 11:22:24 +01:00
parent df8e74eb4f
commit e6c7f2144e
2 changed files with 13 additions and 2 deletions

View File

@@ -41,6 +41,17 @@ target_link_libraries(aaruformattool
ICU::uc
)
# On Linux, enable GNU/POSIX feature test macros so functions like strerror_r
# and cfmakeraw are declared by system headers. We limit this to UNIX and not
# Apple (macOS provides these declarations differently).
if(UNIX AND NOT APPLE)
target_compile_definitions(aaruformattool PRIVATE
_GNU_SOURCE
_DEFAULT_SOURCE
_XOPEN_SOURCE=700)
endif()
# On macOS/iOS, explicitly link the C++ standard library for ICU dependencies
if(APPLE)
target_link_libraries(aaruformattool PRIVATE "-lc++")

View File

@@ -72,7 +72,7 @@ int info(const char *path)
aaruformat_context *ctx = NULL;
char *strBuffer = NULL;
UErrorCode u_error_code = U_ZERO_ERROR;
uint i = 0;
uint32_t i = 0;
mediaTagEntry const *mediaTag = NULL;
mediaTagEntry const *tmpMediaTag = NULL;
@@ -548,7 +548,7 @@ int info(const char *path)
free(strBuffer);
}
for(uint j = 0; j < ctx->dump_hardware_entries_with_data[i].entry.extents; j++)
for(uint32_t j = 0; j < ctx->dump_hardware_entries_with_data[i].entry.extents; j++)
{
printf("\t\tExtent %d:\n", j);
printf("\t\t\tStart: %llu\n", ctx->dump_hardware_entries_with_data[i].extents[j].start);