Skip to content

Commit e88a59a

Browse files
committed
mask off bad conversion task launches
1 parent 5a93f5d commit e88a59a

File tree

2 files changed

+37
-15
lines changed

2 files changed

+37
-15
lines changed

src/base/base_strings.c

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -85,25 +85,40 @@ correct_slash_from_char(U8 c)
8585
internal U64
8686
cstring8_length(U8 *c)
8787
{
88-
U8 *p = c;
89-
for (;*p != 0; p += 1);
90-
return (p - c);
88+
U64 length = 0;
89+
if(c)
90+
{
91+
U8 *p = c;
92+
for (;*p != 0; p += 1);
93+
length = (U64)(p - c);
94+
}
95+
return length;
9196
}
9297

9398
internal U64
9499
cstring16_length(U16 *c)
95100
{
96-
U16 *p = c;
97-
for (;*p != 0; p += 1);
98-
return (p - c);
101+
U64 length = 0;
102+
if(c)
103+
{
104+
U16 *p = c;
105+
for (;*p != 0; p += 1);
106+
length = (U64)(p - c);
107+
}
108+
return length;
99109
}
100110

101111
internal U64
102112
cstring32_length(U32 *c)
103113
{
104-
U32 *p = c;
105-
for (;*p != 0; p += 1);
106-
return (p - c);
114+
U64 length = 0;
115+
if(c)
116+
{
117+
U32 *p = c;
118+
for (;*p != 0; p += 1);
119+
length = (U64)(p - c);
120+
}
121+
return length;
107122
}
108123

109124
////////////////////////////////

src/dbg_info/dbg_info.c

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -677,12 +677,12 @@ di_async_tick(void)
677677
}
678678
}
679679

680-
//- rjf: analyze O.G. debug info
680+
//- rjf: analyze O.G. debug info
681681
if(!t->og_analyzed)
682682
{
683683
t->og_analyzed = 1;
684684
OS_Handle file = os_file_open(OS_AccessFlag_ShareRead|OS_AccessFlag_Read, og_path);
685-
FileProperties props = os_properties_from_file(file);
685+
FileProperties props = os_properties_from_file(file);
686686
t->og_size = props.size;
687687
U64 rdi_magic_maybe = 0;
688688
if(os_file_read_struct(file, 0, &rdi_magic_maybe) == 8 &&
@@ -692,11 +692,12 @@ di_async_tick(void)
692692
}
693693
os_file_close(file);
694694
}
695-
U64 og_size = t->og_size;
695+
U64 og_size = t->og_size;
696696
B32 og_is_rdi = t->og_is_rdi;
697+
B32 og_is_good = (og_size > 0);
697698

698699
//- rjf: compute key's RDI path
699-
String8 rdi_path = {0};
700+
String8 rdi_path = {0};
700701
{
701702
if(og_is_rdi)
702703
{
@@ -785,7 +786,7 @@ di_async_tick(void)
785786
}
786787

787788
//- rjf: launch conversion processes
788-
if(ready_to_launch_conversion)
789+
if(og_is_good && ready_to_launch_conversion)
789790
{
790791
B32 should_compress = 0;
791792
OS_ProcessLaunchParams params = {0};
@@ -848,7 +849,13 @@ di_async_tick(void)
848849
di_shared->conversion_thread_count -= t->thread_count;
849850
}
850851
}
851-
}
852+
}
853+
854+
//- rjf: ready to launch, but bad O.G. file -> just immediately mark as done
855+
if(!og_is_good && ready_to_launch_conversion)
856+
{
857+
t->status = DI_LoadTaskStatus_Done;
858+
}
852859

853860
//- rjf: if the RDI for this task is not stale, then we're already done - mark this
854861
// task as done & prepped for storing into the cache

0 commit comments

Comments
 (0)