refactor(board): write the stripped URL extension check instead of forcing its strings (grok-focus) #1245
@@ -180,6 +180,7 @@ namespace ipl {
|
||||
|
||||
BOOL is_url_end_code(wchar_t ch) const;
|
||||
BOOL is_url_protocol(const wchar_t* url) const;
|
||||
BOOL is_url_ext(const wchar_t* url) const;
|
||||
int get_url_end(const wchar_t* url) const;
|
||||
|
||||
BOOL is_buffer_over(const wchar_t* text, u32 textLen) const;
|
||||
|
||||
@@ -1243,14 +1243,30 @@ namespace ipl {
|
||||
return result;
|
||||
}
|
||||
|
||||
DECOMP_FORCE_ACTIVE(iplFocusObject_cpp, L".html");
|
||||
DECOMP_FORCE_ACTIVE(iplFocusObject_cpp, L".htm");
|
||||
DECOMP_FORCE_ACTIVE(iplFocusObject_cpp, L".shtml");
|
||||
DECOMP_FORCE_ACTIVE(iplFocusObject_cpp, L".shtm");
|
||||
DECOMP_FORCE_ACTIVE(iplFocusObject_cpp, L".cgi");
|
||||
DECOMP_FORCE_ACTIVE(iplFocusObject_cpp, L".php");
|
||||
DECOMP_FORCE_ACTIVE(iplFocusObject_cpp, L".asp");
|
||||
DECOMP_FORCE_ACTIVE(iplFocusObject_cpp, L".jsp");
|
||||
BOOL focus_object::is_url_ext(const wchar_t* url) const {
|
||||
BOOL result = FALSE;
|
||||
u32 len = wcslen(url);
|
||||
const wchar_t* exts[8];
|
||||
int i;
|
||||
|
||||
exts[0] = L".html";
|
||||
exts[1] = L".htm";
|
||||
exts[2] = L".shtml";
|
||||
exts[3] = L".shtm";
|
||||
exts[4] = L".cgi";
|
||||
exts[5] = L".php";
|
||||
exts[6] = L".asp";
|
||||
exts[7] = L".jsp";
|
||||
|
||||
for (i = 0; i < 8; i++) {
|
||||
u32 extLen = wcslen(exts[i]);
|
||||
if (len >= extLen && wcsncmp(url + (len - extLen), exts[i], extLen) == 0) {
|
||||
result = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
int focus_object::get_url_end(const wchar_t* url) const {
|
||||
int i;
|
||||
|
||||
18
tools/decomp-assist/grok-focus.attempts.md
Normal file
18
tools/decomp-assist/grok-focus.attempts.md
Normal file
@@ -0,0 +1,18 @@
|
||||
# grok-focus is_url_ext
|
||||
|
||||
Replaced the eight DECOMP_FORCE_ACTIVE wide strings with focus_object::is_url_ext.
|
||||
The function is not in the target object (linker must strip it). Strings stay in source order.
|
||||
|
||||
Attempt 1: local `const wchar_t* exts[] = { L".html", ... }` loop.
|
||||
- .rodata 176 -> 208 (MWCC emitted the pointer table). Restored.
|
||||
|
||||
Attempt 2: unrolled wcsncmp tail checks, one local pointer per extension.
|
||||
- .data/.rodata/.sdata/.sdata2 identical to the force-active object
|
||||
- 89/89 original functions byte-identical, odiff differing 0
|
||||
|
||||
Attempt 3: same compares in a loop, pointers assigned one by one (no aggregate initializer).
|
||||
- .data sha 672d08c07636 matches the force-active build (2164 bytes; orig object is 2168 with 4 trailing zero bytes, unchanged)
|
||||
- .rodata/.sdata/.sdata2 identical to the original object
|
||||
- pool IDENTICAL 80/80
|
||||
- odiff: 89/89 differing 0
|
||||
- no DECOMP_FORCE_ACTIVE left in iplFocusObject.cpp
|
||||
Reference in New Issue
Block a user