fix issues
This commit is contained in:
parent
e07604dc4b
commit
eaaad38fac
@ -21,7 +21,7 @@
|
||||
# define ACG_TID (0x700FU) // you should replace ACG_TID to log an actual TID
|
||||
#endif
|
||||
#if !defined(ACG_LOC_FULL)
|
||||
# define ACG_LOC_FULL (__FILE__ ":" ACG_UTIL_STR2(__func__) ":" ACG_UTIL_STR2(__LINE__))
|
||||
# define ACG_LOC_FULL (__FILE__ ":" ACG_UTIL_STR2(__LINE__))
|
||||
#endif
|
||||
#if !defined(ACG_LOC_SHORT)
|
||||
# define ACG_LOC_SHORT ACG_UTIL_STR2(__LINE__)
|
||||
@ -48,7 +48,7 @@
|
||||
)
|
||||
#define ACG_END(s) ( \
|
||||
acg_stream_write_chunk_end((s)) && \
|
||||
acg_stream_write_chunk_loc((s), sizeof(ACG_LOC_FULL)-1U,(const uint8_t*) ACG_LOC_FULL) && \
|
||||
acg_stream_write_chunk_loc((s), sizeof(ACG_LOC_SHORT)-1U,(const uint8_t*) ACG_LOC_SHORT) && \
|
||||
acg_stream_write_chunk_ctx((s), ACG_NOW, ACG_TID) && \
|
||||
ACG_FLUSH((s)) \
|
||||
)
|
||||
@ -188,7 +188,7 @@ static inline bool acg_stream_write_chunk_ctx(struct acg_stream* s, uint64_t tim
|
||||
assert(NULL != s);
|
||||
return
|
||||
acg_stream_write_uint(s, ACG_CHUNK_CTX, ACG_UNITBITS_CHUNK_ID) &&
|
||||
acg_stream_write_uint(s, time, 64U) &&
|
||||
acg_stream_write_uint(s, time, 32U) &&
|
||||
acg_stream_write_uint(s, tid, 16U);
|
||||
}
|
||||
static inline bool acg_stream_write_chunk_loc(struct acg_stream* s, uint64_t size_bytes, const uint8_t* buf) {
|
||||
|
@ -11,7 +11,6 @@
|
||||
|
||||
static inline bool acg_stream_flush(struct acg_stream* s) {
|
||||
assert(NULL != s);
|
||||
acg_stream_write_chunk_pad(s);
|
||||
if (s->cursor_bits < 8U) {
|
||||
return false;
|
||||
}
|
||||
@ -42,8 +41,6 @@ static inline bool acg_stream_flush(struct acg_stream* s) {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
#undef ACG_LOC_FULL
|
||||
#define ACG_LOC_FULL ACG_LOC_SHORT
|
||||
#undef ACG_FLUSH
|
||||
#define ACG_FLUSH(s) acg_stream_flush((s))
|
||||
|
||||
|
@ -86,11 +86,17 @@ int main(int argc, char** argv) {
|
||||
fprintf(stderr, "failed to read BLOB in BLOB chunk\n");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
INDENT_PRINT("-BLOB: %.*s", (int) size, (const char*) buf);
|
||||
if (size <= 8U) {
|
||||
uint64_t v = 0U;
|
||||
memcpy(&v, buf, size);
|
||||
INDENT_PRINT("-BLOB: 0x%" PRIu64 " (size:%" PRIu64 ")", v, size);
|
||||
} else {
|
||||
INDENT_PRINT("-BLOB: %.*s", (int) size, (const char*) buf);
|
||||
}
|
||||
} break;
|
||||
case ACG_CHUNK_CTX: {
|
||||
uint64_t time;
|
||||
if (!acg_stream_read_uint(&s, &time, 64U)) {
|
||||
if (!acg_stream_read_uint(&s, &time, 32U)) {
|
||||
fprintf(stderr, "failed to read TIME in CTX chunk\n");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user