diff --git a/src/base/base_strings.c b/src/base/base_strings.c index 84e3f448..7c39715d 100644 --- a/src/base/base_strings.c +++ b/src/base/base_strings.c @@ -85,25 +85,40 @@ correct_slash_from_char(U8 c) internal U64 cstring8_length(U8 *c) { - U8 *p = c; - for (;*p != 0; p += 1); - return (p - c); + U64 length = 0; + if(c) + { + U8 *p = c; + for (;*p != 0; p += 1); + length = (U64)(p - c); + } + return length; } internal U64 cstring16_length(U16 *c) { - U16 *p = c; - for (;*p != 0; p += 1); - return (p - c); + U64 length = 0; + if(c) + { + U16 *p = c; + for (;*p != 0; p += 1); + length = (U64)(p - c); + } + return length; } internal U64 cstring32_length(U32 *c) { - U32 *p = c; - for (;*p != 0; p += 1); - return (p - c); + U64 length = 0; + if(c) + { + U32 *p = c; + for (;*p != 0; p += 1); + length = (U64)(p - c); + } + return length; } //////////////////////////////// diff --git a/src/dbg_info/dbg_info.c b/src/dbg_info/dbg_info.c index 37d8be6a..2feb4798 100644 --- a/src/dbg_info/dbg_info.c +++ b/src/dbg_info/dbg_info.c @@ -677,12 +677,12 @@ di_async_tick(void) } } - //- rjf: analyze O.G. debug info + //- rjf: analyze O.G. debug info if(!t->og_analyzed) { t->og_analyzed = 1; OS_Handle file = os_file_open(OS_AccessFlag_ShareRead|OS_AccessFlag_Read, og_path); - FileProperties props = os_properties_from_file(file); + FileProperties props = os_properties_from_file(file); t->og_size = props.size; U64 rdi_magic_maybe = 0; if(os_file_read_struct(file, 0, &rdi_magic_maybe) == 8 && @@ -692,11 +692,12 @@ di_async_tick(void) } os_file_close(file); } - U64 og_size = t->og_size; + U64 og_size = t->og_size; B32 og_is_rdi = t->og_is_rdi; + B32 og_is_good = (og_size > 0); //- rjf: compute key's RDI path - String8 rdi_path = {0}; + String8 rdi_path = {0}; { if(og_is_rdi) { @@ -785,7 +786,7 @@ di_async_tick(void) } //- rjf: launch conversion processes - if(ready_to_launch_conversion) + if(og_is_good && ready_to_launch_conversion) { B32 should_compress = 0; OS_ProcessLaunchParams params = {0}; @@ -848,7 +849,13 @@ di_async_tick(void) di_shared->conversion_thread_count -= t->thread_count; } } - } + } + + //- rjf: ready to launch, but bad O.G. file -> just immediately mark as done + if(!og_is_good && ready_to_launch_conversion) + { + t->status = DI_LoadTaskStatus_Done; + } //- rjf: if the RDI for this task is not stale, then we're already done - mark this // task as done & prepped for storing into the cache