Skip to content

Commit 073a0fc

Browse files
committed
add checksum checking for timestamps; fix incorrect sha256 async checksum calculation; plug file-ood back in
1 parent f8229a3 commit 073a0fc

File tree

1 file changed

+8
-23
lines changed

1 file changed

+8
-23
lines changed

src/raddbg/raddbg_views.c

Lines changed: 8 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2053,7 +2053,7 @@ rd_sha256_artifact_create(String8 key, B32 *cancel_out, B32 *retry_out)
20532053
U128 hash = {0};
20542054
str8_deserial_read_struct(key, 0, &hash);
20552055
String8 data = c_data_from_hash(access, hash);
2056-
SHA1 sha256 = sha1_from_data(data);
2056+
SHA256 sha256 = sha256_from_data(data);
20572057
StaticAssert(sizeof(result) >= sizeof(sha256), artifact_size_check);
20582058
MemoryCopy(&result, &sha256, Min(sizeof(result), sizeof(sha256)));
20592059
access_close(access);
@@ -2299,7 +2299,7 @@ RD_VIEW_UI_FUNCTION_DEF(text)
22992299
checksum_kind = src->checksum_kind;
23002300
RDI_SectionKind checksum_section_kind = rdi_section_kind_from_checksum_kind(checksum_kind);
23012301
U64 checksum_size = rdi_section_element_size_table[checksum_section_kind];
2302-
U8 *checksum_data = rdi_section_raw_element_from_kind_idx(rdi, checksum_section_kind, src->checksum_idx);
2302+
U8 *checksum_data = (U8 *)rdi_section_raw_element_from_kind_idx(rdi, checksum_section_kind, src->checksum_idx);
23032303
checksum_expected = str8_copy(scratch.arena, str8(checksum_data, checksum_size));
23042304
break;
23052305
}
@@ -2332,30 +2332,15 @@ RD_VIEW_UI_FUNCTION_DEF(text)
23322332
String8 sha256_string = str8_struct(&sha256);
23332333
file_is_out_of_date = !str8_match(sha256_string, checksum_expected, 0);
23342334
}break;
2335+
case RDI_ChecksumKind_Timestamp:
2336+
{
2337+
FileProperties props = os_properties_from_file_path(rd_regs()->file_path);
2338+
String8 timestamp_string = str8_struct(&props.modified);
2339+
file_is_out_of_date = !str8_match(timestamp_string, checksum_expected, 0);
2340+
}break;
23352341
}
23362342

2337-
// TODO(rjf): turn this back on once done...
2338-
file_is_out_of_date = 0;
2339-
23402343
scratch_end(scratch);
2341-
2342-
// TODO(rjf): @dbgi2
2343-
#if 0
2344-
U64 file_timestamp = os_properties_from_file_path(rd_regs()->file_path).modified;
2345-
if(file_timestamp != 0)
2346-
{
2347-
for(DI_KeyNode *n = dbgi_keys.first; n != 0; n = n->next)
2348-
{
2349-
DI_Key key = n->v;
2350-
if(key.min_timestamp < file_timestamp && key.min_timestamp != 0 && key.path.size != 0)
2351-
{
2352-
file_is_out_of_date = 1;
2353-
out_of_date_dbgi_name = str8_skip_last_slash(key.path);
2354-
break;
2355-
}
2356-
}
2357-
}
2358-
#endif
23592344
}
23602345

23612346
//////////////////////////////

0 commit comments

Comments
 (0)