fix: resolve a lot of conversion warnings

This commit is contained in:
Tropical 2026-03-03 19:33:12 -06:00
parent 7ae4b9f0a7
commit d79b1ba555
16 changed files with 60 additions and 49 deletions

View file

@ -4,7 +4,7 @@
unordered_map<wstring,eMinecraftColour> ColourTable::s_colourNamesMap;
wchar_t *ColourTable::ColourTableElements[eMinecraftColour_COUNT] =
const wchar_t *ColourTable::ColourTableElements[eMinecraftColour_COUNT] =
{
L"NOTSET",

View file

@ -5,7 +5,7 @@ class ColourTable
private:
unsigned int m_colourValues[eMinecraftColour_COUNT];
static wchar_t *ColourTableElements[eMinecraftColour_COUNT];
static const wchar_t *ColourTableElements[eMinecraftColour_COUNT];
static unordered_map<wstring,eMinecraftColour> s_colourNamesMap;
public:

View file

@ -7,7 +7,7 @@
#include "../../Minecraft.h"
#include "../../TexturePackRepository.h"
WCHAR *DLCManager::wchTypeNamesA[]=
const WCHAR *DLCManager::wchTypeNamesA[]=
{
L"DISPLAYNAME",
L"THEMENAME",

View file

@ -48,7 +48,7 @@ public:
e_DLCParamType_Max,
};
static WCHAR *wchTypeNamesA[e_DLCParamType_Max];
const static WCHAR *wchTypeNamesA[e_DLCParamType_Max];
private:
vector<DLCPack *> m_packs;

View file

@ -12,7 +12,7 @@
#include "ConsoleGameRules.h"
#include "GameRuleManager.h"
WCHAR *GameRuleManager::wchTagNameA[] =
const WCHAR *GameRuleManager::wchTagNameA[] =
{
L"", // eGameRuleType_Root
L"MapOptions", // eGameRuleType_LevelGenerationOptions

View file

@ -24,8 +24,8 @@ class WstringLookup;
class GameRuleManager
{
public:
static WCHAR *wchTagNameA[ConsoleGameRules::eGameRuleType_Count];
static WCHAR *wchAttrNameA[ConsoleGameRules::eGameRuleAttr_Count];
static const WCHAR *wchTagNameA[ConsoleGameRules::eGameRuleType_Count];
static const WCHAR *wchAttrNameA[ConsoleGameRules::eGameRuleAttr_Count];
static const short version_number = 2;

View file

@ -67,10 +67,10 @@ void XShowAchievementsUI(int i) {}
DWORD XBackgroundDownloadSetMode(XBACKGROUND_DOWNLOAD_MODE Mode) { return 0; }
#ifndef _DURANGO
void PIXAddNamedCounter(int a, char *b, ...) {}
void PIXAddNamedCounter(int a, const char *b, ...) {}
//#define PS3_USE_PIX_EVENTS
//#define PS4_USE_PIX_EVENTS
void PIXBeginNamedEvent(int a, char *b, ...)
void PIXBeginNamedEvent(int a, const char *b, ...)
{
#ifdef PS4_USE_PIX_EVENTS
char buf[512];

View file

@ -3,6 +3,8 @@
#pragma once
#include <cassert>
#define TRUE true
#define FALSE false
#define RtlZeroMemory(Destination,Length) memset((Destination),0,(Length))
@ -731,5 +733,13 @@ static inline HANDLE CreateEvent(int manual_reset, int initial_state) {
static inline HMODULE GetModuleHandle(LPCSTR lpModuleName) { return 0; }
static inline LPVOID VirtualAlloc(LPVOID lpAddress, SIZE_T dwSize, DWORD flAllocationType, DWORD flProtect) {
assert(0 && "FIXME: implement VirtualAlloc");
}
static inline BOOL VirtualFree(LPVOID lpAddress, SIZE_T dwSize, DWORD dwFreeType) {
assert(0 && "FIXME: implement VirtualFree");
}
#endif // WINAPISTUBS_H

View file

@ -21,7 +21,7 @@ bool Textures::MIPMAP = true;
C4JRender::eTextureFormat Textures::TEXTURE_FORMAT = C4JRender::TEXTURE_FORMAT_RxGyBzAw;
int Textures::preLoadedIdx[TN_COUNT];
wchar_t *Textures::preLoaded[TN_COUNT] =
const wchar_t *Textures::preLoaded[TN_COUNT] =
{
L"%blur%misc/pumpkinblur",
// L"%blur%/misc/vignette", // Not currently used

View file

@ -205,7 +205,7 @@ public:
static C4JRender::eTextureFormat TEXTURE_FORMAT;
private:
static wchar_t *preLoaded[TN_COUNT];
static const wchar_t *preLoaded[TN_COUNT];
static int preLoadedIdx[TN_COUNT];
unordered_map<wstring, int> idMap;

View file

@ -60,145 +60,145 @@ public:
return TAG_Compound;
}
void put(wchar_t *name, Tag *tag)
void put(const wchar_t *name, Tag *tag)
{
tags[name] = tag->setName(wstring( name ));
}
void putByte(wchar_t * name, byte value)
void putByte(const wchar_t * name, byte value)
{
tags[name] = (new ByteTag(name,value));
}
void putShort(wchar_t * name, short value)
void putShort(const wchar_t * name, short value)
{
tags[name] = (new ShortTag(name,value));
}
void putInt(wchar_t * name, int value)
void putInt(const wchar_t * name, int value)
{
tags[name] = (new IntTag(name,value));
}
void putLong(wchar_t * name, __int64 value)
void putLong(const wchar_t * name, __int64 value)
{
tags[name] = (new LongTag(name,value));
}
void putFloat(wchar_t * name, float value)
void putFloat(const wchar_t * name, float value)
{
tags[name] = (new FloatTag(name,value));
}
void putDouble(wchar_t * name, double value)
void putDouble(const wchar_t * name, double value)
{
tags[name] = (new DoubleTag(name,value));
}
void putString(wchar_t *name, const wstring& value)
void putString(const wchar_t *name, const wstring& value)
{
tags[name] = (new StringTag(name,value));
}
void putByteArray(wchar_t * name, byteArray value)
void putByteArray(const wchar_t * name, byteArray value)
{
tags[name] = (new ByteArrayTag(name,value));
}
void putIntArray(wchar_t * name, intArray value)
void putIntArray(const wchar_t * name, intArray value)
{
tags[name] = (new IntArrayTag(name, value));
}
void putCompound(wchar_t * name, CompoundTag *value)
void putCompound(const wchar_t * name, CompoundTag *value)
{
tags[name] = value->setName( wstring( name ) );
}
void putBoolean(wchar_t * string, bool val)
void putBoolean(const wchar_t * string, bool val)
{
putByte(string, val?static_cast<byte>(1):static_cast<byte>(0));
}
Tag *get(wchar_t *name)
Tag *get(const wchar_t *name)
{
AUTO_VAR(it, tags.find(name));
if(it != tags.end()) return it->second;
return NULL;
}
bool contains(wchar_t * name)
bool contains(const wchar_t * name)
{
return tags.find(name) != tags.end();
}
byte getByte(wchar_t * name)
byte getByte(const wchar_t * name)
{
if (tags.find(name) == tags.end()) return (byte)0;
return ((ByteTag *) tags[name])->data;
}
short getShort(wchar_t * name)
short getShort(const wchar_t * name)
{
if (tags.find(name) == tags.end()) return (short)0;
return ((ShortTag *) tags[name])->data;
}
int getInt(wchar_t * name)
int getInt(const wchar_t * name)
{
if (tags.find(name) == tags.end()) return (int)0;
return ((IntTag *) tags[name])->data;
}
__int64 getLong(wchar_t * name)
__int64 getLong(const wchar_t * name)
{
if (tags.find(name) == tags.end()) return (__int64)0;
return ((LongTag *) tags[name])->data;
}
float getFloat(wchar_t * name)
float getFloat(const wchar_t * name)
{
if (tags.find(name) == tags.end()) return (float)0;
return ((FloatTag *) tags[name])->data;
}
double getDouble(wchar_t * name)
double getDouble(const wchar_t * name)
{
if (tags.find(name) == tags.end()) return (double)0;
return ((DoubleTag *) tags[name])->data;
}
wstring getString(wchar_t * name)
wstring getString(const wchar_t * name)
{
if (tags.find(name) == tags.end()) return wstring( L"" );
return ((StringTag *) tags[name])->data;
}
byteArray getByteArray(wchar_t * name)
byteArray getByteArray(const wchar_t * name)
{
if (tags.find(name) == tags.end()) return byteArray();
return ((ByteArrayTag *) tags[name])->data;
}
intArray getIntArray(wchar_t * name)
intArray getIntArray(const wchar_t * name)
{
if (tags.find(name) == tags.end()) return intArray(0);
return ((IntArrayTag *) tags[name])->data;
}
CompoundTag *getCompound(wchar_t * name)
CompoundTag *getCompound(const wchar_t * name)
{
if (tags.find(name) == tags.end()) return new CompoundTag(name);
return (CompoundTag *) tags[name];
}
ListTag<Tag> *getList(wchar_t * name)
ListTag<Tag> *getList(const wchar_t * name)
{
if (tags.find(name) == tags.end()) return new ListTag<Tag>(name);
return (ListTag<Tag> *) tags[name];
}
bool getBoolean(wchar_t *string)
bool getBoolean(const wchar_t *string)
{
return getByte(string) != static_cast<byte>(0);
}

View file

@ -997,7 +997,7 @@ ShapedRecipy *Recipes::addShapedRecipy(ItemInstance *result, ...)
break;
case L'c':
wchFrom=va_arg(vl,wchar_t);
wchFrom=(wchar_t)va_arg(vl,int);
break;
case L'z':
pItemInstance=va_arg(vl,ItemInstance *);
@ -1014,7 +1014,7 @@ ShapedRecipy *Recipes::addShapedRecipy(ItemInstance *result, ...)
mappings->insert(myMap::value_type(wchFrom,pItemInstance));
break;
case L'g':
wchFrom=va_arg(vl,wchar_t);
wchFrom=(wchar_t)va_arg(vl,int);
switch(wchFrom)
{
// case L'W':
@ -1112,7 +1112,7 @@ void Recipes::addShapelessRecipy(ItemInstance *result,... )
ingredients->push_back(new ItemInstance(pTile));
break;
case L'g':
wchFrom=va_arg(vl,wchar_t);
wchFrom=(wchar_t)va_arg(vl,int);
switch(wchFrom)
{

View file

@ -6,9 +6,6 @@
#include "../Minecraft.Client/ServerConnection.h"
#include <algorithm>
#include "../Minecraft.Client/PS3/PS3Extras/ShutdownManager.h"
#include "../Minecraft.Client/Windows64/Windows64_App.h"
extern CConsoleMinecraftApp app;
// This current socket implementation is for the creation of a single local link. 2 sockets can be created, one for either end of this local
// link, the end (0 or 1) is passed as a parameter to the ctor.
@ -277,6 +274,7 @@ int Socket::SocketInputStreamLocal::read()
}
Sleep(1);
}
return -1;
}
// Try and get an input array of bytes, blocking until enough bytes are available
@ -306,6 +304,7 @@ int Socket::SocketInputStreamLocal::read(byteArray b, unsigned int offset, unsig
}
Sleep(1);
}
return -1;
}
void Socket::SocketInputStreamLocal::close()
@ -391,6 +390,7 @@ int Socket::SocketInputStreamNetwork::read()
}
Sleep(1);
}
return -1;
}
// Try and get an input array of bytes, blocking until enough bytes are available
@ -420,6 +420,7 @@ int Socket::SocketInputStreamNetwork::read(byteArray b, unsigned int offset, uns
}
Sleep(1);
}
return -1;
}
void Socket::SocketInputStreamNetwork::close()
@ -530,4 +531,4 @@ void Socket::SocketOutputStreamNetwork::writeWithFlags(byteArray b, unsigned int
void Socket::SocketOutputStreamNetwork::close()
{
m_streamOpen = false;
}
}

View file

@ -149,7 +149,7 @@ Tag *Tag::newTag(byte type, const wstring &name)
return NULL;
}
wchar_t *Tag::getTagName(byte type)
const wchar_t *Tag::getTagName(byte type)
{
switch (type)
{

View file

@ -38,7 +38,7 @@ public:
static Tag *readNamedTag(DataInput *dis);
static void writeNamedTag(Tag *tag, DataOutput *dos);
static Tag *newTag(byte type, const wstring &name);
static wchar_t *getTagName(byte type);
static const wchar_t *getTagName(byte type);
virtual ~Tag() {}
virtual bool equals(Tag *obj); // 4J Brought forward from 1.2
virtual Tag *copy() = 0; // 4J Brought foward from 1.2

View file

@ -318,10 +318,10 @@ public:
#define PIXSetMarkerDeprecated(a, b, ...) PIXSetMarker(a, L ## b, __VA_ARGS__)
#define PIXAddNamedCounter(a, b) PIXReportCounter( L ## b, a)
#else
void PIXAddNamedCounter(int a, char *b, ...);
void PIXBeginNamedEvent(int a, char *b, ...);
void PIXAddNamedCounter(int a, const char *b, ...);
void PIXBeginNamedEvent(int a, const char *b, ...);
void PIXEndNamedEvent();
void PIXSetMarkerDeprecated(int a, char *b, ...);
void PIXSetMarkerDeprecated(int a, const char *b, ...);
#endif
void XSetThreadProcessor(HANDLE a, int b);