Skip to content

Make the code compile with clang-cl in VS22 #888

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 9 commits into
base: main
Choose a base branch
from
4 changes: 2 additions & 2 deletions Core/Libraries/Source/WWVegas/WW3D2/prim_anim.h
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ class LERPAnimationChannelClass : public PrimitiveAnimationChannelClass<T>
using PrimitiveAnimationChannelClass<T>::m_Data;
using PrimitiveAnimationChannelClass<T>::m_LastIndex;
public:
using PrimitiveAnimationChannelClass<T>::KeyClass;
using typename PrimitiveAnimationChannelClass<T>::KeyClass;

public:

Expand All @@ -187,7 +187,7 @@ int PrimitiveAnimationChannelClass<T>::Get_Key_Count (void) const
// Set_Key_Value
/////////////////////////////////////////////////////////
template<class T>
typename const PrimitiveAnimationChannelClass<T>::KeyClass &PrimitiveAnimationChannelClass<T>::Get_Key (int index) const
const PrimitiveAnimationChannelClass<T>::KeyClass &PrimitiveAnimationChannelClass<T>::Get_Key (int index) const
{
return m_Data[index];
}
Expand Down
10 changes: 5 additions & 5 deletions Core/Libraries/Source/WWVegas/WWDebug/wwprofile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,7 @@ void WWProfileManager::End_Collecting(const char* filename)
if (name[i]==',') name[i]='.';
if (name[i]==';') name[i]=':';
}
str.Format("ID: %d %s\r\n",ite.Peek_Value(),name);
str.Format("ID: %d %s\r\n",ite.Peek_Value(),name.Peek_Buffer());

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct way to get a C string from StringClass is to use static_cast<const char *>(name) to invoke the conversion operator.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to hear from one or more other contributors on this because I think consistency is a valid counter point.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

static_cast<const char *>(name) is definitely better and we should refactor to it but not without also refactoring all other similar instances in the neighborhood. A following pull request for factoring would be more apt

file->Write(str.Peek_Buffer(),str.Get_Length());
}

Expand Down Expand Up @@ -1039,7 +1039,7 @@ WWMemoryAndTimeLog::WWMemoryAndTimeLog(const char* name)
IntermediateAllocSizeStart=AllocSizeStart;
StringClass tmp(0,true);
for (unsigned i=0;i<TabCount;++i) tmp+="\t";
WWRELEASE_SAY(("%s%s {\n",tmp,name));
WWRELEASE_SAY(("%s%s {\n",tmp.Peek_Buffer(),name));
TabCount++;
}

Expand All @@ -1048,13 +1048,13 @@ WWMemoryAndTimeLog::~WWMemoryAndTimeLog()
if (TabCount>0) TabCount--;
StringClass tmp(0,true);
for (unsigned i=0;i<TabCount;++i) tmp+="\t";
WWRELEASE_SAY(("%s} ",tmp));
WWRELEASE_SAY(("%s} ",tmp.Peek_Buffer()));

unsigned current_time=WWProfile_Get_System_Time();
int current_alloc_count=FastAllocatorGeneral::Get_Allocator()->Get_Total_Allocation_Count();
int current_alloc_size=FastAllocatorGeneral::Get_Allocator()->Get_Total_Allocated_Size();
WWRELEASE_SAY(("IN TOTAL %s took %d.%3.3d s, did %d memory allocations of %d bytes\n",
Name,
Name.Peek_Buffer(),
(current_time - TimeStart)/1000, (current_time - TimeStart)%1000,
current_alloc_count - AllocCountStart,
current_alloc_size - AllocSizeStart));
Expand All @@ -1071,7 +1071,7 @@ void WWMemoryAndTimeLog::Log_Intermediate(const char* text)
StringClass tmp(0,true);
for (unsigned i=0;i<TabCount;++i) tmp+="\t";
WWRELEASE_SAY(("%s%s took %d.%3.3d s, did %d memory allocations of %d bytes\n",
tmp,
tmp.Peek_Buffer(),
text,
(current_time - IntermediateTimeStart)/1000, (current_time - IntermediateTimeStart)%1000,
current_alloc_count - IntermediateAllocCountStart,
Expand Down
12 changes: 2 additions & 10 deletions Core/Libraries/Source/WWVegas/WWLib/cpudetect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -904,7 +904,7 @@
#ifdef WIN32
OSVERSIONINFO os;
os.dwOSVersionInfoSize = sizeof(os);
GetVersionEx(&os);

Check warning on line 907 in Core/Libraries/Source/WWVegas/WWLib/cpudetect.cpp

View workflow job for this annotation

GitHub Actions / Build GeneralsMD / Preset win32+t+e

'GetVersionExA': was declared deprecated

Check warning on line 907 in Core/Libraries/Source/WWVegas/WWLib/cpudetect.cpp

View workflow job for this annotation

GitHub Actions / Build GeneralsMD / Preset win32-profile+t+e

'GetVersionExA': was declared deprecated

Check warning on line 907 in Core/Libraries/Source/WWVegas/WWLib/cpudetect.cpp

View workflow job for this annotation

GitHub Actions / Build GeneralsMD / Preset win32-internal+t+e

'GetVersionExA': was declared deprecated

Check warning on line 907 in Core/Libraries/Source/WWVegas/WWLib/cpudetect.cpp

View workflow job for this annotation

GitHub Actions / Build GeneralsMD / Preset win32-debug+t+e

'GetVersionExA': was declared deprecated

Check warning on line 907 in Core/Libraries/Source/WWVegas/WWLib/cpudetect.cpp

View workflow job for this annotation

GitHub Actions / Build Generals / Preset win32-vcpkg-debug+t+e

'GetVersionExA': was declared deprecated

Check warning on line 907 in Core/Libraries/Source/WWVegas/WWLib/cpudetect.cpp

View workflow job for this annotation

GitHub Actions / Build Generals / Preset win32-vcpkg-internal+t+e

'GetVersionExA': was declared deprecated

Check warning on line 907 in Core/Libraries/Source/WWVegas/WWLib/cpudetect.cpp

View workflow job for this annotation

GitHub Actions / Build Generals / Preset win32-vcpkg+t+e

'GetVersionExA': was declared deprecated

Check warning on line 907 in Core/Libraries/Source/WWVegas/WWLib/cpudetect.cpp

View workflow job for this annotation

GitHub Actions / Build Generals / Preset win32-vcpkg-profile+t+e

'GetVersionExA': was declared deprecated

OSVersionNumberMajor = os.dwMajorVersion;
OSVersionNumberMinor = os.dwMinorVersion;
Expand Down Expand Up @@ -956,11 +956,7 @@
(OSVersionBuildNumber&0xff000000)>>24,
(OSVersionBuildNumber&0xff0000)>>16,
(OSVersionBuildNumber&0xffff)));
#ifdef WIN32
SYSLOG(("OS-Info: %s\r\n", OSVersionExtraInfo));
#elif defined(_UNIX)
SYSLOG(("OS-Info: %s\r\n", OSVersionExtraInfo.Peek_Buffer()));
#endif
SYSLOG(("OS-Info: %s\r\n", OSVersionExtraInfo.Peek_Buffer()));

SYSLOG(("Processor: %s\r\n",CPUDetectClass::Get_Processor_String()));
SYSLOG(("Clock speed: ~%dMHz\r\n",CPUDetectClass::Get_Processor_Speed()));
Expand All @@ -971,11 +967,7 @@
case 2: cpu_type="Dual"; break;
case 3: cpu_type="*Intel Reserved*"; break;
}
#ifdef WIN32
SYSLOG(("Processor type: %s\r\n", cpu_type));
#elif defined(_UNIX)
SYSLOG(("Processor type: %s\r\n", cpu_type.Peek_Buffer()));
#endif
SYSLOG(("Processor type: %s\r\n", cpu_type.Peek_Buffer()));

SYSLOG(("\r\n"));

Expand Down
2 changes: 1 addition & 1 deletion Core/Libraries/Source/WWVegas/WWLib/ffactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ FileClass * SimpleFileFactoryClass::Get_File( char const *filename )
}
}
} else {
new_name.Format("%s%s",SubDirectory,stripped_name);
new_name.Format("%s%s",SubDirectory.Peek_Buffer(),stripped_name.Peek_Buffer());
}
}

Expand Down
2 changes: 1 addition & 1 deletion Core/Libraries/Source/WWVegas/WWMath/wwmath.h
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,7 @@ WWINLINE int WWMath::Float_To_Int_Floor (const float& f)
// Inverse square root
// ----------------------------------------------------------------------------

#if defined(_MSC_VER) && defined(_M_IX86)
#if defined(_MSC_VER) && defined(_M_IX86) && !defined(__clang__)
WWINLINE __declspec(naked) float __fastcall WWMath::Inv_Sqrt(float a)
{
__asm {
Expand Down
2 changes: 1 addition & 1 deletion Dependencies/Utility/Utility/CppMacros.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#define IUNKNOWN_NOEXCEPT
#endif

#if __cplusplus >= 201103L
#if __cplusplus >= 201103L && !defined(__clang__)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't sit right with me, cland-cl should be able to handle these constructs in C++11 or greater.

Copy link
Author

@Caball009 Caball009 May 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I couldn't really figure out what was going on, frankly, I think clang-cl doesn't like forward declared enums with fixed underlying type, but that doesn't really make sense to me.

#define CPP_11(code) code
#else
#define CPP_11(code)
Expand Down
2 changes: 1 addition & 1 deletion Generals/Code/GameEngine/Include/Common/BorderColors.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
struct BorderColor
{
const char *m_colorName;
long m_borderColor;
unsigned long m_borderColor;
};

const BorderColor BORDER_COLORS[] =
Expand Down
4 changes: 3 additions & 1 deletion Generals/Code/GameEngine/Source/Common/BitFlags.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#include "Common/ModelState.h"
#include "GameLogic/ArmorSet.h"

template<>
const char* ModelConditionFlags::s_bitNameList[] =
{
"TOPPLED",
Expand Down Expand Up @@ -147,7 +148,8 @@ const char* ModelConditionFlags::s_bitNameList[] =

NULL
};


template<>
const char* ArmorSetFlags::s_bitNameList[] =
{
"VETERAN",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ SpecialPowerStore *TheSpecialPowerStore = NULL;
///////////////////////////////////////////////////////////////////////////////////////////////////

// Externs ////////////////////////////////////////////////////////////////////////////////////////
template<>
const char* SpecialPowerMaskType::s_bitNameList[] =
{
"SPECIAL_INVALID",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include "Common/DisabledTypes.h"
#include "Common/BitFlagsIO.h"

template<>
const char* DisabledMaskType::s_bitNameList[] =
{
"DEFAULT",
Expand Down
10 changes: 5 additions & 5 deletions Generals/Code/GameEngine/Source/Common/System/GameMemory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1578,7 +1578,7 @@ MemoryPoolBlob* MemoryPool::createBlob(Int allocationCount)
{
DEBUG_ASSERTCRASH(allocationCount > 0 && allocationCount%MEM_BOUND_ALIGNMENT==0, ("bad allocationCount (must be >0 and evenly divisible by %d)",MEM_BOUND_ALIGNMENT));

MemoryPoolBlob* blob = new (::sysAllocate(sizeof MemoryPoolBlob)) MemoryPoolBlob; // will throw on failure
MemoryPoolBlob* blob = new (::sysAllocate(sizeof(MemoryPoolBlob))) MemoryPoolBlob; // will throw on failure

blob->initBlob(this, allocationCount); // will throw on failure

Expand Down Expand Up @@ -2674,7 +2674,7 @@ MemoryPool *MemoryPoolFactory::createMemoryPool(const char *poolName, Int alloca
throw ERROR_OUT_OF_MEMORY;
}

pool = new (::sysAllocate(sizeof MemoryPool)) MemoryPool; // will throw on failure
pool = new (::sysAllocate(sizeof(MemoryPool))) MemoryPool; // will throw on failure
pool->init(this, poolName, allocationSize, initialAllocationCount, overflowAllocationCount); // will throw on failure

pool->addToList(&m_firstPoolInFactory);
Expand Down Expand Up @@ -2730,7 +2730,7 @@ DynamicMemoryAllocator *MemoryPoolFactory::createDynamicMemoryAllocator(Int numS
{
DynamicMemoryAllocator *dma;

dma = new (::sysAllocate(sizeof DynamicMemoryAllocator)) DynamicMemoryAllocator; // will throw on failure
dma = new (::sysAllocate(sizeof(DynamicMemoryAllocator))) DynamicMemoryAllocator; // will throw on failure
dma->init(this, numSubPools, pParms); // will throw on failure

dma->addToList(&m_firstDmaInFactory);
Expand Down Expand Up @@ -3425,7 +3425,7 @@ void initMemoryManager()
Int numSubPools;
const PoolInitRec *pParms;
userMemoryManagerGetDmaParms(&numSubPools, &pParms);
TheMemoryPoolFactory = new (::sysAllocate(sizeof MemoryPoolFactory)) MemoryPoolFactory; // will throw on failure
TheMemoryPoolFactory = new (::sysAllocate(sizeof(MemoryPoolFactory))) MemoryPoolFactory; // will throw on failure
TheMemoryPoolFactory->init(); // will throw on failure
TheDynamicMemoryAllocator = TheMemoryPoolFactory->createDynamicMemoryAllocator(numSubPools, pParms); // will throw on failure
userMemoryManagerInitPools();
Expand Down Expand Up @@ -3500,7 +3500,7 @@ static void preMainInitMemoryManager()
Int numSubPools;
const PoolInitRec *pParms;
userMemoryManagerGetDmaParms(&numSubPools, &pParms);
TheMemoryPoolFactory = new (::sysAllocate(sizeof MemoryPoolFactory)) MemoryPoolFactory; // will throw on failure
TheMemoryPoolFactory = new (::sysAllocate(sizeof(MemoryPoolFactory))) MemoryPoolFactory; // will throw on failure
TheMemoryPoolFactory->init(); // will throw on failure

TheDynamicMemoryAllocator = TheMemoryPoolFactory->createDynamicMemoryAllocator(numSubPools, pParms); // will throw on failure
Expand Down
1 change: 1 addition & 0 deletions Generals/Code/GameEngine/Source/Common/System/KindOf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include "Common/KindOf.h"
#include "Common/BitFlagsIO.h"

template<>
const char* KindOfMaskType::s_bitNameList[] =
{
"OBSTACLE",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include "Common/ObjectStatusTypes.h"
#include "Common/BitFlagsIO.h"

template<>
const char* ObjectStatusMaskType::s_bitNameList[] =
{
"NONE",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ void SendStatsToOtherPlayers(const GameInfo *game)
subStats.locale = fullStats.locale;
subStats.gamesAsRandom = fullStats.gamesAsRandom;
GetAdditionalDisconnectsFromUserFile(&subStats);
fullStr.format("%d %s", TheGameSpyInfo->getLocalProfileID(), TheGameSpyPSMessageQueue->formatPlayerKVPairs( subStats ));
fullStr.format("%d %s", TheGameSpyInfo->getLocalProfileID(), TheGameSpyPSMessageQueue->formatPlayerKVPairs( subStats ).c_str());
req.options = fullStr.str();

Int localIndex = game->getLocalSlotNum();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
// PUBLIC DATA ////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////

template<>
const char* WeaponSetFlags::s_bitNameList[] =
{
"VETERAN",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,19 +172,19 @@ void W3DMainMenuDraw( GameWindow *window, WinInstanceData *instData )
IRegion2D topHorizontal1 ={pos.x, pos.y, pos.x + size.x, pos.y };
IRegion2D topHorizontal1drop ={pos.x, pos.y+1, pos.x + size.x, pos.y+1 };

IRegion2D topHorizontal2 ={pos.x, pos.y + (size.y * .1) , pos.x + size.x, pos.y + (size.y * .1) };
IRegion2D topHorizontal2drop ={pos.x, pos.y + (size.y * .12) , pos.x + size.x, pos.y + (size.y * .12) };
IRegion2D topHorizontal2 ={pos.x, pos.y + static_cast<Int>(size.y * .1) , pos.x + size.x, pos.y + static_cast<Int>(size.y * .1) };
IRegion2D topHorizontal2drop ={pos.x, pos.y + static_cast<Int>(size.y * .12) , pos.x + size.x, pos.y + static_cast<Int>(size.y * .12) };

IRegion2D bottomHorizontal1={pos.x, pos.y + (size.y * .9), pos.x + size.x, pos.y + (size.y * .9) };
IRegion2D bottomHorizontal1drop={pos.x, pos.y + (size.y * .92), pos.x + size.x, pos.y + (size.y * .92) };
IRegion2D bottomHorizontal1={pos.x, pos.y + static_cast<Int>(size.y * .9), pos.x + size.x, pos.y + static_cast<Int>(size.y * .9) };
IRegion2D bottomHorizontal1drop={pos.x, pos.y + static_cast<Int>(size.y * .92), pos.x + size.x, pos.y + static_cast<Int>(size.y * .92) };

IRegion2D bottomHorizontal2= {pos.x, pos.y + size.y, pos.x + size.x, pos.y + size.y };
IRegion2D bottomHorizontal2drop= {pos.x, pos.y + size.y + 1, pos.x + size.x, pos.y + size.y + 1 };

IRegion2D verticle1 ={pos.x + (size.x * .225), pos.y , pos.x + (size.x * .225), height };
IRegion2D verticle2 ={pos.x + (size.x * .445), pos.y, pos.x + (size.x * .445), height };
IRegion2D verticle3 ={pos.x + (size.x * .6662), pos.y, pos.x + (size.x * .6662), height };
IRegion2D verticle4 ={pos.x + (size.x * .885), pos.y , pos.x + (size.x * .885), height };
IRegion2D verticle1 ={pos.x + static_cast<Int>(size.x * .225), pos.y , pos.x + static_cast<Int>(size.x * .225), height };
IRegion2D verticle2 ={pos.x + static_cast<Int>(size.x * .445), pos.y, pos.x + static_cast<Int>(size.x * .445), height };
IRegion2D verticle3 ={pos.x + static_cast<Int>(size.x * .6662), pos.y, pos.x + static_cast<Int>(size.x * .6662), height };
IRegion2D verticle4 ={pos.x + static_cast<Int>(size.x * .885), pos.y , pos.x + static_cast<Int>(size.x * .885), height };
// static IRegion2D verticle5 ={pos.x + (size.x * .7250), pos.y + (size.y * .12), pos.x + (size.x * .7250), pos.y + (size.y * .86) };
// static IRegion2D verticle6 ={pos.x + (size.x * .9062), pos.y + (size.y * .12), pos.x + (size.x * .9062), pos.y + (size.y * .86) };

Expand Down Expand Up @@ -236,19 +236,19 @@ void W3DMainMenuFourDraw( GameWindow *window, WinInstanceData *instData )
IRegion2D topHorizontal1 ={pos.x, pos.y, pos.x + size.x, pos.y };
IRegion2D topHorizontal1drop ={pos.x, pos.y+1, pos.x + size.x, pos.y+1 };

IRegion2D topHorizontal2 ={pos.x, pos.y + (size.y * .1) , pos.x + size.x, pos.y + (size.y * .1) };
IRegion2D topHorizontal2drop ={pos.x, pos.y + (size.y * .12) , pos.x + size.x, pos.y + (size.y * .12) };
IRegion2D topHorizontal2 ={pos.x, pos.y + static_cast<Int>(size.y * .1) , pos.x + size.x, pos.y + static_cast<Int>(size.y * .1) };
IRegion2D topHorizontal2drop ={pos.x, pos.y + static_cast<Int>(size.y * .12) , pos.x + size.x, pos.y + static_cast<Int>(size.y * .12) };

IRegion2D bottomHorizontal1={pos.x, pos.y + (size.y * .9), pos.x + size.x, pos.y + (size.y * .9) };
IRegion2D bottomHorizontal1drop={pos.x, pos.y + (size.y * .92), pos.x + size.x, pos.y + (size.y * .92) };
IRegion2D bottomHorizontal1={pos.x, pos.y + static_cast<Int>(size.y * .9), pos.x + size.x, pos.y + static_cast<Int>(size.y * .9) };
IRegion2D bottomHorizontal1drop={pos.x, pos.y + static_cast<Int>(size.y * .92), pos.x + size.x, pos.y + static_cast<Int>(size.y * .92) };

IRegion2D bottomHorizontal2= {pos.x, pos.y + size.y, pos.x + size.x, pos.y + size.y };
IRegion2D bottomHorizontal2drop= {pos.x, pos.y + size.y + 1, pos.x + size.x, pos.y + size.y + 1 };

IRegion2D verticle1 ={pos.x + (size.x * .295), pos.y , pos.x + (size.x * .295), height };
IRegion2D verticle2 ={pos.x + (size.x * .59), pos.y, pos.x + (size.x * .59), height };
IRegion2D verticle1 ={pos.x + static_cast<Int>(size.x * .295), pos.y , pos.x + static_cast<Int>(size.x * .295), height };
IRegion2D verticle2 ={pos.x + static_cast<Int>(size.x * .59), pos.y, pos.x + static_cast<Int>(size.x * .59), height };
//IRegion2D verticle3 ={pos.x + (size.x * .6662), pos.y, pos.x + (size.x * .6662), height };
IRegion2D verticle4 ={pos.x + (size.x * .885), pos.y , pos.x + (size.x * .885), height };
IRegion2D verticle4 ={pos.x + static_cast<Int>(size.x * .885), pos.y , pos.x + static_cast<Int>(size.x * .885), height };
// static IRegion2D verticle5 ={pos.x + (size.x * .7250), pos.y + (size.y * .12), pos.x + (size.x * .7250), pos.y + (size.y * .86) };
// static IRegion2D verticle6 ={pos.x + (size.x * .9062), pos.y + (size.y * .12), pos.x + (size.x * .9062), pos.y + (size.y * .86) };

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ Int W3DStatusCircle::initData(void)
//go with a preset material for now.
m_vertexMaterialClass=VertexMaterialClass::Get_Preset(VertexMaterialClass::PRELIT_DIFFUSE);

m_shaderClass = ShaderClass::ShaderClass(SC_ALPHA);// _PresetOpaque2DShader;//; //_PresetOpaqueShader;
m_shaderClass = ShaderClass(SC_ALPHA);// _PresetOpaque2DShader;//; //_PresetOpaqueShader;


return 0;
Expand Down
36 changes: 18 additions & 18 deletions Generals/Code/Libraries/Source/WWVegas/WW3D2/ddsfile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,11 @@
if (MipLevels==0) MipLevels=1;

//Adjust the reduction factor to keep textures above some minimum dimensions
if (MipLevels <= WW3D::Get_Texture_Min_Dimension())

Check warning on line 102 in Generals/Code/Libraries/Source/WWVegas/WW3D2/ddsfile.cpp

View workflow job for this annotation

GitHub Actions / Build Generals / Preset win32-vcpkg-debug+t+e

'<=': signed/unsigned mismatch

Check warning on line 102 in Generals/Code/Libraries/Source/WWVegas/WW3D2/ddsfile.cpp

View workflow job for this annotation

GitHub Actions / Build Generals / Preset win32-vcpkg-internal+t+e

'<=': signed/unsigned mismatch

Check warning on line 102 in Generals/Code/Libraries/Source/WWVegas/WW3D2/ddsfile.cpp

View workflow job for this annotation

GitHub Actions / Build Generals / Preset win32-vcpkg+t+e

'<=': signed/unsigned mismatch

Check warning on line 102 in Generals/Code/Libraries/Source/WWVegas/WW3D2/ddsfile.cpp

View workflow job for this annotation

GitHub Actions / Build Generals / Preset win32-vcpkg-profile+t+e

'<=': signed/unsigned mismatch
ReductionFactor=0;
else
{ int mipToDrop=MipLevels-WW3D::Get_Texture_Min_Dimension();
if (ReductionFactor >= mipToDrop)

Check warning on line 106 in Generals/Code/Libraries/Source/WWVegas/WW3D2/ddsfile.cpp

View workflow job for this annotation

GitHub Actions / Build Generals / Preset win32-vcpkg-debug+t+e

'>=': signed/unsigned mismatch

Check warning on line 106 in Generals/Code/Libraries/Source/WWVegas/WW3D2/ddsfile.cpp

View workflow job for this annotation

GitHub Actions / Build Generals / Preset win32-vcpkg-internal+t+e

'>=': signed/unsigned mismatch

Check warning on line 106 in Generals/Code/Libraries/Source/WWVegas/WW3D2/ddsfile.cpp

View workflow job for this annotation

GitHub Actions / Build Generals / Preset win32-vcpkg+t+e

'>=': signed/unsigned mismatch

Check warning on line 106 in Generals/Code/Libraries/Source/WWVegas/WW3D2/ddsfile.cpp

View workflow job for this annotation

GitHub Actions / Build Generals / Preset win32-vcpkg-profile+t+e

'>=': signed/unsigned mismatch
ReductionFactor=mipToDrop;
}

Expand Down Expand Up @@ -417,8 +417,8 @@
for (unsigned y=0;y<dest_height;y+=4) {
for (unsigned x=0;x<dest_width;x+=4) {
unsigned cols=*src_ptr++; // Bytes 1-4 of color block
unsigned col0=RGB565_To_ARGB8888(unsigned short(cols>>16));
unsigned col1=RGB565_To_ARGB8888(unsigned short(cols&0xffff));
unsigned col0=RGB565_To_ARGB8888((unsigned short)(cols>>16));
unsigned col1=RGB565_To_ARGB8888((unsigned short)(cols&0xffff));
Recolor(col0,hsv_shift);
Recolor(col1,hsv_shift);
col0=ARGB8888_To_RGB565(col0);
Expand All @@ -438,8 +438,8 @@
*dest_ptr++=*src_ptr++; // Bytes 1-4 of alpha block
*dest_ptr++=*src_ptr++; // Bytes 5-8 of alpha block
unsigned cols=*src_ptr++; // Bytes 1-4 of color block
unsigned col0=RGB565_To_ARGB8888(unsigned short(cols>>16));
unsigned col1=RGB565_To_ARGB8888(unsigned short(cols&0xffff));
unsigned col0=RGB565_To_ARGB8888((unsigned short)(cols>>16));
unsigned col1=RGB565_To_ARGB8888((unsigned short)(cols&0xffff));
Recolor(col0,hsv_shift);
Recolor(col1,hsv_shift);
col0=ARGB8888_To_RGB565(col0);
Expand Down Expand Up @@ -479,8 +479,8 @@
// *dest_ptr++=*src_ptr++; // Bytes 1-4 of color block

unsigned cols=*src_ptr++; // Bytes 1-4 of color block
unsigned col0=RGB565_To_ARGB8888(unsigned short(cols>>16));
unsigned col1=RGB565_To_ARGB8888(unsigned short(cols&0xffff));
unsigned col0=RGB565_To_ARGB8888((unsigned short)(cols>>16));
unsigned col1=RGB565_To_ARGB8888((unsigned short)(cols&0xffff));
Recolor(col0,hsv_shift);
Recolor(col1,hsv_shift);
col0=ARGB8888_To_RGB565(col0);
Expand Down Expand Up @@ -577,8 +577,8 @@
for (unsigned x=0;x<dest_width;x+=4)
{
unsigned cols=*src_ptr++; // Bytes 1-4 of color block
unsigned col0=RGB565_To_ARGB8888(unsigned short(cols>>16));
unsigned col1=RGB565_To_ARGB8888(unsigned short(cols&0xffff));
unsigned col0=RGB565_To_ARGB8888((unsigned short)(cols>>16));
unsigned col1=RGB565_To_ARGB8888((unsigned short)(cols&0xffff));
Recolor(col0,hsv_shift);
Recolor(col1,hsv_shift);
col0=ARGB8888_To_RGB565(col0);
Expand All @@ -601,8 +601,8 @@
*dest_ptr++=*src_ptr++; // Bytes 1-4 of alpha block
*dest_ptr++=*src_ptr++; // Bytes 5-8 of alpha block
unsigned cols=*src_ptr++; // Bytes 1-4 of color block
unsigned col0=RGB565_To_ARGB8888(unsigned short(cols>>16));
unsigned col1=RGB565_To_ARGB8888(unsigned short(cols&0xffff));
unsigned col0=RGB565_To_ARGB8888((unsigned short)(cols>>16));
unsigned col1=RGB565_To_ARGB8888((unsigned short)(cols&0xffff));
Recolor(col0,hsv_shift);
Recolor(col1,hsv_shift);
col0=ARGB8888_To_RGB565(col0);
Expand Down Expand Up @@ -650,8 +650,8 @@
// *dest_ptr++=*src_ptr++; // Bytes 1-4 of color block

unsigned cols=*src_ptr++; // Bytes 1-4 of color block
unsigned col0=RGB565_To_ARGB8888(unsigned short(cols>>16));
unsigned col1=RGB565_To_ARGB8888(unsigned short(cols&0xffff));
unsigned col0=RGB565_To_ARGB8888((unsigned short)(cols>>16));
unsigned col1=RGB565_To_ARGB8888((unsigned short)(cols&0xffff));
Recolor(col0,hsv_shift);
Recolor(col1,hsv_shift);
col0=ARGB8888_To_RGB565(col0);
Expand Down Expand Up @@ -750,8 +750,8 @@
for (unsigned x=0;x<dest_width;x+=4)
{
unsigned cols=*src_ptr++; // Bytes 1-4 of color block
unsigned col0=RGB565_To_ARGB8888(unsigned short(cols>>16));
unsigned col1=RGB565_To_ARGB8888(unsigned short(cols&0xffff));
unsigned col0=RGB565_To_ARGB8888((unsigned short)(cols>>16));
unsigned col1=RGB565_To_ARGB8888((unsigned short)(cols&0xffff));
Recolor(col0,hsv_shift);
Recolor(col1,hsv_shift);
col0=ARGB8888_To_RGB565(col0);
Expand All @@ -774,8 +774,8 @@
*dest_ptr++=*src_ptr++; // Bytes 1-4 of alpha block
*dest_ptr++=*src_ptr++; // Bytes 5-8 of alpha block
unsigned cols=*src_ptr++; // Bytes 1-4 of color block
unsigned col0=RGB565_To_ARGB8888(unsigned short(cols>>16));
unsigned col1=RGB565_To_ARGB8888(unsigned short(cols&0xffff));
unsigned col0=RGB565_To_ARGB8888((unsigned short)(cols>>16));
unsigned col1=RGB565_To_ARGB8888((unsigned short)(cols&0xffff));
Recolor(col0,hsv_shift);
Recolor(col1,hsv_shift);
col0=ARGB8888_To_RGB565(col0);
Expand Down Expand Up @@ -823,8 +823,8 @@
// *dest_ptr++=*src_ptr++; // Bytes 1-4 of color block

unsigned cols=*src_ptr++; // Bytes 1-4 of color block
unsigned col0=RGB565_To_ARGB8888(unsigned short(cols>>16));
unsigned col1=RGB565_To_ARGB8888(unsigned short(cols&0xffff));
unsigned col0=RGB565_To_ARGB8888((unsigned short)(cols>>16));
unsigned col1=RGB565_To_ARGB8888((unsigned short)(cols&0xffff));
Recolor(col0,hsv_shift);
Recolor(col1,hsv_shift);
col0=ARGB8888_To_RGB565(col0);
Expand Down
Loading
Loading