[Scummvm-git-logs] scummvm-tools master -> 474e06771447c59ddef9337130a96acaff46e7d5
aquadran
noreply at scummvm.org
Thu Nov 18 16:56:29 UTC 2021
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm-tools' repo located at https://github.com/scummvm/scummvm-tools .
Summary:
474e067714 Fix almost all warnings and compile errors on MinGW64 (#39)
Commit: 474e06771447c59ddef9337130a96acaff46e7d5
https://github.com/scummvm/scummvm-tools/commit/474e06771447c59ddef9337130a96acaff46e7d5
Author: Orgad Shaneh (orgads at gmail.com)
Date: 2021-11-18T17:56:26+01:00
Commit Message:
Fix almost all warnings and compile errors on MinGW64 (#39)
Changed paths:
common/zlib.cpp
configure
engines/asylum/extract_asylum.cpp
engines/gob/extract_gob_stk.cpp
engines/grim/bm2bmp.cpp
engines/grim/delua.cpp
engines/grim/emi/setb2set.cpp
engines/grim/lua/liolib.cpp
engines/grim/lua/llex.cpp
engines/grim/lua/lobject.h
engines/grim/lua/lstring.cpp
engines/grim/lua/lstrlib.cpp
engines/grim/lua/ltask.cpp
engines/grim/lua/lundump.cpp
engines/grim/lua/lvm.cpp
engines/grim/luac/luac.cpp
engines/grim/luac/opcode.cpp
engines/grim/luac/opt.cpp
engines/grim/luac/print.cpp
engines/grim/patchex/cabd.cpp
engines/grim/patchex/mszipd.cpp
engines/grim/unlab.cpp
engines/ngi/extract_ngi.cpp
engines/scumm/compress_scumm_san.cpp
diff --git a/common/zlib.cpp b/common/zlib.cpp
index 28af7ed..dca58a1 100644
--- a/common/zlib.cpp
+++ b/common/zlib.cpp
@@ -128,6 +128,7 @@ bool GZipReadStream::seek(int32 offset, std::ios::seekdir whence) {
break;
case std::ios::cur:
newPos = _pos + offset;
+ break;
default:
assert(false);
}
diff --git a/configure b/configure
index 49d3d79..cf094d8 100755
--- a/configure
+++ b/configure
@@ -1843,6 +1843,12 @@ if test "$_wxwidgets" = yes ; then
# _wxstaticlibs may contain non-static libraries that we also have in _wxstaticlibs.
# remove those to avoid dependency on non-static libraries
+ if test "$have_gcc" = yes ; then
+ if test "$_cxx_major" -ge "8" ; then
+ # These warnings appear a lot in wx headers
+ _wxincludes="$_wxincludes -Wno-deprecated-copy -Wno-cast-function-type -Wno-cast-qual"
+ fi
+ fi
# Use the compiler specified by wx-config when not cross-compiling. This is needed on some systems to get a working executable.
if test -z "$_host"; then
CXX="`$_wxconfig --cxx`"
diff --git a/engines/asylum/extract_asylum.cpp b/engines/asylum/extract_asylum.cpp
index 02ab864..3170838 100644
--- a/engines/asylum/extract_asylum.cpp
+++ b/engines/asylum/extract_asylum.cpp
@@ -68,7 +68,7 @@ void ExtractAsylum::execute() {
if (_resInd >= 0) {
dumpResource(_resInd);
} else {
- for (int i = 0; i < _resources.size(); i++) {
+ for (uint i = 0; i < _resources.size(); i++) {
dumpResource(i);
updateProgress(i, _resources.size());
}
diff --git a/engines/gob/extract_gob_stk.cpp b/engines/gob/extract_gob_stk.cpp
index 58b6e42..630e1f3 100644
--- a/engines/gob/extract_gob_stk.cpp
+++ b/engines/gob/extract_gob_stk.cpp
@@ -135,7 +135,7 @@ void ExtractGobStk::readChunkList(Common::File &stk, Common::File &gobConf) {
// Geisha TOTs are compressed without having the flag set
fakeTotPtr = strstr(curChunk->name, "0OT");
if (fakeTotPtr != 0) {
- strncpy(fakeTotPtr, "TOT", 3);
+ memcpy(fakeTotPtr, "TOT", 3);
curChunk->packed = true;
curChunk->preGob = true;
}
diff --git a/engines/grim/bm2bmp.cpp b/engines/grim/bm2bmp.cpp
index 1376a70..e9fae19 100644
--- a/engines/grim/bm2bmp.cpp
+++ b/engines/grim/bm2bmp.cpp
@@ -126,7 +126,7 @@ void Bitmap::toBMP(const std::string &fname) {
} \
} while (0)
-static bool decompress_codec3(const char *compressed, char *result, int maxBytes) {
+static bool decompress_codec3(const byte *compressed, char *result, int maxBytes) {
int bitstr_value = READ_LE_UINT16(compressed);
int bitstr_len = 16;
compressed += 2;
@@ -151,13 +151,13 @@ static bool decompress_codec3(const char *compressed, char *result, int maxBytes
copy_len = 2 * bit;
GET_BIT;
copy_len += bit + 3;
- copy_offset = *(uint8 *)(compressed++) - 0x100;
+ copy_offset = *(compressed++) - 0x100;
} else {
- copy_offset = (*(uint8 *)(compressed) | (*(uint8 *)(compressed + 1) & 0xf0) << 4) - 0x1000;
- copy_len = (*(uint8 *)(compressed + 1) & 0xf) + 3;
+ copy_offset = (*compressed | (*(compressed + 1) & 0xf0) << 4) - 0x1000;
+ copy_len = (*(compressed + 1) & 0xf) + 3;
compressed += 2;
if (copy_len == 3) {
- copy_len = *(uint8 *)(compressed++) + 1;
+ copy_len = *(compressed++) + 1;
if (copy_len == 1) {
return true;
}
@@ -221,7 +221,7 @@ Bitmap *Bitmap::load(const char *data, int len) {
pos += b->_bpp / 8 * b->_width * b->_height + 8;
} else if (codec == 3) {
int compressed_len = READ_LE_UINT32(data + pos);
- bool success = decompress_codec3(data + pos + 4, b->_data[i], b->_bpp / 8 * b->_width * b->_height);
+ bool success = decompress_codec3((const byte *)data + pos + 4, b->_data[i], b->_bpp / 8 * b->_width * b->_height);
if (!success) {
printf(".. when loading image\n");
}
diff --git a/engines/grim/delua.cpp b/engines/grim/delua.cpp
index c529dad..1b035ac 100644
--- a/engines/grim/delua.cpp
+++ b/engines/grim/delua.cpp
@@ -417,6 +417,7 @@ void Decompiler::do_multi_assign(Byte *&start) {
num_tables++;
// this needs stuff from farther up the stack, wait until
// it's available
+ // fall-through
case SETTABLE0:
results.push(new IndexExpr(start, NULL, NULL));
@@ -909,6 +910,7 @@ void Decompiler::decompileRange(Byte *start, Byte *end) {
case SETLISTW:
start += 2;
+ goto setlist;
case SETLIST0:
setlist:
diff --git a/engines/grim/emi/setb2set.cpp b/engines/grim/emi/setb2set.cpp
index 6d88ec4..daae09a 100644
--- a/engines/grim/emi/setb2set.cpp
+++ b/engines/grim/emi/setb2set.cpp
@@ -67,19 +67,19 @@ Data::Data(const char *data) {
}
float Data::GetFloat() {
- float retVal = *(float *) buf;
+ float retVal = *(const float *) buf;
buf += 4;
return retVal;
}
int Data::GetInt() {
- int retVal = *(int *) buf;
+ int retVal = *(const int *) buf;
buf += 4;
return retVal;
}
bool Data::GetBool() {
- bool retVal = *(bool *) buf;
+ bool retVal = *(const bool *) buf;
buf += 1;
return retVal;
}
diff --git a/engines/grim/lua/liolib.cpp b/engines/grim/lua/liolib.cpp
index ffef2d5..b2a0460 100644
--- a/engines/grim/lua/liolib.cpp
+++ b/engines/grim/lua/liolib.cpp
@@ -21,7 +21,8 @@
#define FINPUT "_INPUT"
#define FOUTPUT "_OUTPUT"
-
+#undef popen
+#undef pclose
#define popen(x,y) NULL /* that is, popen always fails */
#define pclose(x) (-1)
diff --git a/engines/grim/lua/llex.cpp b/engines/grim/lua/llex.cpp
index 98eade1..1fc0280 100644
--- a/engines/grim/lua/llex.cpp
+++ b/engines/grim/lua/llex.cpp
@@ -188,7 +188,7 @@ static void inclinenumber (LexState *LS)
break;
case 4: /* ifnot */
ifnot = 1;
- /* go through */
+ /* fall through */
case 5: /* if */
if (LS->iflevel == MAX_IFS-1)
luaX_syntaxerror(LS, "too many nested $ifs", "$if");
diff --git a/engines/grim/lua/lobject.h b/engines/grim/lua/lobject.h
index dfa6bc5..59c3c32 100644
--- a/engines/grim/lua/lobject.h
+++ b/engines/grim/lua/lobject.h
@@ -44,7 +44,7 @@ typedef byte Byte; /* unsigned 8 bits */
#define MAX_INT (2147483647-2) /* maximum value of an int (-2 for safety) */
#define MAX_WORD 65534
-typedef unsigned long IntPoint; /* unsigned with same size as a pointer (for hashing) */
+typedef size_t IntPoint; /* unsigned with same size as a pointer (for hashing) */
/*
diff --git a/engines/grim/lua/lstring.cpp b/engines/grim/lua/lstring.cpp
index a9d74e8..e802fa4 100644
--- a/engines/grim/lua/lstring.cpp
+++ b/engines/grim/lua/lstring.cpp
@@ -142,7 +142,7 @@ static TaggedString *insert_s (const char *str, int32 l, stringtable *tb)
static TaggedString *insert_u (void *buff, int32 tag, stringtable *tb)
{
TaggedString *ts;
- unsigned long h = (unsigned long)buff;
+ size_t h = (size_t)buff;
int32 size = tb->size;
int32 i;
int32 j = -1;
@@ -170,7 +170,7 @@ static TaggedString *insert_u (void *buff, int32 tag, stringtable *tb)
TaggedString *luaS_createudata (void *udata, int32 tag)
{
- return insert_u(udata, tag, &L->string_root[(unsigned long)udata%NUM_HASHS]);
+ return insert_u(udata, tag, &L->string_root[(size_t)udata%NUM_HASHS]);
}
TaggedString *luaS_newlstr (const char *str, int32 l)
diff --git a/engines/grim/lua/lstrlib.cpp b/engines/grim/lua/lstrlib.cpp
index e8e11a6..1a9d11a 100644
--- a/engines/grim/lua/lstrlib.cpp
+++ b/engines/grim/lua/lstrlib.cpp
@@ -290,7 +290,7 @@ static const char *match (const char *s, const char *p, struct Capture *cap)
case '\0': case '$': /* (possibly) end of pattern */
if (*p == 0 || (*(p+1) == 0 && s == cap->src_end))
return s;
- /* else go through */
+ /* else fall through */
default: { /* it is a pattern item */
const char *ep; /* get what is next */
const char *s1 = matchitem(s, p, cap, &ep);
diff --git a/engines/grim/lua/ltask.cpp b/engines/grim/lua/ltask.cpp
index 2757dd0..acdfa0a 100644
--- a/engines/grim/lua/ltask.cpp
+++ b/engines/grim/lua/ltask.cpp
@@ -110,13 +110,12 @@ void stop_script (void) {
}
void next_script (void) {
- struct lua_Task *t = NULL, *prev;
+ struct lua_Task *t = NULL;
TObject *f = L->stack.stack + L->Cstack.lua2C;
if (f == LUA_NOOBJECT)
lua_error("Bad argument to next_script: no obeject");
- prev = L->root_task;
if (ttype(f) == LUA_T_NIL) {
t = L->root_task;
} else if (ttype(f) == LUA_T_TASK) {
diff --git a/engines/grim/lua/lundump.cpp b/engines/grim/lua/lundump.cpp
index b2cad6e..2b1fa10 100644
--- a/engines/grim/lua/lundump.cpp
+++ b/engines/grim/lua/lundump.cpp
@@ -120,12 +120,14 @@ static void LoadConstants(TProtoFunc* tf, ZIO* Z)
switch ((uint32)ttype(o))
{
case (uint32)-'N':
- ttype(o)=LUA_T_NUMBER;
+ ttype(o)=LUA_T_NUMBER;
+ // fall-through
case (uint32)LUA_T_NUMBER:
doLoadNumber(nvalue(o),Z);
break;
case (uint32)-'S':
ttype(o)=LUA_T_STRING;
+ // fall-through
case (uint32)LUA_T_STRING:
tsvalue(o)=LoadTString(Z);
break;
diff --git a/engines/grim/lua/lvm.cpp b/engines/grim/lua/lvm.cpp
index cc89b5d..de191b9 100644
--- a/engines/grim/lua/lvm.cpp
+++ b/engines/grim/lua/lvm.cpp
@@ -715,7 +715,7 @@ StkId luaV_execute (struct CallInfo *ci)
case ENDCODE:
S->top = S->stack + base;
- /* goes through */
+ /* fall through */
case RETCODE: {
StkId firstResult = (base + ((aux==RETCODE) ? *pc : 0));
if (lua_callhook)
diff --git a/engines/grim/luac/luac.cpp b/engines/grim/luac/luac.cpp
index ec73f7e..a162be7 100644
--- a/engines/grim/luac/luac.cpp
+++ b/engines/grim/luac/luac.cpp
@@ -178,12 +178,12 @@ static void do_undump(ZIO* z)
static void doit(int undump, const char* filename) {
FILE* f;
ZIO z;
- char *fn;
+ const char *fn;
if (filename==NULL) {
- fn = (char *)"(stdin)";
+ fn = "(stdin)";
f = stdin;
} else {
- fn = (char *)filename;
+ fn = filename;
f = efopen(fn, undump ? "rb" : "r");
}
zFopen(&z,f,fn);
diff --git a/engines/grim/luac/opcode.cpp b/engines/grim/luac/opcode.cpp
index 1476c13..53438bc 100644
--- a/engines/grim/luac/opcode.cpp
+++ b/engines/grim/luac/opcode.cpp
@@ -16,7 +16,7 @@ static const Opcode Info[]= /* ORDER lopcodes.h */
int OpcodeInfo(TProtoFunc* tf, Byte* p, Opcode* I, const char* xFILE, int xLINE) {
Opcode OP;
Byte* code=tf->code;
- int op=*p;
+ uint op=*p;
if (p==code)
{
OP.name="STACK";
diff --git a/engines/grim/luac/opt.cpp b/engines/grim/luac/opt.cpp
index 4d0b21e..3234385 100644
--- a/engines/grim/luac/opt.cpp
+++ b/engines/grim/luac/opt.cpp
@@ -57,8 +57,8 @@ static TProtoFunc* TF;
static int compare(const void* a, const void *b)
{
- int ia=*(int*)a;
- int ib=*(int*)b;
+ int ia=*(const int*)a;
+ int ib=*(const int*)b;
int t;
TObject* oa=TF->consts+ia;
TObject* ob=TF->consts+ib;
diff --git a/engines/grim/luac/print.cpp b/engines/grim/luac/print.cpp
index 1fc4870..307ef37 100644
--- a/engines/grim/luac/print.cpp
+++ b/engines/grim/luac/print.cpp
@@ -99,6 +99,7 @@ static void PrintCode(TProtoFunc* tf)
case CLOSURE:
printf(" %d",OP.arg2);
+ // fall-through
case PUSHCONSTANT:
case GETDOTTED:
case PUSHSELF:
@@ -132,6 +133,7 @@ static void PrintCode(TProtoFunc* tf)
case IFTUPJMP:
case IFFUPJMP:
i=-i;
+ // fall-through
case ONTJMP:
case ONFJMP:
case JMP:
diff --git a/engines/grim/patchex/cabd.cpp b/engines/grim/patchex/cabd.cpp
index 9433507..228ddd1 100644
--- a/engines/grim/patchex/cabd.cpp
+++ b/engines/grim/patchex/cabd.cpp
@@ -673,8 +673,8 @@ static unsigned int cabd_checksum(unsigned char *data, unsigned int bytes,
}
switch (bytes & 3) {
- case 3: ul |= *data++ << 16;
- case 2: ul |= *data++ << 8;
+ case 3: ul |= *data++ << 16; // fall-through
+ case 2: ul |= *data++ << 8; // fall-through
case 1: ul |= *data;
}
cksum ^= ul;
diff --git a/engines/grim/patchex/mszipd.cpp b/engines/grim/patchex/mszipd.cpp
index 78d89e9..f77d032 100644
--- a/engines/grim/patchex/mszipd.cpp
+++ b/engines/grim/patchex/mszipd.cpp
@@ -555,9 +555,7 @@ int mszipd_decompress(struct mszipd_stream *zip, off_t out_bytes) {
}
void mszipd_free(struct mszipd_stream *zip) {
- struct mspack_system *sys;
if (zip) {
- sys = zip->sys;
free(zip->inbuf);
free(zip);
}
diff --git a/engines/grim/unlab.cpp b/engines/grim/unlab.cpp
index ba82bdc..ebb9d5b 100644
--- a/engines/grim/unlab.cpp
+++ b/engines/grim/unlab.cpp
@@ -27,7 +27,7 @@
#include <fstream>
#include "lab.h"
-#ifdef WIN32
+#ifdef _WIN32
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#else
@@ -38,15 +38,15 @@
#define GT_EMI 2
static void createDirectoryStructure(std::string name) {
-#ifdef WIN32
- int pos = name.find_last_of("\\");
+#ifdef _WIN32
+ size_t pos = name.find_last_of("\\");
if (pos != name.npos) {
name.erase(pos);
createDirectoryStructure(name);
CreateDirectory(name.c_str(), NULL);
}
#else
- int pos = name.find_last_of("/");
+ size_t pos = name.find_last_of("/");
if (pos != name.npos) {
name.erase(pos);
createDirectoryStructure(name);
diff --git a/engines/ngi/extract_ngi.cpp b/engines/ngi/extract_ngi.cpp
index 32df3cf..3856fd9 100644
--- a/engines/ngi/extract_ngi.cpp
+++ b/engines/ngi/extract_ngi.cpp
@@ -60,7 +60,7 @@ static void unpackFile(Common::File &fp, const char *outDir) {
char fname[13];
int flags, extVal, offset, size;
- for (int i = 0; i < count; i++) {
+ for (uint i = 0; i < count; i++) {
memcpy(fname, &o[i * 32], 12);
fname[12] = 0;
flags = READ_LE_UINT32(&o[i * 32 + 16]);
diff --git a/engines/scumm/compress_scumm_san.cpp b/engines/scumm/compress_scumm_san.cpp
index 74c4b4d..5dc6746 100644
--- a/engines/scumm/compress_scumm_san.cpp
+++ b/engines/scumm/compress_scumm_san.cpp
@@ -263,7 +263,7 @@ void CompressScummSan::prepareForMixing(const std::string &outputDir, const std:
#define ST_SAMPLE_MIN (-ST_SAMPLE_MAX - 1L)
static inline void clampedAdd(int16& a, int b) {
- register int val;
+ int val;
val = a + b;
if (val > ST_SAMPLE_MAX)
More information about the Scummvm-git-logs
mailing list