forked from Mirrors/openclonk
Warning fixes
Actually pretty sure a few of them were bugs. Hopefully no new ones were introduced here.shapetextures
parent
619fc0b65a
commit
f0030e33e0
|
@ -672,7 +672,7 @@ bool C4Group::AddEntry(C4GroupEntry::EntryStatus status,
|
|||
return false;
|
||||
return true;
|
||||
|
||||
case C4GroupEntry::C4GRES_InMemory: // Save buffer to file in folder
|
||||
case C4GroupEntry::C4GRES_InMemory: { // Save buffer to file in folder
|
||||
CStdFile hFile;
|
||||
bool fOkay = false;
|
||||
if (hFile.Create(tfname, !!childgroup))
|
||||
|
@ -683,8 +683,9 @@ bool C4Group::AddEntry(C4GroupEntry::EntryStatus status,
|
|||
if (fHoldBuffer) { if (fBufferIsStdbuf) StdBuf::DeletePointer(membuf); else delete [] membuf; }
|
||||
|
||||
return fOkay;
|
||||
}
|
||||
|
||||
// InGrp & Deleted ignored
|
||||
default: break; // InGrp & Deleted ignored
|
||||
}
|
||||
|
||||
return Error("Add to folder: Invalid request");
|
||||
|
@ -1025,6 +1026,7 @@ void C4Group::ResetSearch(bool reload_contents)
|
|||
case GRPF_File:
|
||||
SearchPtr=FirstEntry;
|
||||
break;
|
||||
default: break; // InGrp & Deleted ignored
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1073,6 +1075,7 @@ C4GroupEntry* C4Group::SearchNextEntry(const char *szName)
|
|||
}
|
||||
break;
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
default: break; // InGrp & Deleted ignored
|
||||
}
|
||||
// No entry found: reset search pointer
|
||||
SearchPtr=NULL;
|
||||
|
@ -1151,6 +1154,7 @@ bool C4Group::Read(void *pBuffer, size_t iSize)
|
|||
case GRPF_Folder:
|
||||
if (!StdFile.Read(pBuffer,iSize)) return Error("Read: Error reading from folder contents");
|
||||
break;
|
||||
default: break; // InGrp & Deleted ignored
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -1412,6 +1416,7 @@ bool C4Group::DeleteEntry(const char *szFilename, bool fRecycle)
|
|||
break;
|
||||
// refresh file list
|
||||
ResetSearch(true);
|
||||
default: break; // InGrp & Deleted ignored
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -1443,6 +1448,7 @@ bool C4Group::Rename(const char *szFile, const char *szNewName)
|
|||
// refresh file list
|
||||
ResetSearch(true);
|
||||
break;
|
||||
default: break; // InGrp & Deleted ignored
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -1570,6 +1576,7 @@ bool C4Group::ExtractEntry(const char *szFilename, const char *szExtractTo)
|
|||
if (!CopyItem(szPath,szTargetFName))
|
||||
return Error("ExtractEntry: Cannot copy item");
|
||||
break;
|
||||
default: break; // InGrp & Deleted ignored
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -1751,13 +1758,15 @@ bool C4Group::SetFilePtr2Entry(const char *szName, bool NeedsToBeAGroup)
|
|||
if ((!centry) || (centry->Status != C4GroupEntry::C4GRES_InGroup)) return false;
|
||||
return SetFilePtr(centry->Offset);
|
||||
|
||||
case GRPF_Folder:
|
||||
case GRPF_Folder: {
|
||||
StdFile.Close();
|
||||
char path[_MAX_FNAME+1]; SCopy(FileName,path,_MAX_FNAME);
|
||||
AppendBackslash(path); SAppend(szName,path);
|
||||
bool fSuccess = StdFile.Open(path, NeedsToBeAGroup);
|
||||
return fSuccess;
|
||||
}
|
||||
|
||||
default: break; // InGrp & Deleted ignored
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -1805,7 +1814,7 @@ bool C4Group::Add(const char *szName, StdBuf &pBuffer, bool fChild, bool fHoldBu
|
|||
szName,
|
||||
pBuffer.getSize(),
|
||||
szName,
|
||||
(BYTE*) pBuffer.getData(),
|
||||
(BYTE*) pBuffer.getMData(),
|
||||
false,
|
||||
fHoldBuffer,
|
||||
fExecutable,
|
||||
|
@ -1822,7 +1831,7 @@ bool C4Group::Add(const char *szName, StdStrBuf &pBuffer, bool fChild, bool fHol
|
|||
szName,
|
||||
pBuffer.getLength(),
|
||||
szName,
|
||||
(BYTE*) pBuffer.getData(),
|
||||
(BYTE*) pBuffer.getMData(),
|
||||
false,
|
||||
fHoldBuffer,
|
||||
fExecutable,
|
||||
|
|
|
@ -72,8 +72,8 @@ void DisplayGroup(const C4Group &grp, const char *filter = NULL)
|
|||
if (filter != NULL && !WildcardMatch(filter, entry->FileName))
|
||||
continue;
|
||||
|
||||
printf("%*s %8d Bytes",
|
||||
max_fn_len,
|
||||
printf("%*s %8u Bytes",
|
||||
int(max_fn_len),
|
||||
entry->FileName,
|
||||
entry->Size);
|
||||
if (entry->ChildGroup != 0)
|
||||
|
@ -85,7 +85,7 @@ void DisplayGroup(const C4Group &grp, const char *filter = NULL)
|
|||
++file_count;
|
||||
byte_count += entry->Size;
|
||||
}
|
||||
printf("%d Entries, %d Bytes\n", file_count, byte_count);
|
||||
printf("%lu Entries, %lu Bytes\n", file_count, byte_count);
|
||||
}
|
||||
|
||||
void PrintGroupInternals(C4Group &grp, int indent_level = 0)
|
||||
|
|
|
@ -247,7 +247,7 @@ bool CStdFile::Write(const void *pBuffer, int iSize)
|
|||
int transfer;
|
||||
if (!pBuffer) return false;
|
||||
if (!ModeWrite) return false;
|
||||
BYTE *bypBuffer= (BYTE*) pBuffer;
|
||||
const BYTE *bypBuffer= (const BYTE*) pBuffer;
|
||||
while (iSize>0)
|
||||
{
|
||||
// Space in buffer: Transfer as much as possible
|
||||
|
@ -271,7 +271,7 @@ bool CStdFile::WriteString(const char *szStr)
|
|||
BYTE nl[2]={0x0D,0x0A};
|
||||
if (!szStr) return false;
|
||||
int size=SLen(szStr);
|
||||
if (!Write((void*)szStr,size)) return false;
|
||||
if (!Write((const void*)szStr,size)) return false;
|
||||
if (!Write(nl,2)) return false;
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -990,7 +990,7 @@ StdStrBuf GetDbgRecPktData(C4RecordChunkType eType, const StdBuf & RawData)
|
|||
break;
|
||||
default:
|
||||
for (unsigned int i=0; i<RawData.getSize(); ++i)
|
||||
r.AppendFormat("%02x ", (uint32_t) ((uint8_t *)RawData.getData())[i]);
|
||||
r.AppendFormat("%02x ", (uint32_t) *getBufPtr<uint8_t>(RawData, i));
|
||||
break;
|
||||
}
|
||||
return r;
|
||||
|
@ -1083,7 +1083,7 @@ void C4Playback::Check(C4RecordChunkType eType, const uint8_t *pData, int iSize)
|
|||
DebugRecError(FormatString("Type %s != %s", GetRecordChunkTypeName(PktInReplay.getType()), GetRecordChunkTypeName(eType)).getData());
|
||||
return;
|
||||
}
|
||||
if (PktInReplay.getSize() != iSize)
|
||||
if (PktInReplay.getSize() != unsigned(iSize))
|
||||
{
|
||||
DebugRecError(FormatString("Size %d != %d", (int) PktInReplay.getSize(), (int) iSize).getData());
|
||||
}
|
||||
|
|
|
@ -699,6 +699,7 @@ static void name_cell_data_func(GtkTreeViewColumn* column, GtkCellRenderer* rend
|
|||
|
||||
enum { ICON_SIZE = 24 };
|
||||
|
||||
#ifdef _UNUSED_
|
||||
static void icon_cell_data_func(GtkTreeViewColumn* column, GtkCellRenderer* renderer, GtkTreeModel* model, GtkTreeIter* iter, gpointer data)
|
||||
{
|
||||
C4Object* object = c4_list_iter_get_C4Object(model, iter);
|
||||
|
@ -755,6 +756,7 @@ static void icon_cell_data_func(GtkTreeViewColumn* column, GtkCellRenderer* rend
|
|||
|
||||
g_object_set(G_OBJECT(renderer), "pixbuf", pixbuf, NULL);
|
||||
}
|
||||
#endif // _UNUSED_
|
||||
|
||||
void C4ObjectListDlg::Open()
|
||||
{
|
||||
|
|
|
@ -40,7 +40,7 @@ void C4BMPInfo::Set(int iWdt, int iHgt, int iBitDepth)
|
|||
{
|
||||
Default();
|
||||
// Set header
|
||||
Head.bfType=*((WORD*)"BM");
|
||||
Head.bfType=*((const WORD*)"BM");
|
||||
Head.bfSize=sizeof(BITMAPFILEHEADER)+sizeof(BITMAPINFOHEADER)+DWordAligned(iWdt)*iHgt;
|
||||
Head.bfOffBits=sizeof(BITMAPFILEHEADER)+sizeof(BITMAPINFOHEADER);
|
||||
// Set bitmap info
|
||||
|
@ -62,7 +62,7 @@ C4BMP256Info::C4BMP256Info()
|
|||
|
||||
bool C4BMP256Info::Valid()
|
||||
{
|
||||
if (Head.bfType != *((WORD*)"BM") ) return false;
|
||||
if (Head.bfType != *((const WORD*)"BM") ) return false;
|
||||
if ((Info.biBitCount!=8) || (Info.biCompression!=0)) return false;
|
||||
return true;
|
||||
}
|
||||
|
@ -76,7 +76,7 @@ void C4BMP256Info::Set(int iWdt, int iHgt, CStdPalette *Palette)
|
|||
{
|
||||
Default();
|
||||
// Set header
|
||||
Head.bfType=*((WORD*)"BM");
|
||||
Head.bfType=*((const WORD*)"BM");
|
||||
Head.bfSize=sizeof(BITMAPFILEHEADER)+sizeof(BITMAPINFOHEADER)+256*sizeof(RGBQUAD)+DWordAligned(iWdt)*iHgt;
|
||||
Head.bfOffBits=sizeof(BITMAPFILEHEADER)+sizeof(BITMAPINFOHEADER)+256*sizeof(RGBQUAD);
|
||||
// Set bitmap info
|
||||
|
|
|
@ -380,9 +380,9 @@ bool CStdFont::AddRenderedChar(uint32_t dwChar, C4Facet *pfctTarget)
|
|||
int at_x = iCurrentSfcX + Max(slot->bitmap_left,0);
|
||||
// Copy to the surface
|
||||
if (!sfcCurrent->Lock()) return false;
|
||||
for (int y = 0; y < slot->bitmap.rows + fDoShadow; ++y)
|
||||
for (unsigned int y = 0; y < slot->bitmap.rows + fDoShadow; ++y)
|
||||
{
|
||||
for (int x = 0; x < slot->bitmap.width + fDoShadow; ++x)
|
||||
for (unsigned int x = 0; x < slot->bitmap.width + fDoShadow; ++x)
|
||||
{
|
||||
unsigned char bAlpha, bAlphaShadow;
|
||||
if (x < slot->bitmap.width && y < slot->bitmap.rows)
|
||||
|
|
|
@ -198,7 +198,7 @@ int C4Shader::ParsePosition(const char *szWhat, const char **ppPos)
|
|||
|
||||
// Lookup name
|
||||
int iPosition = -1;
|
||||
for (int i = 0; i < sizeof(C4SH_PosNames) / sizeof(*C4SH_PosNames); i++) {
|
||||
for (unsigned int i = 0; i < sizeof(C4SH_PosNames) / sizeof(*C4SH_PosNames); i++) {
|
||||
if (SEqual(Name.getData(), C4SH_PosNames[i].Name)) {
|
||||
iPosition = C4SH_PosNames[i].Position;
|
||||
break;
|
||||
|
|
|
@ -129,7 +129,8 @@ void C4StartupNetListEntry::SetRefQuery(const char *szAddress, enum QueryType eQ
|
|||
// safety: clear previous
|
||||
ClearRef();
|
||||
// setup layout
|
||||
((C4Facet &) pIcon->GetFacet()) = (const C4Facet &) C4Startup::Get()->Graphics.fctNetGetRef;
|
||||
const_cast<C4Facet &>(reinterpret_cast<const C4Facet &>(pIcon->GetFacet()))
|
||||
= (const C4Facet &) C4Startup::Get()->Graphics.fctNetGetRef;
|
||||
pIcon->SetAnimated(true, 1);
|
||||
pIcon->SetBounds(rctIconLarge);
|
||||
// init a new ref client to query
|
||||
|
|
|
@ -1886,8 +1886,8 @@ bool C4NetIOUDP::InitBroadcast(addr_t *pBroadcastAddr)
|
|||
for (int iRetries = 1000; iRetries; iRetries--)
|
||||
{
|
||||
// create new - random - address
|
||||
MCAddr.sin_addr.s_addr = MCAddr.sin_addr.s_addr =
|
||||
0x000000ef | ((rand() & 0xff) << 24) | ((rand() & 0xff) << 16) | ((rand() & 0xff) << 8);
|
||||
MCAddr.sin_addr.s_addr =
|
||||
0x000000ef | ((rand() & 0xff) << 24) | ((rand() & 0xff) << 16) | ((rand() & 0xff) << 8);
|
||||
// init broadcast
|
||||
if (!C4NetIOSimpleUDP::InitBroadcast(&MCAddr))
|
||||
return false;
|
||||
|
@ -2634,7 +2634,7 @@ void C4NetIOUDP::Peer::OnRecv(const C4NetIOPacket &rPacket) // (mt-safe)
|
|||
}
|
||||
// set packet counter
|
||||
if (fBroadcasted)
|
||||
iRIMCPacketCounter = iRIMCPacketCounter = pPkt->Nr;
|
||||
iRIMCPacketCounter = iIMCPacketCounter = pPkt->Nr;
|
||||
else
|
||||
iRIPacketCounter = iIPacketCounter = pPkt->Nr;
|
||||
// clear incoming packets
|
||||
|
|
|
@ -153,7 +153,7 @@ bool C4AbstractApp::SetVideoMode(int iXRes, int iYRes, unsigned int iColorDepth,
|
|||
XRRScreenSize * sizes = XRRConfigSizes(conf, &n);
|
||||
for (int i = 0; i < n; ++i)
|
||||
{
|
||||
if (sizes[i].width == iXRes && sizes[i].height == iYRes)
|
||||
if (int(sizes[i].width) == iXRes && int(sizes[i].height) == iYRes)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
LogF("XRRSetScreenConfig %d", i);
|
||||
|
@ -204,46 +204,6 @@ bool C4AbstractApp::GetIndexedDisplayMode(int32_t iIndex, int32_t *piXRes, int32
|
|||
return false;
|
||||
}
|
||||
|
||||
static XRROutputInfo* GetXRROutputInfoForWindow(Display* dpy, Window w)
|
||||
{
|
||||
XRRScreenResources * r = XRRGetScreenResources(dpy, w);
|
||||
if (!r) return NULL;
|
||||
|
||||
XRROutputInfo * info = NULL;
|
||||
RROutput output = XRRGetOutputPrimary(dpy, w);
|
||||
if(output != 0)
|
||||
{
|
||||
info = XRRGetOutputInfo(dpy, r, output);
|
||||
if (!info)
|
||||
{
|
||||
XRRFreeScreenResources(r);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if(!info || info->connection == RR_Disconnected || info->crtc == 0)
|
||||
{
|
||||
// The default "primary" output does not seem to be connected
|
||||
// to a piece of actual hardware. As a fallback, go through
|
||||
// all outputs and choose the first active one.
|
||||
XRRFreeOutputInfo(info);
|
||||
info = NULL;
|
||||
for(int i = 0; i < r->noutput; ++i)
|
||||
{
|
||||
info = XRRGetOutputInfo(dpy, r, r->outputs[i]);
|
||||
if(info->connection != RR_Disconnected && info->crtc != 0)
|
||||
break;
|
||||
|
||||
XRRFreeOutputInfo(info);
|
||||
info = NULL;
|
||||
}
|
||||
}
|
||||
XRRFreeScreenResources(r);
|
||||
if(!info) return NULL;
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
// Copy the text to the clipboard or the primary selection
|
||||
bool C4AbstractApp::Copy(const StdStrBuf & text, bool fClipboard)
|
||||
{
|
||||
|
|
|
@ -74,13 +74,13 @@ bool C4FileMonitor::Execute(int iTimeout, pollfd * pfd) // some other thread
|
|||
uint32_t mask = event->mask;
|
||||
C4InteractiveThread &Thread = Application.InteractiveThread;
|
||||
if (mask & IN_CREATE)
|
||||
Thread.PushEvent(Ev_FileChange, (void*)file);
|
||||
Thread.PushEvent(Ev_FileChange, const_cast<char*>(file));
|
||||
if (mask & IN_MODIFY)
|
||||
Thread.PushEvent(Ev_FileChange, (void*)file);
|
||||
Thread.PushEvent(Ev_FileChange, const_cast<char*>(file));
|
||||
if (mask & IN_MOVED_TO)
|
||||
Thread.PushEvent(Ev_FileChange, (void*)file);
|
||||
Thread.PushEvent(Ev_FileChange, const_cast<char*>(file));
|
||||
if (mask & IN_MOVE_SELF)
|
||||
Thread.PushEvent(Ev_FileChange, (void*)file);
|
||||
Thread.PushEvent(Ev_FileChange, const_cast<char*>(file));
|
||||
// FIXME: (*(inotify_event*)buf).name);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -310,7 +310,7 @@ C4Value C4AulExec::Exec(C4AulBCC *pCPos, bool fPassErrors)
|
|||
if (!pPar2->_getInt())
|
||||
throw new C4AulExecError("division by zero");
|
||||
// INT_MIN/-1 cannot be represented in an int and would cause an uncaught exception
|
||||
if (pPar1->_getInt()==0x80000000 && pPar2->_getInt()==-1)
|
||||
if (pPar1->_getInt()==INT32_MIN && pPar2->_getInt()==-1)
|
||||
throw new C4AulExecError("division overflow");
|
||||
pPar1->SetInt(pPar1->_getInt() / pPar2->_getInt());
|
||||
PopValue();
|
||||
|
@ -329,7 +329,7 @@ C4Value C4AulExec::Exec(C4AulBCC *pCPos, bool fPassErrors)
|
|||
CheckOpPars(C4V_Int, C4V_Int, "%");
|
||||
C4Value *pPar1 = pCurVal - 1, *pPar2 = pCurVal;
|
||||
// INT_MIN%-1 cannot be represented in an int and would cause an uncaught exception
|
||||
if (pPar1->_getInt()==0x80000000 && pPar2->_getInt()==-1)
|
||||
if (pPar1->_getInt()==INT32_MIN && pPar2->_getInt()==-1)
|
||||
throw new C4AulExecError("modulo division overflow");
|
||||
if (pPar2->_getInt())
|
||||
pPar1->SetInt(pPar1->_getInt() % pPar2->_getInt());
|
||||
|
|
|
@ -57,11 +57,15 @@ C4String::C4String()
|
|||
C4String::~C4String()
|
||||
{
|
||||
// unreg
|
||||
#ifdef _DEBUG
|
||||
static bool remove = false;
|
||||
assert(!remove); (void)remove;
|
||||
remove = true;
|
||||
#endif
|
||||
Strings.Set.Remove(this);
|
||||
#ifdef _DEBUG
|
||||
remove = false;
|
||||
#endif
|
||||
}
|
||||
|
||||
void C4String::operator=(const char * s)
|
||||
|
|
Loading…
Reference in New Issue