I compile Code::Blocks in ANSI (non-Unicode) in order to get printf format warnings from time to time. I believe the Macro to handle Unicode string hides the warning.
Edit: Complied on 32 bit Window 7 version 6.1 with SP1
Here's a patch needed to remove a warning. Tim S.
Index: src/plugins/codecompletion/parser/token.h
===================================================================
--- src/plugins/codecompletion/parser/token.h (revision 7114)
+++ src/plugins/codecompletion/parser/token.h (working copy)
@@ -88,7 +88,7 @@
{
const long totalTime = it->first->m_StopWatch.Time();
wxString log;
- log.Printf(_T("\"%s\" used time is %d minute(s), %ld.%03ld seconds; call times is %d."),
+ log.Printf(_T("\"%s\" used time is %ld minute(s), %ld.%03ld seconds; call times is %d."),
it->second.wx_str(),
(totalTime / 60000),
(totalTime / 1000) % 60,
I will try the patch.
My Non-Unicode build has an problem in File Manager that I could not find the cause. (I am thinking it is wxWidgets 2.8.12 problem). Did find a possible solution.
src\plugins\contrib\FileManager\directorymonitor.cpp: In member function 'void DirMonitorThread::ReadChanges(DWORD, DWORD, MonData*)':
H:\SourceCode\OpenSourceCode\Apps\IDEs\CodeBlocks\codeblocks-wx28-SJLJ\src\plugins\contrib\FileManager\directorymonitor.cpp:473:74: error: call of overloaded 'wxString(WCHAR [1], long unsigned int)' is ambiguous
H:\SourceCode\OpenSourceCode\Libs\GUI\wxWidgets\wxWidgets-2.8.12\include/wx/string.h:1283:3: note: candidates are: wxString::wxString(const void*, const void*) <near match>
H:\SourceCode\OpenSourceCode\Libs\GUI\wxWidgets\wxWidgets-2.8.12\include/wx/string.h:694:3: note: wxString::wxString(size_t, wxChar) <near match>
H:\SourceCode\OpenSourceCode\Libs\GUI\wxWidgets\wxWidgets-2.8.12\include/wx/string.h:692:3: note: wxString::wxString(wxChar, size_t) <near match>
possible solution
Index: src/plugins/contrib/FileManager/directorymonitor.cpp
===================================================================
--- src/plugins/contrib/FileManager/directorymonitor.cpp (revision 7117)
+++ src/plugins/contrib/FileManager/directorymonitor.cpp (working copy)
@@ -470,7 +470,7 @@
}
if(action&m_notifyfilter)
{
- wxString filename(chptr->FileName,chptr->FileNameLength/2); //TODO: check the div by 2
+ wxString filename(wxString(chptr->FileName),chptr->FileNameLength/2); //TODO: check the div by 2
wxDirectoryMonitorEvent e(mondata->m_path,action,filename);
m_parent->AddPendingEvent(e);
}
Tim S.
stahta01:
Can you try this patch: http://developer.berlios.de/patch/?func=detailpatch&patch_id=3140&group_id=5358 and tell me if it is OK to apply it?
I don't have an ansi build of wxwidgets, so I can't test it myself.
Yes, the is OK for me. I just tested it by using it to compile Code::Blocks core.
I had to add this 32-bit patch in addition to remove all the printf non-unicode warnings; Please verify the C++ Casting is correct. I am mainly a C programmer. Note: The items to be printf were all size_t datatypes.
Index: src/plugins/contrib/source_exporter/wxPdfDocument/src/pdfkernel.cpp
===================================================================
--- src/plugins/contrib/source_exporter/wxPdfDocument/src/pdfkernel.cpp (revision 7117)
+++ src/plugins/contrib/source_exporter/wxPdfDocument/src/pdfkernel.cpp (working copy)
@@ -1033,8 +1033,8 @@
}
NewObj();
- OutAscii(wxString(wxT("<<")) + filter + wxString(wxT("/Length ")) +
- wxString::Format(wxT("%ld"), CalculateStreamLength(p->TellO())) + wxString(wxT(">>")));
+ OutAscii(wxString(wxT("<<")) + filter + wxString(wxT("/Length ")) +
+ wxString::Format(wxT("%lu"), static_cast<unsigned long>(CalculateStreamLength(p->TellO()))) + wxString(wxT(">>")));
PutStream(*p);
Out("endobj");
if (m_compress)
@@ -1202,7 +1202,7 @@
Out("/Decode[0 1 0 1 0 1 0 1 0 1]");
Out("/BitsPerFlag 8");
wxMemoryOutputStream* p = grad->GetBuffer();
- OutAscii(wxString::Format(wxT("/Length %ld"), CalculateStreamLength(p->TellO())));
+ OutAscii(wxString::Format(wxT("/Length %lu"), static_cast<unsigned long>(CalculateStreamLength(p->TellO()))));
Out(">>");
PutStream(*p);
Out("endobj");
@@ -1372,7 +1372,7 @@
wxMemoryOutputStream* p = new wxMemoryOutputStream();
/* size_t mapSize = */ font->WriteUnicodeMap(p);
size_t mapLen = CalculateStreamLength(p->TellO());
- OutAscii(wxString::Format(wxT("<</Length %ld"), mapLen));
+ OutAscii(wxString::Format(wxT("<</Length %lu"), static_cast<unsigned long>(mapLen)));
Out("/Filter /FlateDecode");
Out(">>");
PutStream(*p);
@@ -1477,7 +1477,7 @@
wxMemoryOutputStream* p = new wxMemoryOutputStream();
/* size_t mapSize = */ font->WriteUnicodeMap(p);
size_t mapLen = CalculateStreamLength(p->TellO());
- OutAscii(wxString::Format(wxT("<</Length %ld"), mapLen));
+ OutAscii(wxString::Format(wxT("<</Length %lu"), static_cast<unsigned long>(mapLen)));
if (compressed)
{
// Decompresses data encoded using the public-domain zlib/deflate compression
@@ -1770,7 +1770,7 @@
p = &(currentTemplate->m_buffer);
}
- OutAscii(wxString::Format(wxT("/Length %ld >>"), CalculateStreamLength(p->TellO())));
+ OutAscii(wxString::Format(wxT("/Length %lu >>"), static_cast<unsigned long>(CalculateStreamLength(p->TellO()))));
PutStream(*p);
Out("endobj");
if (m_compress)
@@ -2085,7 +2085,7 @@
wxString::Format(wxT("/I%d Do Q"), image->GetIndex());
wxMemoryOutputStream* p = new wxMemoryOutputStream;
p->Write(sdata.ToAscii(), sdata.Length());
- OutAscii(wxString(wxT("/Length ")) + wxString::Format(wxT("%ld"), CalculateStreamLength(p->TellO())));
+ OutAscii(wxString(wxT("/Length ")) + wxString::Format(wxT("%lu"), static_cast<unsigned long>(CalculateStreamLength(p->TellO()))));
Out(">>");
PutStream(*p);
delete p;
Tim S.