forked from mirrors/0ad
Explicitly const_cast string literal for C API
The implicit conversion form sting literal to char* for C compatibility was removed with C++11, seems MSVC caught up with this in C++20. Use explicit cast instead where needed and change API to const char* otherwise. Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
This commit is contained in:
@@ -236,7 +236,7 @@ class TestWdbgSym : public CxxTest::TestSuite
|
||||
// also exercises all basic types because we need to display some values
|
||||
// anyway (to see at a glance whether symbol engine addrs are correct)
|
||||
static void m_test_addrs([[maybe_unused]] int p_int, [[maybe_unused]] double p_double,
|
||||
[[maybe_unused]] char* p_pchar, [[maybe_unused]] uintptr_t p_uintptr)
|
||||
[[maybe_unused]] const char* p_pchar, [[maybe_unused]] uintptr_t p_uintptr)
|
||||
{
|
||||
[[maybe_unused]] size_t l_uint = 0x1234;
|
||||
[[maybe_unused]] bool l_bool = true;
|
||||
@@ -247,7 +247,7 @@ class TestWdbgSym : public CxxTest::TestSuite
|
||||
|
||||
static double s_double = -2.718;
|
||||
static char s_chars[] = {'c','h','a','r','s',0};
|
||||
static void (*s_funcptr)(int, double, char*, uintptr_t) = m_test_addrs;
|
||||
static void (*s_funcptr)(int, double, const char*, uintptr_t) = m_test_addrs;
|
||||
static void* s_ptr = (void*)(uintptr_t)0x87654321;
|
||||
static HDC s_hdc = (HDC)0xff0;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2010 Wildfire Games.
|
||||
/* Copyright (C) 2025 Wildfire Games.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
@@ -52,11 +52,11 @@ char* dlerror()
|
||||
switch(GetLastError())
|
||||
{
|
||||
case ERROR_MOD_NOT_FOUND:
|
||||
return "module not found";
|
||||
return const_cast<char*>("module not found");
|
||||
case ERROR_PROC_NOT_FOUND:
|
||||
return "symbol not found";
|
||||
return const_cast<char*>("symbol not found");
|
||||
default:
|
||||
return "unknown";
|
||||
return const_cast<char*>("unknown");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user