fix empty file edge case in hash store / text cache

This commit is contained in:
Ryan Fleury
2024-10-22 16:19:01 -07:00
parent 340396f9f7
commit c67f1a8b4a
5 changed files with 14 additions and 16 deletions
+1 -4
View File
@@ -14,10 +14,7 @@ internal U128
hs_hash_from_data(String8 data)
{
U128 u128 = {0};
if(data.size != 0)
{
blake2b((U8 *)&u128.u64[0], sizeof(u128), data.str, data.size, 0, 0);
}
blake2b((U8 *)&u128.u64[0], sizeof(u128), data.str, data.size, 0, 0);
return u128;
}
+8 -3
View File
@@ -18,22 +18,27 @@
// [ ] disasm starting address - need to use debug info for more correct
// results...
//
//
//
// [ ] linked list view rule
//
// [ ] investigate false exceptions, being reported while stepping through init code
// [ ] output: add option for scroll-to-bottom - ensure this shows up in universal ctx menu
// [ ] universal ctx menu address/watch options; e.g. watch -> memory; watch -> add watch
//
// [ ] EVAL LOOKUP RULES -> currently going 0 -> rdis_count, but we need
// to prioritize the primary rdi
//
// [ ] (reported by forrest) 'set-next-statement' -> prioritize current
// module/symbol, in cases where one line maps to many voffs
//
// [ ] collapse upstream state for theme/bindings/settings into entities; use cache accelerators if needed to make up difference
// [ ] collapse upstream state for windows/panels/tabs into entities; use downstream window/view resource cache to make up the difference
// [ ] entity <-> mdesk paths
//
// [ ] universal ctx menu address/watch options; e.g. watch -> memory; watch -> add watch
// [ ] rich hover coverage; bitmap <-> geo <-> memory <-> disassembly <-> text; etc.
//
// [ ] save view column pcts; generalize to being a first-class thing in
// RD_View, e.g. by just having a string -> f32 store
//
// [ ] visualize all breakpoints everywhere - source view should show up in
// disasm, disasm should show up in source view, function should show up in
// both, etc.
+2 -2
View File
@@ -5716,7 +5716,7 @@ RD_VIEW_RULE_UI_FUNCTION_DEF(pending_file)
{
HS_Scope *hs_scope = hs_scope_open();
String8 data = hs_data_from_hash(hs_scope, file_hash);
if(data.size != 0)
if(!u128_match(file_hash, u128_zero()))
{
U64 num_utf8_bytes = 0;
U64 num_unknown_bytes = 0;
@@ -5737,7 +5737,7 @@ RD_VIEW_RULE_UI_FUNCTION_DEF(pending_file)
}
}
file_is_ready = 1;
if(num_utf8_bytes > num_unknown_bytes*4)
if(num_utf8_bytes > num_unknown_bytes*4 || num_unknown_bytes == 0)
{
viewer_kind = RD_ViewRuleKind_Text;
}
+2 -6
View File
@@ -1734,9 +1734,8 @@ rd_code_slice(RD_CodeSliceParams *params, TxtPt *cursor, TxtPt *mark, S64 *prefe
mouse_pt = txt_pt(line_num, column);
// rjf: clamp
if(dim_1s64(params->line_num_range) > 0)
{
U64 last_line_size = params->line_text[dim_1s64(params->line_num_range)-1].size;
U64 last_line_size = params->line_text[dim_1s64(params->line_num_range)].size;
TxtRng legal_pt_rng = txt_rng(txt_pt(params->line_num_range.min, 1),
txt_pt(params->line_num_range.max, last_line_size+1));
if(txt_pt_less_than(mouse_pt, legal_pt_rng.min))
@@ -1748,10 +1747,7 @@ rd_code_slice(RD_CodeSliceParams *params, TxtPt *cursor, TxtPt *mark, S64 *prefe
mouse_pt = legal_pt_rng.max;
}
}
else
{
mouse_pt = txt_pt(1, 1);
}
result.mouse_pt = mouse_pt;
}
+1 -1
View File
@@ -2168,7 +2168,7 @@ txt_parse_thread__entry_point(void *p)
//- rjf: data -> text info
Arena *info_arena = 0;
TXT_TextInfo info = {0};
if(got_task && data.size != 0)
if(got_task && !u128_match(hash, u128_zero()))
{
info_arena = arena_alloc();