[Scummvm-git-logs] scummvm master -> c85421c6fcff03bc327514c0274ec1e98be42318
sev-
noreply at scummvm.org
Tue Mar 11 08:37:42 UTC 2025
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
c85421c6fc DIRECTOR: Fix MSVC warnings (#6464)
Commit: c85421c6fcff03bc327514c0274ec1e98be42318
https://github.com/scummvm/scummvm/commit/c85421c6fcff03bc327514c0274ec1e98be42318
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2025-03-11T09:37:38+01:00
Commit Message:
DIRECTOR: Fix MSVC warnings (#6464)
* DIRECTOR: Fix warning about usage of ABS()
* DIRECTOR: Remove MSVC-specific argument size modifier prefix from imgui
The I (uppercase i) modifier is a Microsoft extension, and is not ISO
compatible. MSVC supports the z modifier, which is ISO compatible, so
use that everywhere inside the ImGui code.
The relevant MSVC documentation can be found here:
https://learn.microsoft.com/en-us/cpp/c-runtime-library/format-specification-syntax-printf-and-wprintf-functions?view=msvc-170
* DIRECTOR: Fix assigning negative value to string end position
Changed paths:
engines/director/debugger/imgui_memory_editor.h
engines/director/lingo/lingodec/ast.h
engines/director/score.cpp
diff --git a/engines/director/debugger/imgui_memory_editor.h b/engines/director/debugger/imgui_memory_editor.h
index da801c55413..0c37f1a9d23 100644
--- a/engines/director/debugger/imgui_memory_editor.h
+++ b/engines/director/debugger/imgui_memory_editor.h
@@ -54,10 +54,8 @@
#include <stdint.h> // uint8_t, etc.
#ifdef _MSC_VER
-#define _PRISizeT "I"
#define ImSnprintf _snprintf
#else
-#define _PRISizeT "z"
#define ImSnprintf snprintf
#endif
@@ -265,8 +263,8 @@ struct MemoryEditor
const ImU32 color_text = ImGui::GetColorU32(ImGuiCol_Text);
const ImU32 color_disabled = OptGreyOutZeroes ? ImGui::GetColorU32(ImGuiCol_TextDisabled) : color_text;
- const char* format_address = OptUpperCaseHex ? "%0*" _PRISizeT "X: " : "%0*" _PRISizeT "x: ";
- const char* format_data = OptUpperCaseHex ? "%0*" _PRISizeT "X" : "%0*" _PRISizeT "x";
+ const char* format_address = OptUpperCaseHex ? "%0*zX: " : "%0*zx: ";
+ const char* format_data = OptUpperCaseHex ? "%0*zX" : "%0*zx";
const char* format_byte = OptUpperCaseHex ? "%02X" : "%02x";
const char* format_byte_space = OptUpperCaseHex ? "%02X " : "%02x ";
@@ -455,7 +453,7 @@ struct MemoryEditor
{
IM_UNUSED(mem_data);
ImGuiStyle& style = ImGui::GetStyle();
- const char* format_range = OptUpperCaseHex ? "Range %0*" _PRISizeT "X..%0*" _PRISizeT "X" : "Range %0*" _PRISizeT "x..%0*" _PRISizeT "x";
+ const char* format_range = OptUpperCaseHex ? "Range %0*zX..%0*zX" : "Range %0*zx..%0*zx";
// Options menu
if (ImGui::Button("Options"))
@@ -480,7 +478,7 @@ struct MemoryEditor
if (ImGui::InputText("##addr", AddrInputBuf, IM_ARRAYSIZE(AddrInputBuf), ImGuiInputTextFlags_CharsHexadecimal | ImGuiInputTextFlags_EnterReturnsTrue))
{
size_t goto_addr;
- if (sscanf(AddrInputBuf, "%" _PRISizeT "X", &goto_addr) == 1)
+ if (sscanf(AddrInputBuf, "%zX", &goto_addr) == 1)
{
GotoAddr = goto_addr - base_display_addr;
HighlightMin = HighlightMax = (size_t)-1;
@@ -733,7 +731,6 @@ struct MemoryEditor
}
};
-#undef _PRISizeT
#undef ImSnprintf
#ifdef _MSC_VER
diff --git a/engines/director/lingo/lingodec/ast.h b/engines/director/lingo/lingodec/ast.h
index 0aaa2584fe9..019b2dffcf6 100644
--- a/engines/director/lingo/lingodec/ast.h
+++ b/engines/director/lingo/lingodec/ast.h
@@ -149,7 +149,7 @@ struct BlockNode : Node {
uint32 endPos;
CaseLabelNode *currentCaseLabel = nullptr;
- explicit BlockNode(uint32 offset) : Node(kBlockNode, offset), endPos(-1) {}
+ explicit BlockNode(uint32 offset) : Node(kBlockNode, offset), endPos(Common::String::npos) {}
void addChild(Common::SharedPtr<Node> child);
void accept(NodeVisitor &visitor) const override;
};
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index c1ec96122a1..c7f562f403b 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -1343,7 +1343,7 @@ bool Score::checkShotSimilarity(const Graphics::Surface *oldSurface, const Graph
absolute_pixel_differences++;
for (int c = 0; c < 4; c++) {
- if (ABS((newColor & 0xFF) - (oldColor & 0xFF)) > kShotColorDiffThreshold) {
+ if (ABS<int32>((newColor & 0xFF) - (oldColor & 0xFF)) > kShotColorDiffThreshold) {
different_pixel_count++;
break;
}
More information about the Scummvm-git-logs
mailing list