text
stringlengths
0
1.47k
KERNEL32$FindClose(find_handle);
return count;
}
static void copy_wide_path(wchar_t *dst, const wchar_t *src, size_t dst_count) {
size_t i = 0;
if (!dst || dst_count == 0) {
return;
}
if (!src) {
dst[0] = L'\0';
return;
}
while (src[i] && i + 1 < dst_count) {
dst[i] = src[i] == L'/' ? L'\\' : src[i];
i++;
}
dst[i] = L'\0';
}
static int target_tool_is(const bof_triage_target_t *target, const char *tool) {
int len = 0;
if (!target || !target->tool || !tool) {
return 0;
}
while (target->tool[len]) {
len++;
}
return ascii_equal_n_ci(target->tool, len, tool);
}
static int target_family_is(const bof_triage_target_t *target, const char *family) {
int len = 0;
if (!target || !target->family || !family) {
return 0;
}
while (target->family[len]) {
len++;
}
return ascii_equal_n_ci(target->family, len, family);
}
static int target_is_file(const bof_triage_target_t *target) {
return target && target->type && target->type[0] == 'f';
}
static int target_is_directory(const bof_triage_target_t *target) {
return target && target->type && target->type[0] == 'd';
}
static int target_is_tier2_review(const bof_triage_target_t *target) {
return target && target->priority_tier == 2;
}
static int target_is_session_context(const bof_triage_target_t *target) {
return target && target->priority_tier == 3;
}
static int wide_ends_with_ascii_ci(const wchar_t *text, const char *suffix) {
size_t text_len;
size_t suffix_len = 0;
size_t i;
if (!text || !suffix) return 0;
text_len = inline_wcslen(text);
while (suffix[suffix_len]) suffix_len++;
if (suffix_len > text_len) return 0;
for (i = 0; i < suffix_len; i++) {
if (wide_lower(text[text_len - suffix_len + i]) != (wchar_t)ascii_lower((unsigned char)suffix[i])) return 0;
}
return 1;
}
static int session_file_recognized(const char *tool, const wchar_t *path) {
if (ascii_equal_n_ci(tool, c_string_len(tool), "codex")) {
return wide_contains_ascii_n_ci(path, "sessions", 8) && wide_ends_with_ascii_ci(path, ".jsonl");
}
if (ascii_equal_n_ci(tool, c_string_len(tool), "claude_code")) {
return (wide_contains_ascii_n_ci(path, "sessions", 8) || wide_contains_ascii_n_ci(path, "projects", 8)) &&
wide_ends_with_ascii_ci(path, ".jsonl");
}
if (ascii_equal_n_ci(tool, c_string_len(tool), "cursor")) {
return wide_ends_with_ascii_ci(path, "store.db") ||
(wide_contains_ascii_n_ci(path, "agent-transcripts", 17) && wide_ends_with_ascii_ci(path, ".jsonl"));
}
if (ascii_equal_n_ci(tool, c_string_len(tool), "antigravity_cli")) {
return wide_ends_with_ascii_ci(path, "transcript_full.jsonl") ||
wide_ends_with_ascii_ci(path, "transcript.jsonl") || wide_ends_with_ascii_ci(path, "conversation_summaries.db") ||
(wide_contains_ascii_n_ci(path, "conversations", 13) && wide_ends_with_ascii_ci(path, ".db"));
}
if (ascii_equal_n_ci(tool, c_string_len(tool), "grok")) {
return wide_ends_with_ascii_ci(path, "updates.jsonl");
}
return 0;
}
static int wide_path_compare_ci(const wchar_t *left, const wchar_t *right) {
size_t i = 0;
while (left[i] && right[i]) {
int difference = (int)wide_lower(left[i]) - (int)wide_lower(right[i]);