From 1bf28bc07a4ed0bd27083f7b9a1c1ed815011cf1 Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Wed, 22 Jul 2026 11:48:33 -0300 Subject: [PATCH] ask whether strstr found the tag, not whether it is positive strstr returns a pointer into the string or NULL, and these four tests compare that pointer to 0 with >. Ordering a pointer against a null pointer constant is not something C++ defines; MSVC allows it, clang rejects it. The intent is plainly "did this attribute name contain the tag", and the result is the same either way, since the only pointer these can produce that is not greater than zero is the null one. != NULL says it directly, and reads like the strcmp(name, "...") == 0 tests it sits between. strstr rather than strcmp is deliberate here: the attributes it looks for are numbered, usAttachment1 through usAttachment4 and usResult1 upwards, so an exact comparison would not match them. That is unchanged. Verification: grep -rn 'strstr([^)]*)[ \t]*[><]' --include=*.cpp --include=*.h . # nothing ninja -C build parse # pointer-ordering class gone: 32 -> 28 sites ninja -C build -k 0 # Release, four applications, green ninja -C build-debug -k 0 # Debug, four applications, green Co-Authored-By: Claude Opus 4.8 --- Tactical/XML_ComboMergeInfo.cpp | 4 ++-- Tactical/XML_ItemAdjustments.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Tactical/XML_ComboMergeInfo.cpp b/Tactical/XML_ComboMergeInfo.cpp index 64b654821..2fb44f4db 100644 --- a/Tactical/XML_ComboMergeInfo.cpp +++ b/Tactical/XML_ComboMergeInfo.cpp @@ -46,7 +46,7 @@ attachmentcombomergeStartElementHandle(void *userData, const XML_Char *name, con else if(pData->curElement == ELEMENT && (strcmp(name, "uiIndex") == 0 || strcmp(name, "usItem") == 0 || - strstr(name, "usAttachment") > 0 || + strstr(name, "usAttachment") != NULL || strcmp(name, "usResult") == 0 )) { pData->curElement = ELEMENT_PROPERTY; @@ -104,7 +104,7 @@ attachmentcombomergeEndElementHandle(void *userData, const XML_Char *name) pData->curElement = ELEMENT; pData->curAttachmentComboMerge.usItem = (UINT16) atol(pData->szCharData); } - else if(strstr(name, "usAttachment") > 0) + else if(strstr(name, "usAttachment") != NULL) { pData->curElement = ELEMENT; pData->curAttachmentComboMerge.usAttachment[pData->curAttIndex] = (UINT16) atol(pData->szCharData); diff --git a/Tactical/XML_ItemAdjustments.cpp b/Tactical/XML_ItemAdjustments.cpp index f76d12289..e1f3e3064 100644 --- a/Tactical/XML_ItemAdjustments.cpp +++ b/Tactical/XML_ItemAdjustments.cpp @@ -60,7 +60,7 @@ transformStartElementHandle(void *userData, const XML_Char *name, const XML_Char } else if(pData->curElement == ELEMENT && (strcmp(name, "usItem") == 0 || - strstr(name, "usResult") > 0 || + strstr(name, "usResult") != NULL || strcmp(name, "usAPCost") == 0 || strcmp(name, "iBPCost") == 0 || strcmp(name, "szMenuRowText") == 0 || @@ -130,7 +130,7 @@ transformEndElementHandle(void *userData, const XML_Char *name) } pData->curTransform.usItem = usItem; } - else if(strstr(name, "usResult") > 0) + else if(strstr(name, "usResult") != NULL) { pData->curElement = ELEMENT; pData->curTransform.usResult[pData->curResultIndex] = (UINT16) atol(pData->szCharData);