diff --git a/src/blocks/checksum.c b/src/blocks/checksum.c index 8056477..c20e759 100644 --- a/src/blocks/checksum.c +++ b/src/blocks/checksum.c @@ -36,12 +36,12 @@ void process_checksum_block(aaruformatContext *ctx, const IndexEntry *entry) { TRACE("Entering process_checksum_block(%p, %p)", ctx, entry); - int pos = 0; - size_t read_bytes = 0; + int pos = 0; + size_t read_bytes = 0; ChecksumHeader checksum_header; - ChecksumEntry const *checksum_entry = NULL; - uint8_t *data = NULL; - int j = 0; + ChecksumEntry const *checksum_entry = NULL; + uint8_t *data = NULL; + int j = 0; // Check if the context and image stream are valid if(ctx == NULL || ctx->imageStream == NULL) @@ -101,7 +101,7 @@ void process_checksum_block(aaruformatContext *ctx, const IndexEntry *entry) TRACE("Processing %u checksum entries", checksum_header.entries); for(j = 0; j < checksum_header.entries; j++) { - checksum_entry = (ChecksumEntry *)(&data[pos]); + checksum_entry = (ChecksumEntry *)&data[pos]; pos += sizeof(ChecksumEntry); if(checksum_entry->type == Md5) diff --git a/src/checksum/ecc_cd.c b/src/checksum/ecc_cd.c index 888c2bc..0ef9b7f 100644 --- a/src/checksum/ecc_cd.c +++ b/src/checksum/ecc_cd.c @@ -81,7 +81,7 @@ void *aaruf_ecc_cd_init() j = i << 1 ^ ((i & 0x80) == 0x80 ? 0x11D : 0); context->ecc_f_table[i] = (uint8_t)j; context->ecc_b_table[i ^ j] = (uint8_t)i; - for(j = 0; j < 8; j++) edc = (edc >> 1) ^ ((edc & 1) > 0 ? 0xD8018001 : 0); + for(j = 0; j < 8; j++) edc = edc >> 1 ^ ((edc & 1) > 0 ? 0xD8018001 : 0); context->edc_table[i] = edc; } @@ -328,7 +328,7 @@ void aaruf_ecc_cd_write(void *context, const uint8_t *address, const uint8_t *da ecc_a = ctx->ecc_b_table[ctx->ecc_f_table[ecc_a] ^ ecc_b]; ecc[major + ecc_offset] = ecc_a; - ecc[major + major_count + ecc_offset] = (ecc_a ^ ecc_b); + ecc[major + major_count + ecc_offset] = ecc_a ^ ecc_b; } TRACE("Exiting aaruf_ecc_cd_write()"); @@ -557,7 +557,7 @@ uint32_t aaruf_edc_cd_compute(void *context, uint32_t edc, const uint8_t *src, i return 0; } - for(; size > 0; size--) edc = (edc >> 8) ^ ctx->edc_table[(edc ^ src[pos++]) & 0xFF]; + for(; size > 0; size--) edc = edc >> 8 ^ ctx->edc_table[(edc ^ src[pos++]) & 0xFF]; TRACE("Exiting aaruf_edc_cd_compute() = 0x%08X", edc); return edc; diff --git a/src/checksum/spamsum.c b/src/checksum/spamsum.c index e84b074..219f7c9 100644 --- a/src/checksum/spamsum.c +++ b/src/checksum/spamsum.c @@ -36,7 +36,7 @@ static uint8_t b64[] = {0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x AARU_EXPORT spamsum_ctx *AARU_CALL aaruf_spamsum_init(void) { - spamsum_ctx *ctx = (spamsum_ctx *)malloc(sizeof(spamsum_ctx)); + spamsum_ctx *ctx = malloc(sizeof(spamsum_ctx)); if(!ctx) return NULL; memset(ctx, 0, sizeof(spamsum_ctx)); @@ -192,7 +192,7 @@ AARU_EXPORT int AARU_CALL aaruf_spamsum_final(spamsum_ctx *ctx, uint8_t *result) { uint32_t bi = ctx->bh_start; uint32_t h = ROLL_SUM(ctx); - int remain = (int)(FUZZY_MAX_RESULT - 1); /* Exclude terminating '\0'. */ + int remain = FUZZY_MAX_RESULT - 1; /* Exclude terminating '\0'. */ if(!result) return -1; diff --git a/src/close.c b/src/close.c index efe29e3..15b0836 100644 --- a/src/close.c +++ b/src/close.c @@ -174,9 +174,9 @@ int aaruf_close(void *context) // Write cached secondary table to file end and update primary table entry with its position // Check if we have a cached table that needs to be written (either it has an offset or exists in memory) - bool has_cached_secondary_ddt = (ctx->userDataDdtHeader.tableShift > 0) && - ((ctx->cachedDdtOffset != 0) || - (ctx->cachedSecondaryDdtSmall != NULL || ctx->cachedSecondaryDdtBig != NULL)); + bool has_cached_secondary_ddt = + ctx->userDataDdtHeader.tableShift > 0 && + (ctx->cachedDdtOffset != 0 || ctx->cachedSecondaryDdtSmall != NULL || ctx->cachedSecondaryDdtBig != NULL); if(has_cached_secondary_ddt) { @@ -190,7 +190,7 @@ int aaruf_close(void *context) if(end_of_file & alignment_mask) { // Calculate the next aligned position - uint64_t aligned_position = (end_of_file + alignment_mask) & ~alignment_mask; + uint64_t aligned_position = end_of_file + alignment_mask & ~alignment_mask; // Seek to the aligned position and pad with zeros if necessary fseek(ctx->imageStream, aligned_position, SEEK_SET); @@ -506,7 +506,7 @@ int aaruf_close(void *context) uint64_t alignment_mask = (1ULL << ctx->userDataDdtHeader.blockAlignmentShift) - 1; if(index_position & alignment_mask) { - uint64_t aligned_position = (index_position + alignment_mask) & ~alignment_mask; + uint64_t aligned_position = index_position + alignment_mask & ~alignment_mask; fseek(ctx->imageStream, aligned_position, SEEK_SET); index_position = aligned_position; TRACE("Aligned index position to %" PRIu64, aligned_position); diff --git a/src/compression/cst.c b/src/compression/cst.c index c8adabc..341f930 100644 --- a/src/compression/cst.c +++ b/src/compression/cst.c @@ -150,15 +150,15 @@ int32_t aaruf_cst_transform(const uint8_t *interleaved, uint8_t *sequential, con w[i / 8] += interleaved[i + 7] & 0x01; } - q_start = (length / 8) * 1; - r_start = (length / 8) * 2; - s_start = (length / 8) * 3; - t_start = (length / 8) * 4; - u_start = (length / 8) * 5; - v_start = (length / 8) * 6; - w_start = (length / 8) * 7; + q_start = length / 8 * 1; + r_start = length / 8 * 2; + s_start = length / 8 * 3; + t_start = length / 8 * 4; + u_start = length / 8 * 5; + v_start = length / 8 * 6; + w_start = length / 8 * 7; - for(i = 0; i < (length / 8); i++) + for(i = 0; i < length / 8; i++) { sequential[i] = p[i]; sequential[q_start + i] = q[i]; @@ -218,15 +218,15 @@ int32_t aaruf_cst_untransform(const uint8_t *sequential, uint8_t *interleaved, c return AARUF_ERROR_NOT_ENOUGH_MEMORY; } - size_t q_start = (length / 8) * 1; - size_t r_start = (length / 8) * 2; - size_t s_start = (length / 8) * 3; - size_t t_start = (length / 8) * 4; - size_t u_start = (length / 8) * 5; - size_t v_start = (length / 8) * 6; - size_t w_start = (length / 8) * 7; + size_t q_start = length / 8 * 1; + size_t r_start = length / 8 * 2; + size_t s_start = length / 8 * 3; + size_t t_start = length / 8 * 4; + size_t u_start = length / 8 * 5; + size_t v_start = length / 8 * 6; + size_t w_start = length / 8 * 7; - for(i = 0; i < (length / 8); i++) + for(i = 0; i < length / 8; i++) { p[i] = sequential[i]; q[i] = sequential[q_start + i]; @@ -242,77 +242,77 @@ int32_t aaruf_cst_untransform(const uint8_t *sequential, uint8_t *interleaved, c for(i = 0; i < length; i += 8) { - interleaved[i] += ((p[i / 8] & 0x80) == 0x80 ? 0x80 : 0); - interleaved[i + 1] += ((p[i / 8] & 0x40) == 0x40 ? 0x80 : 0); - interleaved[i + 2] += ((p[i / 8] & 0x20) == 0x20 ? 0x80 : 0); - interleaved[i + 3] += ((p[i / 8] & 0x10) == 0x10 ? 0x80 : 0); - interleaved[i + 4] += ((p[i / 8] & 0x08) == 0x08 ? 0x80 : 0); - interleaved[i + 5] += ((p[i / 8] & 0x04) == 0x04 ? 0x80 : 0); - interleaved[i + 6] += ((p[i / 8] & 0x02) == 0x02 ? 0x80 : 0); - interleaved[i + 7] += ((p[i / 8] & 0x01) == 0x01 ? 0x80 : 0); + interleaved[i] += (p[i / 8] & 0x80) == 0x80 ? 0x80 : 0; + interleaved[i + 1] += (p[i / 8] & 0x40) == 0x40 ? 0x80 : 0; + interleaved[i + 2] += (p[i / 8] & 0x20) == 0x20 ? 0x80 : 0; + interleaved[i + 3] += (p[i / 8] & 0x10) == 0x10 ? 0x80 : 0; + interleaved[i + 4] += (p[i / 8] & 0x08) == 0x08 ? 0x80 : 0; + interleaved[i + 5] += (p[i / 8] & 0x04) == 0x04 ? 0x80 : 0; + interleaved[i + 6] += (p[i / 8] & 0x02) == 0x02 ? 0x80 : 0; + interleaved[i + 7] += (p[i / 8] & 0x01) == 0x01 ? 0x80 : 0; - interleaved[i] += ((q[i / 8] & 0x80) == 0x80 ? 0x40 : 0); - interleaved[i + 1] += ((q[i / 8] & 0x40) == 0x40 ? 0x40 : 0); - interleaved[i + 2] += ((q[i / 8] & 0x20) == 0x20 ? 0x40 : 0); - interleaved[i + 3] += ((q[i / 8] & 0x10) == 0x10 ? 0x40 : 0); - interleaved[i + 4] += ((q[i / 8] & 0x08) == 0x08 ? 0x40 : 0); - interleaved[i + 5] += ((q[i / 8] & 0x04) == 0x04 ? 0x40 : 0); - interleaved[i + 6] += ((q[i / 8] & 0x02) == 0x02 ? 0x40 : 0); - interleaved[i + 7] += ((q[i / 8] & 0x01) == 0x01 ? 0x40 : 0); + interleaved[i] += (q[i / 8] & 0x80) == 0x80 ? 0x40 : 0; + interleaved[i + 1] += (q[i / 8] & 0x40) == 0x40 ? 0x40 : 0; + interleaved[i + 2] += (q[i / 8] & 0x20) == 0x20 ? 0x40 : 0; + interleaved[i + 3] += (q[i / 8] & 0x10) == 0x10 ? 0x40 : 0; + interleaved[i + 4] += (q[i / 8] & 0x08) == 0x08 ? 0x40 : 0; + interleaved[i + 5] += (q[i / 8] & 0x04) == 0x04 ? 0x40 : 0; + interleaved[i + 6] += (q[i / 8] & 0x02) == 0x02 ? 0x40 : 0; + interleaved[i + 7] += (q[i / 8] & 0x01) == 0x01 ? 0x40 : 0; - interleaved[i] += ((r[i / 8] & 0x80) == 0x80 ? 0x20 : 0); - interleaved[i + 1] += ((r[i / 8] & 0x40) == 0x40 ? 0x20 : 0); - interleaved[i + 2] += ((r[i / 8] & 0x20) == 0x20 ? 0x20 : 0); - interleaved[i + 3] += ((r[i / 8] & 0x10) == 0x10 ? 0x20 : 0); - interleaved[i + 4] += ((r[i / 8] & 0x08) == 0x08 ? 0x20 : 0); - interleaved[i + 5] += ((r[i / 8] & 0x04) == 0x04 ? 0x20 : 0); - interleaved[i + 6] += ((r[i / 8] & 0x02) == 0x02 ? 0x20 : 0); - interleaved[i + 7] += ((r[i / 8] & 0x01) == 0x01 ? 0x20 : 0); + interleaved[i] += (r[i / 8] & 0x80) == 0x80 ? 0x20 : 0; + interleaved[i + 1] += (r[i / 8] & 0x40) == 0x40 ? 0x20 : 0; + interleaved[i + 2] += (r[i / 8] & 0x20) == 0x20 ? 0x20 : 0; + interleaved[i + 3] += (r[i / 8] & 0x10) == 0x10 ? 0x20 : 0; + interleaved[i + 4] += (r[i / 8] & 0x08) == 0x08 ? 0x20 : 0; + interleaved[i + 5] += (r[i / 8] & 0x04) == 0x04 ? 0x20 : 0; + interleaved[i + 6] += (r[i / 8] & 0x02) == 0x02 ? 0x20 : 0; + interleaved[i + 7] += (r[i / 8] & 0x01) == 0x01 ? 0x20 : 0; - interleaved[i] += ((s[i / 8] & 0x80) == 0x80 ? 0x10 : 0); - interleaved[i + 1] += ((s[i / 8] & 0x40) == 0x40 ? 0x10 : 0); - interleaved[i + 2] += ((s[i / 8] & 0x20) == 0x20 ? 0x10 : 0); - interleaved[i + 3] += ((s[i / 8] & 0x10) == 0x10 ? 0x10 : 0); - interleaved[i + 4] += ((s[i / 8] & 0x08) == 0x08 ? 0x10 : 0); - interleaved[i + 5] += ((s[i / 8] & 0x04) == 0x04 ? 0x10 : 0); - interleaved[i + 6] += ((s[i / 8] & 0x02) == 0x02 ? 0x10 : 0); - interleaved[i + 7] += ((s[i / 8] & 0x01) == 0x01 ? 0x10 : 0); + interleaved[i] += (s[i / 8] & 0x80) == 0x80 ? 0x10 : 0; + interleaved[i + 1] += (s[i / 8] & 0x40) == 0x40 ? 0x10 : 0; + interleaved[i + 2] += (s[i / 8] & 0x20) == 0x20 ? 0x10 : 0; + interleaved[i + 3] += (s[i / 8] & 0x10) == 0x10 ? 0x10 : 0; + interleaved[i + 4] += (s[i / 8] & 0x08) == 0x08 ? 0x10 : 0; + interleaved[i + 5] += (s[i / 8] & 0x04) == 0x04 ? 0x10 : 0; + interleaved[i + 6] += (s[i / 8] & 0x02) == 0x02 ? 0x10 : 0; + interleaved[i + 7] += (s[i / 8] & 0x01) == 0x01 ? 0x10 : 0; - interleaved[i] += ((t[i / 8] & 0x80) == 0x80 ? 0x08 : 0); - interleaved[i + 1] += ((t[i / 8] & 0x40) == 0x40 ? 0x08 : 0); - interleaved[i + 2] += ((t[i / 8] & 0x20) == 0x20 ? 0x08 : 0); - interleaved[i + 3] += ((t[i / 8] & 0x10) == 0x10 ? 0x08 : 0); - interleaved[i + 4] += ((t[i / 8] & 0x08) == 0x08 ? 0x08 : 0); - interleaved[i + 5] += ((t[i / 8] & 0x04) == 0x04 ? 0x08 : 0); - interleaved[i + 6] += ((t[i / 8] & 0x02) == 0x02 ? 0x08 : 0); - interleaved[i + 7] += ((t[i / 8] & 0x01) == 0x01 ? 0x08 : 0); + interleaved[i] += (t[i / 8] & 0x80) == 0x80 ? 0x08 : 0; + interleaved[i + 1] += (t[i / 8] & 0x40) == 0x40 ? 0x08 : 0; + interleaved[i + 2] += (t[i / 8] & 0x20) == 0x20 ? 0x08 : 0; + interleaved[i + 3] += (t[i / 8] & 0x10) == 0x10 ? 0x08 : 0; + interleaved[i + 4] += (t[i / 8] & 0x08) == 0x08 ? 0x08 : 0; + interleaved[i + 5] += (t[i / 8] & 0x04) == 0x04 ? 0x08 : 0; + interleaved[i + 6] += (t[i / 8] & 0x02) == 0x02 ? 0x08 : 0; + interleaved[i + 7] += (t[i / 8] & 0x01) == 0x01 ? 0x08 : 0; - interleaved[i] += ((u[i / 8] & 0x80) == 0x80 ? 0x04 : 0); - interleaved[i + 1] += ((u[i / 8] & 0x40) == 0x40 ? 0x04 : 0); - interleaved[i + 2] += ((u[i / 8] & 0x20) == 0x20 ? 0x04 : 0); - interleaved[i + 3] += ((u[i / 8] & 0x10) == 0x10 ? 0x04 : 0); - interleaved[i + 4] += ((u[i / 8] & 0x08) == 0x08 ? 0x04 : 0); - interleaved[i + 5] += ((u[i / 8] & 0x04) == 0x04 ? 0x04 : 0); - interleaved[i + 6] += ((u[i / 8] & 0x02) == 0x02 ? 0x04 : 0); - interleaved[i + 7] += ((u[i / 8] & 0x01) == 0x01 ? 0x04 : 0); + interleaved[i] += (u[i / 8] & 0x80) == 0x80 ? 0x04 : 0; + interleaved[i + 1] += (u[i / 8] & 0x40) == 0x40 ? 0x04 : 0; + interleaved[i + 2] += (u[i / 8] & 0x20) == 0x20 ? 0x04 : 0; + interleaved[i + 3] += (u[i / 8] & 0x10) == 0x10 ? 0x04 : 0; + interleaved[i + 4] += (u[i / 8] & 0x08) == 0x08 ? 0x04 : 0; + interleaved[i + 5] += (u[i / 8] & 0x04) == 0x04 ? 0x04 : 0; + interleaved[i + 6] += (u[i / 8] & 0x02) == 0x02 ? 0x04 : 0; + interleaved[i + 7] += (u[i / 8] & 0x01) == 0x01 ? 0x04 : 0; - interleaved[i] += ((v[i / 8] & 0x80) == 0x80 ? 0x02 : 0); - interleaved[i + 1] += ((v[i / 8] & 0x40) == 0x40 ? 0x02 : 0); - interleaved[i + 2] += ((v[i / 8] & 0x20) == 0x20 ? 0x02 : 0); - interleaved[i + 3] += ((v[i / 8] & 0x10) == 0x10 ? 0x02 : 0); - interleaved[i + 4] += ((v[i / 8] & 0x08) == 0x08 ? 0x02 : 0); - interleaved[i + 5] += ((v[i / 8] & 0x04) == 0x04 ? 0x02 : 0); - interleaved[i + 6] += ((v[i / 8] & 0x02) == 0x02 ? 0x02 : 0); - interleaved[i + 7] += ((v[i / 8] & 0x01) == 0x01 ? 0x02 : 0); + interleaved[i] += (v[i / 8] & 0x80) == 0x80 ? 0x02 : 0; + interleaved[i + 1] += (v[i / 8] & 0x40) == 0x40 ? 0x02 : 0; + interleaved[i + 2] += (v[i / 8] & 0x20) == 0x20 ? 0x02 : 0; + interleaved[i + 3] += (v[i / 8] & 0x10) == 0x10 ? 0x02 : 0; + interleaved[i + 4] += (v[i / 8] & 0x08) == 0x08 ? 0x02 : 0; + interleaved[i + 5] += (v[i / 8] & 0x04) == 0x04 ? 0x02 : 0; + interleaved[i + 6] += (v[i / 8] & 0x02) == 0x02 ? 0x02 : 0; + interleaved[i + 7] += (v[i / 8] & 0x01) == 0x01 ? 0x02 : 0; - interleaved[i] += ((w[i / 8] & 0x80) == 0x80 ? 0x01 : 0); - interleaved[i + 1] += ((w[i / 8] & 0x40) == 0x40 ? 0x01 : 0); - interleaved[i + 2] += ((w[i / 8] & 0x20) == 0x20 ? 0x01 : 0); - interleaved[i + 3] += ((w[i / 8] & 0x10) == 0x10 ? 0x01 : 0); - interleaved[i + 4] += ((w[i / 8] & 0x08) == 0x08 ? 0x01 : 0); - interleaved[i + 5] += ((w[i / 8] & 0x04) == 0x04 ? 0x01 : 0); - interleaved[i + 6] += ((w[i / 8] & 0x02) == 0x02 ? 0x01 : 0); - interleaved[i + 7] += ((w[i / 8] & 0x01) == 0x01 ? 0x01 : 0); + interleaved[i] += (w[i / 8] & 0x80) == 0x80 ? 0x01 : 0; + interleaved[i + 1] += (w[i / 8] & 0x40) == 0x40 ? 0x01 : 0; + interleaved[i + 2] += (w[i / 8] & 0x20) == 0x20 ? 0x01 : 0; + interleaved[i + 3] += (w[i / 8] & 0x10) == 0x10 ? 0x01 : 0; + interleaved[i + 4] += (w[i / 8] & 0x08) == 0x08 ? 0x01 : 0; + interleaved[i + 5] += (w[i / 8] & 0x04) == 0x04 ? 0x01 : 0; + interleaved[i + 6] += (w[i / 8] & 0x02) == 0x02 ? 0x01 : 0; + interleaved[i + 7] += (w[i / 8] & 0x01) == 0x01 ? 0x01 : 0; } free(p); diff --git a/src/crc64/crc64.c b/src/crc64/crc64.c index a2bba08..6361450 100644 --- a/src/crc64/crc64.c +++ b/src/crc64/crc64.c @@ -32,7 +32,7 @@ AARU_EXPORT crc64_ctx *AARU_CALL aaruf_crc64_init(void) { TRACE("Entering aaruf_crc64_init()"); - crc64_ctx *ctx = (crc64_ctx *)malloc(sizeof(crc64_ctx)); + crc64_ctx *ctx = malloc(sizeof(crc64_ctx)); if(!ctx) return NULL; @@ -107,26 +107,26 @@ AARU_EXPORT void AARU_CALL aaruf_crc64_slicing(uint64_t *previous_crc, const uin { const uint8_t *limit = NULL; - while((uintptr_t)(data) & 3) + while((uintptr_t)data & 3) { - c = crc64_table[0][*data++ ^ ((c) & 0xFF)] ^ ((c) >> 8); + c = crc64_table[0][*data++ ^ c & 0xFF] ^ c >> 8; --len; } - limit = data + (len & ~(uint32_t)(3)); - len &= (uint32_t)(3); + limit = data + (len & ~(uint32_t)3); + len &= (uint32_t)3; while(data < limit) { - const uint32_t tmp = c ^ *(const uint32_t *)(data); + const uint32_t tmp = c ^ *(const uint32_t *)data; data += 4; - c = crc64_table[3][((tmp) & 0xFF)] ^ crc64_table[2][(((tmp) >> 8) & 0xFF)] ^ ((c) >> 32) ^ - crc64_table[1][(((tmp) >> 16) & 0xFF)] ^ crc64_table[0][((tmp) >> 24)]; + c = crc64_table[3][(tmp & 0xFF)] ^ crc64_table[2][(tmp >> 8 & 0xFF)] ^ c >> 32 ^ + crc64_table[1][(tmp >> 16 & 0xFF)] ^ crc64_table[0][(tmp >> 24)]; } } - while(len-- != 0) c = crc64_table[0][*data++ ^ ((c) & 0xFF)] ^ ((c) >> 8); + while(len-- != 0) c = crc64_table[0][*data++ ^ c & 0xFF] ^ c >> 8; *previous_crc = c; } diff --git a/src/crc64/crc64_clmul.c b/src/crc64/crc64_clmul.c index 89b2fe6..c5e5b7d 100644 --- a/src/crc64/crc64_clmul.c +++ b/src/crc64/crc64_clmul.c @@ -34,19 +34,19 @@ // Reverses bits static uint64_t bitReflect(uint64_t v) { - v = ((v >> 1) & 0x5555555555555555) | ((v & 0x5555555555555555) << 1); - v = ((v >> 2) & 0x3333333333333333) | ((v & 0x3333333333333333) << 2); - v = ((v >> 4) & 0x0F0F0F0F0F0F0F0F) | ((v & 0x0F0F0F0F0F0F0F0F) << 4); - v = ((v >> 8) & 0x00FF00FF00FF00FF) | ((v & 0x00FF00FF00FF00FF) << 8); - v = ((v >> 16) & 0x0000FFFF0000FFFF) | ((v & 0x0000FFFF0000FFFF) << 16); - v = (v >> 32) | (v << 32); + v = v >> 1 & 0x5555555555555555 | (v & 0x5555555555555555) << 1; + v = v >> 2 & 0x3333333333333333 | (v & 0x3333333333333333) << 2; + v = v >> 4 & 0x0F0F0F0F0F0F0F0F | (v & 0x0F0F0F0F0F0F0F0F) << 4; + v = v >> 8 & 0x00FF00FF00FF00FF | (v & 0x00FF00FF00FF00FF) << 8; + v = v >> 16 & 0x0000FFFF0000FFFF | (v & 0x0000FFFF0000FFFF) << 16; + v = v >> 32 | v << 32; return v; } // Computes r*x^N mod p(x) static uint64_t expMod65(uint32_t n, uint64_t p, uint64_t r) { - return n == 0 ? r : expMod65(n - 1, p, (r << 1) ^ (p & ((int64_t)r >> 63))); + return n == 0 ? r : expMod65(n - 1, p, r << 1 ^ p & (int64_t)r >> 63); } // Computes x^129 / p(x); the result has an implicit 65th bit. @@ -56,8 +56,8 @@ static uint64_t div129by65(uint64_t poly) uint64_t h = poly; for(uint32_t i = 0; i < 64; ++i) { - q |= (h & (1ull << 63)) >> i; - h = (h << 1) ^ (poly & ((int64_t)h >> 63)); + q |= (h & 1ull << 63) >> i; + h = h << 1 ^ poly & (int64_t)h >> 63; } return q; } @@ -106,7 +106,7 @@ AARU_EXPORT CLMUL uint64_t AARU_CALL aaruf_crc64_clmul(const uint64_t crc, const // Align pointers const __m128i *aligned_data = (const __m128i *)((uintptr_t)data & ~(uintptr_t)15); - const __m128i *aligned_end = (const __m128i *)(((uintptr_t)end + 15) & ~(uintptr_t)15); + const __m128i *aligned_end = (const __m128i *)((uintptr_t)end + 15 & ~(uintptr_t)15); const size_t lead_in_size = data - (const uint8_t *)aligned_data; const size_t lead_out_size = (const uint8_t *)aligned_end - end; @@ -214,8 +214,7 @@ AARU_EXPORT CLMUL uint64_t AARU_CALL aaruf_crc64_clmul(const uint64_t crc, const #if defined(_WIN64) return ~_mm_extract_epi64(t2_reg, 1); #else - return ~(((uint64_t)(uint32_t)_mm_extract_epi32(t2_reg, 3) << 32) | - (uint64_t)(uint32_t)_mm_extract_epi32(t2_reg, 2)); + return ~((uint64_t)(uint32_t)_mm_extract_epi32(t2_reg, 3) << 32 | (uint64_t)(uint32_t)_mm_extract_epi32(t2_reg, 2)); #endif } diff --git a/src/create.c b/src/create.c index b5e5084..94cb84a 100644 --- a/src/create.c +++ b/src/create.c @@ -248,7 +248,7 @@ void *aaruf_create(const char *filepath, const uint32_t media_type, const uint32 // Set the primary DDT offset (just after the header, block aligned) ctx->primaryDdtOffset = sizeof(AaruHeaderV2); // Start just after the header const uint64_t alignmentMask = (1ULL << ctx->userDataDdtHeader.blockAlignmentShift) - 1; - ctx->primaryDdtOffset = (ctx->primaryDdtOffset + alignmentMask) & ~alignmentMask; + ctx->primaryDdtOffset = ctx->primaryDdtOffset + alignmentMask & ~alignmentMask; TRACE("Primary DDT will be placed at offset %" PRIu64, ctx->primaryDdtOffset); @@ -259,7 +259,7 @@ void *aaruf_create(const char *filepath, const uint32_t media_type, const uint32 // Calculate where data blocks can start (after primary DDT + header) const uint64_t dataStartPosition = ctx->primaryDdtOffset + sizeof(DdtHeader2) + primaryTableSize; - ctx->nextBlockPosition = (dataStartPosition + alignmentMask) & ~alignmentMask; + ctx->nextBlockPosition = dataStartPosition + alignmentMask & ~alignmentMask; TRACE("Data blocks will start at position %" PRIu64, ctx->nextBlockPosition); diff --git a/src/ddt/ddt_v2.c b/src/ddt/ddt_v2.c index 1ec5b6d..59c693e 100644 --- a/src/ddt/ddt_v2.c +++ b/src/ddt/ddt_v2.c @@ -1098,8 +1098,8 @@ bool set_ddt_single_level_v2(aaruformatContext *ctx, uint64_t sector_address, co if(*ddt_entry == 0) { const uint64_t block_index = block_offset >> ctx->userDataDdtHeader.blockAlignmentShift; - *ddt_entry = - offset & ((1ULL << ctx->userDataDdtHeader.dataShift) - 1) | block_index << ctx->userDataDdtHeader.dataShift; + *ddt_entry = offset & (1ULL << ctx->userDataDdtHeader.dataShift) - 1 | block_index + << ctx->userDataDdtHeader.dataShift; } if(ctx->userDataDdtHeader.sizeType == SmallDdtSizeType) @@ -1164,7 +1164,6 @@ bool set_ddt_multi_level_v2(aaruformatContext *ctx, uint64_t sector_address, boo uint64_t crc64 = 0; DdtHeader2 ddt_header; size_t written_bytes = 0; - long current_pos = 0; long end_of_file = 0; bool create_new_table = false; @@ -1279,13 +1278,12 @@ bool set_ddt_multi_level_v2(aaruformatContext *ctx, uint64_t sector_address, boo if(ctx->writingBuffer != NULL) aaruf_close_current_block(ctx); // Get current position and seek to end of file - current_pos = ftell(ctx->imageStream); fseek(ctx->imageStream, 0, SEEK_END); end_of_file = ftell(ctx->imageStream); // Align to block boundary uint64_t alignment_mask = (1ULL << ctx->userDataDdtHeader.blockAlignmentShift) - 1; - end_of_file = (end_of_file + alignment_mask) & ~alignment_mask; + end_of_file = end_of_file + alignment_mask & ~alignment_mask; fseek(ctx->imageStream, end_of_file, SEEK_SET); // Prepare DDT header for the never-written cached table @@ -1393,7 +1391,7 @@ bool set_ddt_multi_level_v2(aaruformatContext *ctx, uint64_t sector_address, boo // Update nextBlockPosition to ensure future blocks don't overwrite the DDT uint64_t ddt_total_size = sizeof(DdtHeader2) + ddt_header.length; - ctx->nextBlockPosition = (end_of_file + ddt_total_size + alignment_mask) & ~alignment_mask; + ctx->nextBlockPosition = end_of_file + ddt_total_size + alignment_mask & ~alignment_mask; block_offset = ctx->nextBlockPosition; offset = 0; TRACE("Updated nextBlockPosition after never-written DDT write to %" PRIu64, ctx->nextBlockPosition); @@ -1430,6 +1428,7 @@ bool set_ddt_multi_level_v2(aaruformatContext *ctx, uint64_t sector_address, boo // Step 3: Write the currently in-memory cached secondary level table to the end of the file if(ctx->cachedDdtOffset != 0) { + long current_pos = 0; // Close the current data block first if(ctx->writingBuffer != NULL) aaruf_close_current_block(ctx); @@ -1440,7 +1439,7 @@ bool set_ddt_multi_level_v2(aaruformatContext *ctx, uint64_t sector_address, boo // Align to block boundary uint64_t alignment_mask = (1ULL << ctx->userDataDdtHeader.blockAlignmentShift) - 1; - end_of_file = (end_of_file + alignment_mask) & ~alignment_mask; + end_of_file = end_of_file + alignment_mask & ~alignment_mask; fseek(ctx->imageStream, end_of_file, SEEK_SET); // Prepare DDT header for the cached table @@ -1572,7 +1571,7 @@ bool set_ddt_multi_level_v2(aaruformatContext *ctx, uint64_t sector_address, boo // Update nextBlockPosition to ensure future blocks don't overwrite the DDT uint64_t ddt_total_size = sizeof(DdtHeader2) + ddt_header.length; - ctx->nextBlockPosition = (end_of_file + ddt_total_size + alignment_mask) & ~alignment_mask; + ctx->nextBlockPosition = end_of_file + ddt_total_size + alignment_mask & ~alignment_mask; block_offset = ctx->nextBlockPosition; offset = 0; TRACE("Updated nextBlockPosition after DDT write to %" PRIu64, ctx->nextBlockPosition); diff --git a/src/open.c b/src/open.c index eef24d9..82c8dc3 100644 --- a/src/open.c +++ b/src/open.c @@ -81,7 +81,8 @@ * - Handles both small and large deduplication tables * * @note Block Processing: - * - Processes all indexed blocks including data, DDT, geometry, metadata, tracks, CICM, dump hardware, and checksums + * - Processes all indexed blocks including data, DDT, geometry, metadata, tracks, CICM, dump hardware, and + * checksums * - Non-critical block processing errors are logged but don't prevent opening * - Critical errors (DDT processing failures) cause opening to fail * - Unknown block types are logged but ignored @@ -292,7 +293,7 @@ void *aaruf_open(const char *filepath) for(i = 0; i < utarray_len(index_entries); i++) { - IndexEntry *entry = (IndexEntry *)utarray_eltptr(index_entries, i); + IndexEntry *entry = utarray_eltptr(index_entries, i); TRACE("Block type %4.4s with data type %d is indexed to be at %" PRIu64 "", (char *)&entry->blockType, entry->dataType, entry->offset); } @@ -301,7 +302,7 @@ void *aaruf_open(const char *filepath) ctx->imageInfo.ImageSize = 0; for(i = 0; i < utarray_len(index_entries); i++) { - IndexEntry *entry = (IndexEntry *)utarray_eltptr(index_entries, i); + IndexEntry *entry = utarray_eltptr(index_entries, i); pos = fseek(ctx->imageStream, entry->offset, SEEK_SET); if(pos < 0 || ftell(ctx->imageStream) != entry->offset) diff --git a/src/read.c b/src/read.c index 2d3dc32..f72a1a4 100644 --- a/src/read.c +++ b/src/read.c @@ -524,7 +524,7 @@ int32_t aaruf_read_sector(void *context, const uint64_t sector_address, uint8_t TRACE("Adding block to cache"); add_to_cache_uint64(&ctx->blockCache, block_offset, block); - memcpy(data, block + (offset * block_header->sectorSize), block_header->sectorSize); + memcpy(data, block + offset * block_header->sectorSize, block_header->sectorSize); *length = block_header->sectorSize; TRACE("Exiting aaruf_read_sector() = AARUF_STATUS_OK"); @@ -840,7 +840,7 @@ int32_t aaruf_read_sector_long(void *context, const uint64_t sector_address, uin memcpy(data + 16, bare_data, 2048); if(ctx->sectorPrefix != NULL) - memcpy(data, ctx->sectorPrefix + (sector_address * 16), 16); + memcpy(data, ctx->sectorPrefix + sector_address * 16, 16); else if(ctx->sectorPrefixDdt != NULL) { if((ctx->sectorPrefixDdt[sector_address] & CD_XFIX_MASK) == Correct) diff --git a/src/verify.c b/src/verify.c index e7dc8e7..0462121 100644 --- a/src/verify.c +++ b/src/verify.c @@ -199,7 +199,7 @@ int32_t aaruf_verify_image(void *context) for(int i = 0; i < utarray_len(index_entries); i++) { - IndexEntry *entry = (IndexEntry *)utarray_eltptr(index_entries, i); + IndexEntry *entry = utarray_eltptr(index_entries, i); TRACE("Checking block with type %4.4s at position %" PRIu64 "", (char *)&entry->blockType, entry->offset); fseek(ctx->imageStream, entry->offset, SEEK_SET); diff --git a/src/write.c b/src/write.c index 8ea0334..413abeb 100644 --- a/src/write.c +++ b/src/write.c @@ -157,7 +157,7 @@ int32_t aaruf_write_sector(void *context, uint64_t sector_address, const uint8_t } uint64_t ddt_entry = 0; - bool ddt_ok; + bool ddt_ok; if(ctx->deduplicate) { @@ -170,7 +170,7 @@ int32_t aaruf_write_sector(void *context, uint64_t sector_address, const uint8_t TRACE("Block does %s exist in deduplication map", existing ? "already" : "not yet"); ddt_ok = set_ddt_entry_v2(ctx, sector_address, ctx->currentBlockOffset, ctx->nextBlockPosition, sector_status, - &ddt_entry); + &ddt_entry); if(!ddt_ok) { TRACE("Exiting aaruf_write_sector() = AARUF_ERROR_CANNOT_SET_DDT_ENTRY"); @@ -189,7 +189,7 @@ int32_t aaruf_write_sector(void *context, uint64_t sector_address, const uint8_t } else ddt_ok = set_ddt_entry_v2(ctx, sector_address, ctx->currentBlockOffset, ctx->nextBlockPosition, sector_status, - &ddt_entry); + &ddt_entry); if(!ddt_ok) { @@ -281,7 +281,7 @@ int32_t aaruf_close_current_block(aaruformatContext *ctx) // Update nextBlockPosition to point to the next available aligned position uint64_t block_total_size = sizeof(BlockHeader) + ctx->currentBlockHeader.cmpLength; uint64_t alignment_mask = (1ULL << ctx->userDataDdtHeader.blockAlignmentShift) - 1; - ctx->nextBlockPosition = (ctx->nextBlockPosition + block_total_size + alignment_mask) & ~alignment_mask; + ctx->nextBlockPosition = ctx->nextBlockPosition + block_total_size + alignment_mask & ~alignment_mask; TRACE("Updated nextBlockPosition to %" PRIu64, ctx->nextBlockPosition); // Clear values diff --git a/tests/crc32.c b/tests/crc32.c index 2007569..84b159f 100644 --- a/tests/crc32.c +++ b/tests/crc32.c @@ -36,14 +36,14 @@ extern "C" for(int j = 0; j < 8; j++) if((entry & 1) == 1) - entry = (entry >> 1) ^ CRC32_ISO_POLY; + entry = entry >> 1 ^ CRC32_ISO_POLY; else entry >>= 1; localTable[i] = entry; } - for(i = 0; i < len; i++) localHashInt = (localHashInt >> 8) ^ localTable[data[i] ^ (localHashInt & 0xff)]; + for(i = 0; i < len; i++) localHashInt = localHashInt >> 8 ^ localTable[data[i] ^ localHashInt & 0xff]; localHashInt ^= CRC32_ISO_SEED; diff --git a/tool/cli_compare.c b/tool/cli_compare.c index a9b5180..401256c 100644 --- a/tool/cli_compare.c +++ b/tool/cli_compare.c @@ -110,8 +110,8 @@ int cli_compare(const char *path1, const char *path2) read_result2 = aaruf_read_sector(ctx2, sector, buffer2, &buffer2_length); // Handle read errors or missing sectors - const bool sector1_available = (read_result1 == AARUF_STATUS_OK); - const bool sector2_available = (read_result2 == AARUF_STATUS_OK); + const bool sector1_available = read_result1 == AARUF_STATUS_OK; + const bool sector2_available = read_result2 == AARUF_STATUS_OK; bool sectors_different = false; if(!sector1_available && !sector2_available) @@ -149,7 +149,7 @@ int cli_compare(const char *path1, const char *path2) // Update progress every 1000 sectors or at the end if(sectors_processed % 1000 == 0 || sector == total_sectors - 1) { - const int progress = (int)((sectors_processed * 100) / total_sectors); + const int progress = (int)(sectors_processed * 100 / total_sectors); printf("Progress: %d%% (%llu/%llu sectors)\r", progress, (unsigned long long)sectors_processed, (unsigned long long)total_sectors); fflush(stdout); diff --git a/tool/compare.c b/tool/compare.c index 0854df6..3ecb510 100644 --- a/tool/compare.c +++ b/tool/compare.c @@ -30,7 +30,7 @@ void draw_progress_bar(int row, int percent) { const int width = tb_width() / 2; const int bar_width = width - 4; // leave space for borders - const int filled = (bar_width * percent) / 100; + const int filled = bar_width * percent / 100; // Draw progress bar outline tb_printf(2, row, TB_YELLOW | TB_BOLD, TB_BLUE, "["); diff --git a/tool/convert.c b/tool/convert.c index 45f33a8..7ac559a 100644 --- a/tool/convert.c +++ b/tool/convert.c @@ -88,7 +88,7 @@ int convert(const char *input_path, const char *output_path) if(sector % 1000 == 0 || sector == total_sectors - 1) { printf("\rProgress: %llu/%llu sectors (%.1f%%)", (unsigned long long)sector + 1, - (unsigned long long)total_sectors, ((double)(sector + 1) / total_sectors) * 100.0); + (unsigned long long)total_sectors, (double)(sector + 1) / total_sectors * 100.0); fflush(stdout); } diff --git a/tool/ecc_cd.c b/tool/ecc_cd.c index d01e6d8..2bfde76 100644 --- a/tool/ecc_cd.c +++ b/tool/ecc_cd.c @@ -83,7 +83,7 @@ bool check_cd_sector_channel(CdEccContext *context, const uint8_t *sector, bool edc = 0; size = 0x810; pos = 0; - for(; size > 0; size--) edc = (edc >> 8) ^ context->edc_table[(edc ^ sector[pos++]) & 0xFF]; + for(; size > 0; size--) edc = edc >> 8 ^ context->edc_table[(edc ^ sector[pos++]) & 0xFF]; calculatedEdc = edc; *edc_correct = calculatedEdc == storedEdc; @@ -128,7 +128,7 @@ bool check_cd_sector_channel(CdEccContext *context, const uint8_t *sector, bool edc = 0; size = 0x808; pos = 0x10; - for(; size > 0; size--) edc = (edc >> 8) ^ context->edc_table[(edc ^ sector[pos++]) & 0xFF]; + for(; size > 0; size--) edc = edc >> 8 ^ context->edc_table[(edc ^ sector[pos++]) & 0xFF]; calculatedEdc = edc; *edc_correct = calculatedEdc == storedEdc; @@ -151,7 +151,7 @@ bool check_cd_sector_channel(CdEccContext *context, const uint8_t *sector, bool edc = 0; size = 0x808; pos = 0x10; - for(; size > 0; size--) edc = (edc >> 8) ^ context->edc_table[(edc ^ sector[pos++]) & 0xFF]; + for(; size > 0; size--) edc = edc >> 8 ^ context->edc_table[(edc ^ sector[pos++]) & 0xFF]; calculatedEdc = edc; *edc_correct = calculatedEdc == storedEdc; diff --git a/tool/info.c b/tool/info.c index 32af767..1dc6842 100644 --- a/tool/info.c +++ b/tool/info.c @@ -32,10 +32,9 @@ int info(const char *path) aaruformatContext *ctx = NULL; char *strBuffer = NULL; UErrorCode u_error_code = U_ZERO_ERROR; - uint i = 0; - mediaTagEntry const *mediaTag = NULL; - mediaTagEntry const *tmpMediaTag = NULL; - UChar ustr[128]; + uint i = 0; + mediaTagEntry const *mediaTag = NULL; + mediaTagEntry const *tmpMediaTag = NULL; ctx = aaruf_open(path); @@ -53,7 +52,7 @@ int info(const char *path) strBuffer = malloc(65); memset(strBuffer, 0, 65); - ucnv_convert(NULL, "UTF-16LE", strBuffer, 64, (const char *)ctx->header.application, 64, &u_error_code); + ucnv_convert(NULL, "UTF-16LE", strBuffer, 64, ctx->header.application, 64, &u_error_code); if(u_error_code == U_ZERO_ERROR) printf("\tApplication: %s\n", strBuffer); free(strBuffer); @@ -285,7 +284,7 @@ int info(const char *path) memset(strBuffer, 0, ctx->dumpHardwareEntriesWithData[i].entry.manufacturerLength + 1); ucnv_convert(NULL, "UTF-8", strBuffer, (int)ctx->dumpHardwareEntriesWithData[i].entry.manufacturerLength, - (char *)(ctx->dumpHardwareEntriesWithData[i].manufacturer), + (char *)ctx->dumpHardwareEntriesWithData[i].manufacturer, (int)ctx->dumpHardwareEntriesWithData[i].entry.manufacturerLength, &u_error_code); printf("\t\tManufacturer: %s\n", strBuffer); free(strBuffer); @@ -296,7 +295,7 @@ int info(const char *path) strBuffer = malloc(ctx->dumpHardwareEntriesWithData[i].entry.modelLength + 1); memset(strBuffer, 0, ctx->dumpHardwareEntriesWithData[i].entry.modelLength + 1); ucnv_convert(NULL, "UTF-8", strBuffer, (int)ctx->dumpHardwareEntriesWithData[i].entry.modelLength, - (char *)(ctx->dumpHardwareEntriesWithData[i].model), + (char *)ctx->dumpHardwareEntriesWithData[i].model, (int)ctx->dumpHardwareEntriesWithData[i].entry.modelLength, &u_error_code); printf("\t\tModel: %s\n", strBuffer); free(strBuffer); @@ -307,7 +306,7 @@ int info(const char *path) strBuffer = malloc(ctx->dumpHardwareEntriesWithData[i].entry.revisionLength + 1); memset(strBuffer, 0, ctx->dumpHardwareEntriesWithData[i].entry.revisionLength + 1); ucnv_convert(NULL, "UTF-8", strBuffer, (int)ctx->dumpHardwareEntriesWithData[i].entry.revisionLength, - (char *)(ctx->dumpHardwareEntriesWithData[i].revision), + (char *)ctx->dumpHardwareEntriesWithData[i].revision, (int)ctx->dumpHardwareEntriesWithData[i].entry.revisionLength, &u_error_code); printf("\t\tRevision: %s\n", strBuffer); free(strBuffer); @@ -318,7 +317,7 @@ int info(const char *path) strBuffer = malloc(ctx->dumpHardwareEntriesWithData[i].entry.firmwareLength + 1); memset(strBuffer, 0, ctx->dumpHardwareEntriesWithData[i].entry.firmwareLength + 1); ucnv_convert(NULL, "UTF-8", strBuffer, (int)ctx->dumpHardwareEntriesWithData[i].entry.firmwareLength, - (char *)(ctx->dumpHardwareEntriesWithData[i].firmware), + (char *)ctx->dumpHardwareEntriesWithData[i].firmware, (int)ctx->dumpHardwareEntriesWithData[i].entry.firmwareLength, &u_error_code); printf("\t\tFirmware version: %s\n", strBuffer); free(strBuffer); @@ -329,7 +328,7 @@ int info(const char *path) strBuffer = malloc(ctx->dumpHardwareEntriesWithData[i].entry.serialLength + 1); memset(strBuffer, 0, ctx->dumpHardwareEntriesWithData[i].entry.serialLength + 1); ucnv_convert(NULL, "UTF-8", strBuffer, (int)ctx->dumpHardwareEntriesWithData[i].entry.serialLength, - (char *)(ctx->dumpHardwareEntriesWithData[i].serial), + (char *)ctx->dumpHardwareEntriesWithData[i].serial, (int)ctx->dumpHardwareEntriesWithData[i].entry.serialLength, &u_error_code); printf("\t\tSerial number: %s\n", strBuffer); free(strBuffer); @@ -341,7 +340,7 @@ int info(const char *path) memset(strBuffer, 0, ctx->dumpHardwareEntriesWithData[i].entry.softwareNameLength + 1); ucnv_convert(NULL, "UTF-8", strBuffer, (int)ctx->dumpHardwareEntriesWithData[i].entry.softwareNameLength, - (char *)(ctx->dumpHardwareEntriesWithData[i].softwareName), + (char *)ctx->dumpHardwareEntriesWithData[i].softwareName, (int)ctx->dumpHardwareEntriesWithData[i].entry.softwareNameLength, &u_error_code); printf("\t\tSoftware name: %s\n", strBuffer); free(strBuffer); @@ -353,7 +352,7 @@ int info(const char *path) memset(strBuffer, 0, ctx->dumpHardwareEntriesWithData[i].entry.softwareVersionLength + 1); ucnv_convert(NULL, "UTF-8", strBuffer, (int)ctx->dumpHardwareEntriesWithData[i].entry.softwareVersionLength, - (char *)(ctx->dumpHardwareEntriesWithData[i].softwareVersion), + (char *)ctx->dumpHardwareEntriesWithData[i].softwareVersion, (int)ctx->dumpHardwareEntriesWithData[i].entry.softwareVersionLength, &u_error_code); printf("\t\tSoftware version: %s\n", strBuffer); free(strBuffer); @@ -365,7 +364,7 @@ int info(const char *path) memset(strBuffer, 0, ctx->dumpHardwareEntriesWithData[i].entry.softwareOperatingSystemLength + 1); ucnv_convert(NULL, "UTF-8", strBuffer, (int)ctx->dumpHardwareEntriesWithData[i].entry.softwareOperatingSystemLength, - (char *)(ctx->dumpHardwareEntriesWithData[i].softwareOperatingSystem), + (char *)ctx->dumpHardwareEntriesWithData[i].softwareOperatingSystem, (int)ctx->dumpHardwareEntriesWithData[i].entry.softwareOperatingSystemLength, &u_error_code); printf("\t\tSoftware operating system: %s\n", strBuffer);