mirror of
https://github.com/ZDoom/gzdoom.git
synced 2025-03-21 18:31:10 +00:00
backend update from Raze
* moving large allocations off the stack * use proper printf formatters for size_t and ptrdiff_t. * adding some missing 'noexcept'.
This commit is contained in:
parent
df9b2cd9bf
commit
83aa9388ca
29 changed files with 117 additions and 109 deletions
|
@ -192,6 +192,11 @@ void nsvgDelete(NSVGimage* image);
|
|||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push);
|
||||
#pragma warning(disable:4244)
|
||||
#endif
|
||||
|
||||
#define NSVG_PI (3.14159265358979323846264338327f)
|
||||
#define NSVG_KAPPA90 (0.5522847493f) // Length proportional to radius of a cubic bezier handle for 90deg arcs.
|
||||
|
||||
|
@ -3093,6 +3098,10 @@ void nsvgDelete(NSVGimage* image)
|
|||
free(image);
|
||||
}
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop);
|
||||
#endif
|
||||
|
||||
#endif // NANOSVG_IMPLEMENTATION
|
||||
|
||||
#endif // NANOSVG_H
|
||||
|
|
|
@ -1548,7 +1548,7 @@ render_outline(Outline *outl, double transform[6], SFT_Image image)
|
|||
|
||||
numPixels = (unsigned int) image.width * (unsigned int) image.height;
|
||||
|
||||
STACK_ALLOC(cells, Cell, 128 * 128, numPixels);
|
||||
STACK_ALLOC(cells, Cell, 32 * 32, numPixels);
|
||||
if (!cells) {
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -24,7 +24,6 @@ void ImageBox::SetImage(std::shared_ptr<Image> newImage)
|
|||
|
||||
void ImageBox::OnPaint(Canvas* canvas)
|
||||
{
|
||||
canvas->fillRect(Rect::xywh(0.0, 0.0, GetWidth(), GetHeight()), Colorf::fromRgba8(0, 0, 0));
|
||||
if (image)
|
||||
{
|
||||
canvas->drawImage(image, Point((GetWidth() - (double)image->GetWidth()) * 0.5, (GetHeight() - (double)image->GetHeight()) * 0.5));
|
||||
|
|
|
@ -192,7 +192,7 @@ public:
|
|||
TArray<TwoDVertex> mVertices;
|
||||
TArray<RenderCommand> mData;
|
||||
int Width, Height;
|
||||
bool isIn2D;
|
||||
bool isIn2D = false;
|
||||
bool locked = false; // prevents clearing of the data so it can be reused multiple times (useful for screen fades)
|
||||
float screenFade = 1.f;
|
||||
DVector2 offset;
|
||||
|
@ -317,7 +317,7 @@ public:
|
|||
|
||||
RefCountedPtr<DShape2DBufferInfo> bufferInfo;
|
||||
|
||||
DrawParms* lastParms;
|
||||
DrawParms* lastParms = nullptr;
|
||||
|
||||
void OnDestroy() override;
|
||||
};
|
||||
|
|
|
@ -465,19 +465,16 @@ const FSoundFontInfo *FSoundFontManager::FindSoundFont(const char *name, int all
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
FSoundFontReader *FSoundFontManager::OpenSoundFont(const char *name, int allowed)
|
||||
FSoundFontReader *FSoundFontManager::OpenSoundFont(const char *const name, int allowed)
|
||||
{
|
||||
|
||||
if (name == nullptr) return nullptr;
|
||||
// First check if the given name is inside the loaded resources.
|
||||
// To avoid clashes this will only be done if the name has the '.cfg' extension.
|
||||
// Sound fonts cannot be loaded this way.
|
||||
if (name != nullptr)
|
||||
const char *p = name + strlen(name) - 4;
|
||||
if (p > name && !stricmp(p, ".cfg") && fileSystem.CheckNumForFullName(name) >= 0)
|
||||
{
|
||||
const char *p = name + strlen(name) - 4;
|
||||
if (p > name && !stricmp(p, ".cfg") && fileSystem.CheckNumForFullName(name) >= 0)
|
||||
{
|
||||
return new FLumpPatchSetReader(name);
|
||||
}
|
||||
return new FLumpPatchSetReader(name);
|
||||
}
|
||||
|
||||
// Next check if the file is a .sf file
|
||||
|
|
|
@ -432,14 +432,14 @@ static FString ReplayGainHash(ZMusicCustomReader* reader, int flength, int playe
|
|||
{
|
||||
std::string playparam = _playparam;
|
||||
|
||||
uint8_t buffer[50000]; // for performance reasons only hash the start of the file. If we wanted to do this to large waveform songs it'd cause noticable lag.
|
||||
TArray<uint8_t> buffer(50000, true); // for performance reasons only hash the start of the file. If we wanted to do this to large waveform songs it'd cause noticable lag.
|
||||
uint8_t digest[16];
|
||||
char digestout[33];
|
||||
auto length = reader->read(reader, buffer, 50000);
|
||||
auto length = reader->read(reader, buffer.data(), 50000);
|
||||
reader->seek(reader, 0, SEEK_SET);
|
||||
MD5Context md5;
|
||||
md5.Init();
|
||||
md5.Update(buffer, (int)length);
|
||||
md5.Update(buffer.data(), (int)length);
|
||||
md5.Final(digest);
|
||||
|
||||
for (size_t j = 0; j < sizeof(digest); ++j)
|
||||
|
@ -448,7 +448,7 @@ static FString ReplayGainHash(ZMusicCustomReader* reader, int flength, int playe
|
|||
}
|
||||
digestout[32] = 0;
|
||||
|
||||
auto type = ZMusic_IdentifyMIDIType((uint32_t*)buffer, 32);
|
||||
auto type = ZMusic_IdentifyMIDIType((uint32_t*)buffer.data(), 32);
|
||||
if (type == MIDI_NOTMIDI) return FStringf("%d:%s", flength, digestout);
|
||||
|
||||
// get the default for MIDI synth
|
||||
|
|
|
@ -244,7 +244,7 @@ CCMD (wdir)
|
|||
{
|
||||
if (wadnum == -1 || fileSystem.GetFileContainer(i) == wadnum)
|
||||
{
|
||||
Printf ("%10d %s\n", fileSystem.FileLength(i), fileSystem.GetFileFullName(i));
|
||||
Printf ("%10ld %s\n", fileSystem.FileLength(i), fileSystem.GetFileFullName(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -321,7 +321,7 @@ void FStringTable::LoadLanguage (int lumpnum, const char* buffer, size_t size)
|
|||
}
|
||||
else
|
||||
{
|
||||
sc.ScriptError ("The language code must be 2 or 3 characters long.\n'%s' is %lu characters long.",
|
||||
sc.ScriptError ("The language code must be 2 or 3 characters long.\n'%s' is %zu characters long.",
|
||||
sc.String, len);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -154,20 +154,20 @@ protected:
|
|||
std::vector<LumpRecord> FileInfo;
|
||||
|
||||
std::vector<uint32_t> Hashes; // one allocation for all hash lists.
|
||||
uint32_t *FirstLumpIndex; // [RH] Hashing stuff moved out of lumpinfo structure
|
||||
uint32_t *NextLumpIndex;
|
||||
uint32_t *FirstLumpIndex = nullptr; // [RH] Hashing stuff moved out of lumpinfo structure
|
||||
uint32_t *NextLumpIndex = nullptr;
|
||||
|
||||
uint32_t *FirstLumpIndex_FullName; // The same information for fully qualified paths from .zips
|
||||
uint32_t *NextLumpIndex_FullName;
|
||||
uint32_t *FirstLumpIndex_FullName = nullptr; // The same information for fully qualified paths from .zips
|
||||
uint32_t *NextLumpIndex_FullName = nullptr;
|
||||
|
||||
uint32_t *FirstLumpIndex_NoExt; // The same information for fully qualified paths from .zips
|
||||
uint32_t *NextLumpIndex_NoExt;
|
||||
uint32_t *FirstLumpIndex_NoExt = nullptr; // The same information for fully qualified paths from .zips
|
||||
uint32_t *NextLumpIndex_NoExt = nullptr;
|
||||
|
||||
uint32_t* FirstLumpIndex_ResId; // The same information for fully qualified paths from .zips
|
||||
uint32_t* NextLumpIndex_ResId;
|
||||
uint32_t* FirstLumpIndex_ResId = nullptr; // The same information for fully qualified paths from .zips
|
||||
uint32_t* NextLumpIndex_ResId = nullptr;
|
||||
|
||||
uint32_t NumEntries = 0; // Not necessarily the same as FileInfo.Size()
|
||||
uint32_t NumWads;
|
||||
uint32_t NumWads = 0;
|
||||
|
||||
int IwadIndex = -1;
|
||||
int MaxIwadIndex = -1;
|
||||
|
|
|
@ -177,7 +177,7 @@ public:
|
|||
|
||||
int GetEntryNamespace(uint32_t entry)
|
||||
{
|
||||
return (entry < NumLumps) ? Entries[entry].Namespace : ns_hidden;
|
||||
return (entry < NumLumps) ? Entries[entry].Namespace : (int)ns_hidden;
|
||||
}
|
||||
|
||||
int GetEntryResourceID(uint32_t entry)
|
||||
|
|
|
@ -45,6 +45,7 @@
|
|||
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
#include <memory>
|
||||
#include "ancientzip.h"
|
||||
|
||||
namespace FileSys {
|
||||
|
@ -342,10 +343,19 @@ int FZipExploder::Explode(unsigned char *out, unsigned int outsize,
|
|||
|
||||
int ShrinkLoop(unsigned char *out, unsigned int outsize, FileReader &_In, unsigned int InLeft)
|
||||
{
|
||||
// don't allocate this on the stack, it's a bit on the large side.
|
||||
struct work
|
||||
{
|
||||
unsigned char ReadBuf[256];
|
||||
unsigned short Parent[HSIZE];
|
||||
unsigned char Value[HSIZE], Stack[HSIZE];
|
||||
};
|
||||
auto s = std::make_unique<work>();
|
||||
unsigned char* ReadBuf = s->ReadBuf;
|
||||
unsigned short* Parent = s->Parent;
|
||||
unsigned char* Value = s->Value, * Stack = s->Stack;
|
||||
|
||||
FileReader *In = &_In;
|
||||
unsigned char ReadBuf[256];
|
||||
unsigned short Parent[HSIZE];
|
||||
unsigned char Value[HSIZE], Stack[HSIZE];
|
||||
unsigned char *newstr;
|
||||
int len;
|
||||
int KwKwK, codesize = 9; /* start at 9 bits/code */
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
#include "resourcefile.h"
|
||||
#include "fs_filesystem.h"
|
||||
|
@ -415,7 +416,7 @@ void FileSystem::AddFile (const char *filename, FileReader *filer, LumpFilterInf
|
|||
snprintf(cksumout + (j * 2), 3, "%02X", cksum[j]);
|
||||
}
|
||||
|
||||
fprintf(hashfile, "file: %s, hash: %s, size: %d\n", filename, cksumout, (int)filereader.GetLength());
|
||||
fprintf(hashfile, "file: %s, hash: %s, size: %td\n", filename, cksumout, filereader.GetLength());
|
||||
}
|
||||
|
||||
else
|
||||
|
@ -434,7 +435,7 @@ void FileSystem::AddFile (const char *filename, FileReader *filer, LumpFilterInf
|
|||
snprintf(cksumout + (j * 2), 3, "%02X", cksum[j]);
|
||||
}
|
||||
|
||||
fprintf(hashfile, "file: %s, lump: %s, hash: %s, size: %llu\n", filename, resfile->getName(i), cksumout, (uint64_t)resfile->Length(i));
|
||||
fprintf(hashfile, "file: %s, lump: %s, hash: %s, size: %zu\n", filename, resfile->getName(i), cksumout, (uint64_t)resfile->Length(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1272,7 +1273,7 @@ void FileSystem::ReadFile (int lump, void *dest)
|
|||
|
||||
if (numread != size)
|
||||
{
|
||||
throw FileSystemException("W_ReadFile: only read %ld of %ld on '%s'\n",
|
||||
throw FileSystemException("W_ReadFile: only read %td of %td on '%s'\n",
|
||||
numread, size, FileInfo[lump].LongName);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ class StringPool
|
|||
friend class FileSystem;
|
||||
friend class FResourceFile;
|
||||
private:
|
||||
StringPool(bool _shared, size_t blocksize = 10*1024) : TopBlock(nullptr), FreeBlocks(nullptr), BlockSize(blocksize), shared(_shared) {}
|
||||
StringPool(bool _shared, size_t blocksize = 10*1024) : TopBlock(nullptr), BlockSize(blocksize), shared(_shared) {}
|
||||
public:
|
||||
~StringPool();
|
||||
const char* Strdup(const char*);
|
||||
|
@ -20,7 +20,6 @@ protected:
|
|||
Block *AddBlock(size_t size);
|
||||
|
||||
Block *TopBlock;
|
||||
Block *FreeBlocks;
|
||||
size_t BlockSize;
|
||||
public:
|
||||
bool shared;
|
||||
|
|
|
@ -381,12 +381,14 @@ static HANDLE WriteMyMiniDump (void)
|
|||
{
|
||||
MiniDumpThreadData dumpdata = { file, pMiniDumpWriteDump, &exceptor };
|
||||
DWORD id;
|
||||
HANDLE thread = CreateThread (NULL, 0, WriteMiniDumpInAnotherThread,
|
||||
&dumpdata, 0, &id);
|
||||
WaitForSingleObject (thread, INFINITE);
|
||||
if (GetExitCodeThread (thread, &id))
|
||||
HANDLE thread = CreateThread (NULL, 0, WriteMiniDumpInAnotherThread, &dumpdata, 0, &id);
|
||||
if (thread != nullptr)
|
||||
{
|
||||
good = id;
|
||||
WaitForSingleObject(thread, INFINITE);
|
||||
if (GetExitCodeThread(thread, &id))
|
||||
{
|
||||
good = id;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -421,7 +421,8 @@ void FDInputJoystick::ProcessInput()
|
|||
return;
|
||||
}
|
||||
|
||||
state = (uint8_t *)alloca(DataFormat.dwDataSize);
|
||||
TArray<uint8_t> statearr(DataFormat.dwDataSize, true);
|
||||
state = statearr.data();
|
||||
hr = Device->GetDeviceState(DataFormat.dwDataSize, state);
|
||||
if (FAILED(hr))
|
||||
return;
|
||||
|
|
|
@ -334,7 +334,8 @@ LRESULT CALLBACK WndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||
if (!GetRawInputData((HRAWINPUT)lParam, RID_INPUT, NULL, &size, sizeof(RAWINPUTHEADER)) &&
|
||||
size != 0)
|
||||
{
|
||||
uint8_t *buffer = (uint8_t *)alloca(size);
|
||||
TArray<uint8_t> array(size, true);
|
||||
uint8_t *buffer = array.data();
|
||||
if (GetRawInputData((HRAWINPUT)lParam, RID_INPUT, buffer, &size, sizeof(RAWINPUTHEADER)) == size)
|
||||
{
|
||||
int code = GET_RAWINPUT_CODE_WPARAM(wParam);
|
||||
|
@ -691,12 +692,15 @@ void I_PutInClipboard (const char *str)
|
|||
|
||||
auto wstr = WideString(str);
|
||||
HGLOBAL cliphandle = GlobalAlloc (GMEM_DDESHARE, wstr.length() * 2 + 2);
|
||||
if (cliphandle != NULL)
|
||||
if (cliphandle != nullptr)
|
||||
{
|
||||
wchar_t *ptr = (wchar_t *)GlobalLock (cliphandle);
|
||||
wcscpy (ptr, wstr.c_str());
|
||||
GlobalUnlock (cliphandle);
|
||||
SetClipboardData (CF_UNICODETEXT, cliphandle);
|
||||
if (ptr)
|
||||
{
|
||||
wcscpy(ptr, wstr.c_str());
|
||||
GlobalUnlock(cliphandle);
|
||||
SetClipboardData(CF_UNICODETEXT, cliphandle);
|
||||
}
|
||||
}
|
||||
CloseClipboard ();
|
||||
}
|
||||
|
|
|
@ -284,12 +284,12 @@ int DoMain (HINSTANCE hInstance)
|
|||
HANDLE stdinput = GetStdHandle(STD_INPUT_HANDLE);
|
||||
|
||||
ShowWindow(mainwindow.GetHandle(), SW_HIDE);
|
||||
WriteFile(StdOut, "Press any key to exit...", 24, &bytes, NULL);
|
||||
if (StdOut != nullptr) WriteFile(StdOut, "Press any key to exit...", 24, &bytes, nullptr);
|
||||
FlushConsoleInputBuffer(stdinput);
|
||||
SetConsoleMode(stdinput, 0);
|
||||
ReadConsole(stdinput, &bytes, 1, &bytes, NULL);
|
||||
}
|
||||
else if (StdOut == NULL)
|
||||
else if (StdOut == nullptr)
|
||||
{
|
||||
mainwindow.ShowErrorPane(nullptr);
|
||||
}
|
||||
|
|
|
@ -326,8 +326,7 @@ bool Win32GLVideo::SetupPixelFormat(int multisample)
|
|||
|
||||
if (!myWglChoosePixelFormatARB(m_hDC, attributes.data(), attribsFloat, 1, &pixelFormat, &numFormats))
|
||||
{
|
||||
Printf("R_OPENGL: Couldn't choose pixel format. Retrying in compatibility mode\n");
|
||||
goto oldmethod;
|
||||
I_FatalError("R_OPENGL: Couldn't choose pixel format. Retrying in compatibility mode\n");
|
||||
}
|
||||
|
||||
if (vid_hdr && numFormats == 0) // This card/driver doesn't support the rgb16f pixel format. Fall back to 8bpc
|
||||
|
@ -343,8 +342,7 @@ bool Win32GLVideo::SetupPixelFormat(int multisample)
|
|||
|
||||
if (!myWglChoosePixelFormatARB(m_hDC, attributes.data(), attribsFloat, 1, &pixelFormat, &numFormats))
|
||||
{
|
||||
Printf("R_OPENGL: Couldn't choose pixel format. Retrying in compatibility mode\n");
|
||||
goto oldmethod;
|
||||
I_FatalError("R_OPENGL: Couldn't choose pixel format.");
|
||||
}
|
||||
}
|
||||
else if (vid_hdr)
|
||||
|
@ -360,41 +358,12 @@ bool Win32GLVideo::SetupPixelFormat(int multisample)
|
|||
vr_enable_quadbuffered = false;
|
||||
goto again;
|
||||
}
|
||||
Printf("R_OPENGL: No valid pixel formats found. Retrying in compatibility mode\n");
|
||||
goto oldmethod;
|
||||
I_FatalError("R_OPENGL: No valid pixel formats found.");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
oldmethod:
|
||||
// If wglChoosePixelFormatARB is not found we have to do it the old fashioned way.
|
||||
static PIXELFORMATDESCRIPTOR pfd = {
|
||||
sizeof(PIXELFORMATDESCRIPTOR),
|
||||
1,
|
||||
PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER,
|
||||
PFD_TYPE_RGBA,
|
||||
32, // color depth
|
||||
0, 0, 0, 0, 0, 0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0, 0, 0, 0,
|
||||
32, // z depth
|
||||
8, // stencil buffer
|
||||
0,
|
||||
PFD_MAIN_PLANE,
|
||||
0,
|
||||
0, 0, 0
|
||||
};
|
||||
|
||||
pixelFormat = ChoosePixelFormat(m_hDC, &pfd);
|
||||
DescribePixelFormat(m_hDC, pixelFormat, sizeof(pfd), &pfd);
|
||||
|
||||
if (pfd.dwFlags & PFD_GENERIC_FORMAT)
|
||||
{
|
||||
I_Error("R_OPENGL: OpenGL driver not accelerated!");
|
||||
return false;
|
||||
}
|
||||
I_FatalError("R_OPENGL: Unable to create an OpenGL render context. Insufficient driver support for context creation\n");
|
||||
}
|
||||
|
||||
if (!::SetPixelFormat(m_hDC, pixelFormat, NULL))
|
||||
|
@ -452,8 +421,7 @@ bool Win32GLVideo::InitHardware(HWND Window, int multisample)
|
|||
m_hRC = zd_wglCreateContext(m_hDC);
|
||||
if (m_hRC == NULL)
|
||||
{
|
||||
I_Error("R_OPENGL: Unable to create an OpenGL render context.\n");
|
||||
return false;
|
||||
I_FatalError("R_OPENGL: Unable to create an OpenGL render context.\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -464,7 +432,7 @@ bool Win32GLVideo::InitHardware(HWND Window, int multisample)
|
|||
}
|
||||
}
|
||||
// We get here if the driver doesn't support the modern context creation API which always means an old driver.
|
||||
I_Error("R_OPENGL: Unable to create an OpenGL render context. Insufficient driver support for context creation\n");
|
||||
I_FatalError("R_OPENGL: Unable to create an OpenGL render context. Insufficient driver support for context creation\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -77,10 +77,19 @@ static void CheckOpenGL(void)
|
|||
if (opengl32dll == 0)
|
||||
{
|
||||
opengl32dll = LoadLibrary(L"OpenGL32.DLL");
|
||||
createcontext = (HGLRC(WINAPI*)(HDC)) GetProcAddress(opengl32dll, "wglCreateContext");
|
||||
deletecontext = (BOOL(WINAPI*)(HGLRC)) GetProcAddress(opengl32dll, "wglDeleteContext");
|
||||
makecurrent = (BOOL(WINAPI*)(HDC, HGLRC)) GetProcAddress(opengl32dll, "wglMakeCurrent");
|
||||
getprocaddress = (PROC(WINAPI*)(LPCSTR)) GetProcAddress(opengl32dll, "wglGetProcAddress");
|
||||
if (opengl32dll != 0)
|
||||
{
|
||||
createcontext = (HGLRC(WINAPI*)(HDC)) GetProcAddress(opengl32dll, "wglCreateContext");
|
||||
deletecontext = (BOOL(WINAPI*)(HGLRC)) GetProcAddress(opengl32dll, "wglDeleteContext");
|
||||
makecurrent = (BOOL(WINAPI*)(HDC, HGLRC)) GetProcAddress(opengl32dll, "wglMakeCurrent");
|
||||
getprocaddress = (PROC(WINAPI*)(LPCSTR)) GetProcAddress(opengl32dll, "wglGetProcAddress");
|
||||
}
|
||||
else
|
||||
{
|
||||
// Should this ever happen we have no choice but to hard abort, there is no good way to recover.
|
||||
MessageBoxA(0, "OpenGL32.dll not found", "Fatal error", MB_OK | MB_ICONERROR | MB_TASKMODAL);
|
||||
exit(3);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -11674,7 +11674,7 @@ FxExpression *FxThreeArgForEachLoop::Resolve(FCompileContext &ctx)
|
|||
|
||||
if(HasGameSpecificThreeArgForEachLoopTypeNames())
|
||||
{
|
||||
ScriptPosition.Message(MSG_ERROR, "foreach( a, b, c : it ) - 'it' must be % but is a %s", GetGameSpecificThreeArgForEachLoopTypeNames(), BlockIteratorExpr->ValueType->DescriptiveName());
|
||||
ScriptPosition.Message(MSG_ERROR, "foreach( a, b, c : it ) - 'it' must be %s but is a %s", GetGameSpecificThreeArgForEachLoopTypeNames(), BlockIteratorExpr->ValueType->DescriptiveName());
|
||||
delete this;
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -11727,7 +11727,7 @@ FxExpression *FxTypedForEachLoop::Resolve(FCompileContext &ctx)
|
|||
|
||||
if(HasGameSpecificTypedForEachLoopTypeNames())
|
||||
{
|
||||
ScriptPosition.Message(MSG_ERROR, "foreach(Type var : it ) - 'it' must be % but is a %s",GetGameSpecificTypedForEachLoopTypeNames(), Expr->ValueType->DescriptiveName());
|
||||
ScriptPosition.Message(MSG_ERROR, "foreach(Type var : it ) - 'it' must be %s but is a %s",GetGameSpecificTypedForEachLoopTypeNames(), Expr->ValueType->DescriptiveName());
|
||||
delete this;
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ class PSymbolType : public PSymbol
|
|||
{
|
||||
DECLARE_CLASS(PSymbolType, PSymbol);
|
||||
public:
|
||||
PType *Type;
|
||||
PType *Type = nullptr;
|
||||
|
||||
PSymbolType(FName name, class PType *ty) : PSymbol(name), Type(ty) {}
|
||||
PSymbolType() : PSymbol(NAME_None) {}
|
||||
|
@ -66,7 +66,7 @@ class PSymbolTreeNode : public PSymbol
|
|||
{
|
||||
DECLARE_CLASS(PSymbolTreeNode, PSymbol);
|
||||
public:
|
||||
struct ZCC_TreeNode *Node;
|
||||
struct ZCC_TreeNode *Node = nullptr;
|
||||
|
||||
PSymbolTreeNode(FName name, struct ZCC_TreeNode *node) : PSymbol(name), Node(node) {}
|
||||
PSymbolTreeNode() : PSymbol(NAME_None) {}
|
||||
|
@ -147,11 +147,11 @@ public:
|
|||
void *Pad;
|
||||
};
|
||||
|
||||
PSymbolConstNumeric(FName name, PType *type=NULL) : PSymbolConst(name, type) {}
|
||||
PSymbolConstNumeric(FName name, PType *type=nullptr) : PSymbolConst(name, type), Float(0) {}
|
||||
PSymbolConstNumeric(FName name, PType *type, int val) : PSymbolConst(name, type), Value(val) {}
|
||||
PSymbolConstNumeric(FName name, PType *type, unsigned int val) : PSymbolConst(name, type), Value((int)val) {}
|
||||
PSymbolConstNumeric(FName name, PType *type, double val) : PSymbolConst(name, type), Float(val) {}
|
||||
PSymbolConstNumeric() {}
|
||||
PSymbolConstNumeric() : Float(0) {}
|
||||
};
|
||||
|
||||
// A constant string value --------------------------------------------------
|
||||
|
|
|
@ -116,7 +116,7 @@ void DumpTypeTable()
|
|||
}
|
||||
Printf("\n");
|
||||
}
|
||||
Printf("Used buckets: %d/%lu (%.2f%%) for %d entries\n", used, countof(TypeTable.TypeHash), double(used)/countof(TypeTable.TypeHash)*100, all);
|
||||
Printf("Used buckets: %d/%zu (%.2f%%) for %d entries\n", used, countof(TypeTable.TypeHash), double(used)/countof(TypeTable.TypeHash)*100, all);
|
||||
Printf("Min bucket size: %d\n", min);
|
||||
Printf("Max bucket size: %d\n", max);
|
||||
Printf("Avg bucket size: %.2f\n", double(all) / used);
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
#ifdef HAVE_MMX
|
||||
#include "hqnx_asm/hqnx_asm.h"
|
||||
#endif
|
||||
#include <memory>
|
||||
#include "xbr/xbrz.h"
|
||||
#include "xbr/xbrz_old.h"
|
||||
#include "parallel_for.h"
|
||||
|
@ -304,7 +305,8 @@ static unsigned char *hqNxAsmHelper( void (*hqNxFunction) ( int*, unsigned char*
|
|||
initdone = true;
|
||||
}
|
||||
|
||||
HQnX_asm::CImage cImageIn;
|
||||
auto pImageIn = std::make_unique<HQnX_asm::CImage>();
|
||||
auto& cImageIn = *pImageIn;
|
||||
cImageIn.SetImage(inputBuffer, inWidth, inHeight, 32);
|
||||
cImageIn.Convert32To17();
|
||||
|
||||
|
|
|
@ -510,7 +510,8 @@ bool M_ReadIDAT (FileReader &file, uint8_t *buffer, int width, int height, int p
|
|||
{
|
||||
i += bytesPerRowOut * 2;
|
||||
}
|
||||
inputLine = (Byte *)alloca (i);
|
||||
TArray<Byte> inputArray(i, true);
|
||||
inputLine = inputArray.data();
|
||||
adam7buff[0] = inputLine + 4 + bytesPerRowOut;
|
||||
adam7buff[1] = adam7buff[0] + bytesPerRowOut;
|
||||
adam7buff[2] = adam7buff[1] + bytesPerRowOut;
|
||||
|
@ -925,7 +926,8 @@ bool M_SaveBitmap(const uint8_t *from, ESSType color_type, int width, int height
|
|||
temprow[i] = &temprow_storage[temprow_size * i];
|
||||
}
|
||||
|
||||
Byte buffer[PNG_WRITE_SIZE];
|
||||
TArray<Byte> array(PNG_WRITE_SIZE, true);
|
||||
auto buffer = array.data();
|
||||
z_stream stream;
|
||||
int err;
|
||||
int y;
|
||||
|
|
|
@ -181,7 +181,7 @@ struct FTextureBuffer
|
|||
}
|
||||
|
||||
FTextureBuffer(const FTextureBuffer &other) = delete;
|
||||
FTextureBuffer(FTextureBuffer &&other)
|
||||
FTextureBuffer(FTextureBuffer &&other) noexcept
|
||||
{
|
||||
mBuffer = other.mBuffer;
|
||||
mWidth = other.mWidth;
|
||||
|
@ -190,7 +190,7 @@ struct FTextureBuffer
|
|||
other.mBuffer = nullptr;
|
||||
}
|
||||
|
||||
FTextureBuffer& operator=(FTextureBuffer &&other)
|
||||
FTextureBuffer& operator=(FTextureBuffer &&other) noexcept
|
||||
{
|
||||
mBuffer = other.mBuffer;
|
||||
mWidth = other.mWidth;
|
||||
|
|
2
src/common/thirdparty/gain_analysis.cpp
vendored
2
src/common/thirdparty/gain_analysis.cpp
vendored
|
@ -282,7 +282,7 @@ GainAnalyzer::ResetSampleFrequency(int samplefreq) {
|
|||
|
||||
int
|
||||
GainAnalyzer::InitGainAnalysis(int samplefreq) {
|
||||
*this = {};
|
||||
memset(this, 0, sizeof(*this));
|
||||
if (ResetSampleFrequency(samplefreq) != INIT_GAIN_ANALYSIS_OK) {
|
||||
return INIT_GAIN_ANALYSIS_ERROR;
|
||||
}
|
||||
|
|
|
@ -234,7 +234,7 @@ public:
|
|||
{
|
||||
DoCopy (other);
|
||||
}
|
||||
TArray (TArray<T,TT> &&other)
|
||||
TArray (TArray<T,TT> &&other) noexcept
|
||||
{
|
||||
Array = other.Array; other.Array = NULL;
|
||||
Most = other.Most; other.Most = 0;
|
||||
|
@ -256,7 +256,7 @@ public:
|
|||
}
|
||||
return *this;
|
||||
}
|
||||
TArray<T,TT> &operator= (TArray<T,TT> &&other)
|
||||
TArray<T,TT> &operator= (TArray<T,TT> &&other) noexcept
|
||||
{
|
||||
if (Array)
|
||||
{
|
||||
|
@ -1777,14 +1777,14 @@ public:
|
|||
return *this;
|
||||
}
|
||||
|
||||
BitArray(BitArray && arr)
|
||||
BitArray(BitArray && arr) noexcept
|
||||
: bytes(std::move(arr.bytes))
|
||||
{
|
||||
size = arr.size;
|
||||
arr.size = 0;
|
||||
}
|
||||
|
||||
BitArray &operator=(BitArray && arr)
|
||||
BitArray &operator=(BitArray && arr) noexcept
|
||||
{
|
||||
bytes = std::move(arr.bytes);
|
||||
size = arr.size;
|
||||
|
|
|
@ -125,7 +125,7 @@ public:
|
|||
|
||||
// Copy constructors
|
||||
FString (const FString &other) { AttachToOther (other); }
|
||||
FString (FString &&other) : Chars(other.Chars) { other.ResetToNull(); }
|
||||
FString (FString &&other) noexcept : Chars(other.Chars) { other.ResetToNull(); }
|
||||
FString (const char *copyStr);
|
||||
FString (const char *copyStr, size_t copyLen);
|
||||
FString (char oneChar);
|
||||
|
|
|
@ -12,6 +12,11 @@ void InitWidgetResources(const char* filename)
|
|||
I_FatalError("Unable to open %s", filename);
|
||||
}
|
||||
|
||||
void CloseWidgetResources()
|
||||
{
|
||||
if (WidgetResources) delete WidgetResources;
|
||||
}
|
||||
|
||||
static std::vector<uint8_t> LoadFile(const std::string& name)
|
||||
{
|
||||
auto lump = WidgetResources->FindEntry(name.c_str());
|
||||
|
|
Loading…
Reference in a new issue