From 999836aacade840a5d9a0cbb5fad7b1d4de62c93 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 16 Oct 2003 10:28:15 +0000 Subject: [PATCH] warning fixes for BCC and OW (heavily modified patch 819146) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@24196 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/dlgcmn.cpp | 7 +------ src/common/docmdi.cpp | 8 +++----- src/common/docview.cpp | 16 ++++++++-------- src/common/dynlib.cpp | 1 + src/common/encconv.cpp | 2 +- src/common/filefn.cpp | 19 +++++++++---------- src/common/ftp.cpp | 18 +++++------------- src/common/imagbmp.cpp | 19 +++++++------------ src/common/image.cpp | 6 +++--- src/common/imagjpeg.cpp | 1 - src/common/imagpng.cpp | 30 ++++++++++++++++-------------- src/common/intl.cpp | 6 +++++- src/common/prntbase.cpp | 6 ------ src/common/quantize.cpp | 11 +++-------- src/common/sckipc.cpp | 3 +-- src/common/socket.cpp | 5 +++-- src/common/strconv.cpp | 5 +++-- src/common/stream.cpp | 2 +- src/common/txtstrm.cpp | 3 +-- src/common/url.cpp | 9 +++------ src/common/zipstrm.cpp | 2 +- src/generic/calctrl.cpp | 6 ++---- src/generic/colrdlgg.cpp | 1 - src/generic/dcpsg.cpp | 21 +++++++++------------ src/generic/dirctrlg.cpp | 5 ++--- src/generic/filedlgg.cpp | 9 ++++----- src/generic/fontdlgg.cpp | 12 ++++-------- src/generic/grid.cpp | 21 +++++++-------------- src/generic/gridsel.cpp | 1 - src/generic/imaglist.cpp | 20 +++++++++----------- src/generic/listctrl.cpp | 29 +++++++---------------------- src/generic/logg.cpp | 2 +- src/generic/printps.cpp | 2 +- src/generic/sashwin.cpp | 12 ++---------- src/generic/splitter.cpp | 4 ++-- src/generic/treectlg.cpp | 15 +++------------ src/generic/vlbox.cpp | 3 ++- src/generic/vscroll.cpp | 2 +- src/html/helpfrm.cpp | 2 +- src/html/htmlcell.cpp | 5 +---- src/html/htmltag.cpp | 6 +++--- src/html/htmprint.cpp | 2 ++ src/html/m_pre.cpp | 9 ++++++--- src/msw/bitmap.cpp | 7 ++----- src/msw/dc.cpp | 11 +++-------- src/msw/dcclient.cpp | 3 +-- src/msw/dcprint.cpp | 5 +++-- src/msw/gdiimage.cpp | 3 ++- src/msw/gsocket.c | 1 - src/msw/iniconf.cpp | 1 + src/msw/mimetype.cpp | 21 ++++++++++----------- src/msw/pen.cpp | 3 +-- src/msw/taskbar.cpp | 3 +-- src/msw/thread.cpp | 2 +- src/msw/toplevel.cpp | 2 +- src/msw/utils.cpp | 2 +- src/msw/utilsexc.cpp | 2 +- src/msw/volume.cpp | 2 +- src/msw/window.cpp | 2 +- src/univ/textctrl.cpp | 2 +- src/univ/themes/win32.cpp | 1 - src/univ/topluniv.cpp | 2 +- 62 files changed, 176 insertions(+), 267 deletions(-) diff --git a/src/common/dlgcmn.cpp b/src/common/dlgcmn.cpp index 82501e0..e53b164 100644 --- a/src/common/dlgcmn.cpp +++ b/src/common/dlgcmn.cpp @@ -172,14 +172,9 @@ wxSizer *wxDialogBase::CreateButtonSizer( long flags ) { bool is_pda = (wxSystemSettings::GetScreenType() <= wxSYS_SCREEN_PDA); - wxBoxSizer *box = NULL; - // If we have a PDA screen, put yes/no button over // all other buttons, otherwise on the left side. - if (is_pda) - box = new wxBoxSizer( wxVERTICAL ); - else - box = new wxBoxSizer( wxHORIZONTAL ); + wxBoxSizer *box = is_pda ? new wxBoxSizer( wxVERTICAL ) : new wxBoxSizer( wxHORIZONTAL ); wxBoxSizer *inner_yes_no = NULL; diff --git a/src/common/docmdi.cpp b/src/common/docmdi.cpp index 4d6141d..281953a 100644 --- a/src/common/docmdi.cpp +++ b/src/common/docmdi.cpp @@ -165,11 +165,9 @@ void wxDocMDIChildFrame::OnCloseWindow(wxCloseEvent& event) // ...since it will be deleted by wxWindows if we return TRUE. if (m_childView) { - bool ans = FALSE; - if (!event.CanVeto()) - ans = TRUE; // Must delete. - else - ans = m_childView->Close(FALSE); // FALSE means don't delete associated window + bool ans = event.CanVeto() + ? m_childView->Close(FALSE) // FALSE means don't delete associated window + : TRUE; // Must delete. if (ans) { diff --git a/src/common/docview.cpp b/src/common/docview.cpp index bc34f64..8e8c012 100644 --- a/src/common/docview.cpp +++ b/src/common/docview.cpp @@ -952,8 +952,7 @@ void wxDocManager::OnPreview(wxCommandEvent& WXUNUSED(event)) if (printout) { // Pass two printout objects: for preview, and possible printing. - wxPrintPreviewBase *preview = (wxPrintPreviewBase *) NULL; - preview = new wxPrintPreview(printout, view->OnCreatePrintout()); + wxPrintPreviewBase *preview = new wxPrintPreview(printout, view->OnCreatePrintout()); wxPreviewFrame *frame = new wxPreviewFrame(preview, (wxFrame *)wxTheApp->GetTopWindow(), _("Print Preview"), wxPoint(100, 100), wxSize(600, 650)); @@ -1175,7 +1174,7 @@ wxDocument *wxDocManager::CreateDocument(const wxString& path, long flags) } // Existing document - wxDocTemplate *temp = (wxDocTemplate *) NULL; + wxDocTemplate *temp; wxString path2(wxT("")); if (path != wxT("")) @@ -1788,11 +1787,9 @@ void wxDocChildFrame::OnCloseWindow(wxCloseEvent& event) { if (m_childView) { - bool ans = FALSE; - if (!event.CanVeto()) - ans = TRUE; // Must delete. - else - ans = m_childView->Close(FALSE); // FALSE means don't delete associated window + bool ans = event.CanVeto() + ? m_childView->Close(FALSE) // FALSE means don't delete associated window + : TRUE; // Must delete. if (ans) { @@ -1906,8 +1903,10 @@ bool wxDocPrintout::OnPrintPage(int WXUNUSED(page)) // Get the logical pixels per inch of screen and printer int ppiScreenX, ppiScreenY; GetPPIScreen(&ppiScreenX, &ppiScreenY); + wxUnusedVar(ppiScreenY); int ppiPrinterX, ppiPrinterY; GetPPIPrinter(&ppiPrinterX, &ppiPrinterY); + wxUnusedVar(ppiPrinterY); // This scales the DC so that the printout roughly represents the // the screen scaling. The text point size _should_ be the right size @@ -1922,6 +1921,7 @@ bool wxDocPrintout::OnPrintPage(int WXUNUSED(page)) int w, h; dc->GetSize(&w, &h); GetPageSizePixels(&pageWidth, &pageHeight); + wxUnusedVar(pageHeight); // If printer pageWidth == current DC width, then this doesn't // change. But w might be the preview bitmap width, so scale down. diff --git a/src/common/dynlib.cpp b/src/common/dynlib.cpp index ab4178d..167249a 100644 --- a/src/common/dynlib.cpp +++ b/src/common/dynlib.cpp @@ -326,6 +326,7 @@ void *wxDynamicLibrary::GetSymbol(const wxString &name, bool *success) const bool failed = FALSE; void *symbol = 0; + wxUnusedVar(symbol); #if defined(__WXMAC__) && !defined(__DARWIN__) Ptr symAddress; CFragSymbolClass symClass; diff --git a/src/common/encconv.cpp b/src/common/encconv.cpp index 5605b46..b444d07 100644 --- a/src/common/encconv.cpp +++ b/src/common/encconv.cpp @@ -89,7 +89,7 @@ wxEncodingConverter::wxEncodingConverter() bool wxEncodingConverter::Init(wxFontEncoding input_enc, wxFontEncoding output_enc, int method) { unsigned i; - wxUint16 *in_tbl = NULL, *out_tbl = NULL; + wxUint16 *in_tbl, *out_tbl = NULL; if (m_Table) {delete[] m_Table; m_Table = NULL;} diff --git a/src/common/filefn.cpp b/src/common/filefn.cpp index 8c6e4a7..9c7e099 100644 --- a/src/common/filefn.cpp +++ b/src/common/filefn.cpp @@ -325,8 +325,7 @@ wxString wxPathList::FindValidPath (const wxString& file) wxChar buf[_MAXPATHLEN]; wxStrcpy(buf, wxFileFunctionsBuffer); - wxChar *filename = (wxChar*) NULL; /* shut up buggy egcs warning */ - filename = wxIsAbsolutePath (buf) ? wxFileNameFromPath (buf) : (wxChar *)buf; + wxChar *filename = wxIsAbsolutePath (buf) ? wxFileNameFromPath (buf) : (wxChar *)buf; for (wxStringList::compatibility_iterator node = GetFirst(); node; node = node->GetNext()) { @@ -732,9 +731,9 @@ wxContractPath (const wxString& filename, const wxString& envname, const wxStrin #endif // Handle environment - const wxChar *val = (const wxChar *) NULL; + const wxChar *val; #ifndef __WXWINCE__ - wxChar *tcp = (wxChar *) NULL; + wxChar *tcp; if (envname != WXSTRINGCAST NULL && (val = wxGetenv (WXSTRINGCAST envname)) != NULL && (tcp = wxStrstr (dest, val)) != NULL) { @@ -748,7 +747,7 @@ wxContractPath (const wxString& filename, const wxString& envname, const wxStrin #endif // Handle User's home (ignore root homes!) - size_t len = 0; + size_t len; if ((val = wxGetUserHome (user)) != NULL && (len = wxStrlen(val)) > 2 && wxStrncmp(dest, val, len) == 0) @@ -1144,9 +1143,9 @@ wxConcatFiles (const wxString& file1, const wxString& file2, const wxString& fil if ( !wxGetTempFileName( wxT("cat"), outfile) ) return FALSE; - FILE *fp1 = (FILE *) NULL; - FILE *fp2 = (FILE *) NULL; - FILE *fp3 = (FILE *) NULL; + FILE *fp1 wxDUMMY_INITIALIZE(NULL); + FILE *fp2 wxDUMMY_INITIALIZE(NULL); + FILE *fp3 wxDUMMY_INITIALIZE(NULL); // Open the inputs and outputs if ((fp1 = wxFopen ( file1, wxT("rb"))) == NULL || (fp2 = wxFopen ( file2, wxT("rb"))) == NULL || @@ -1454,7 +1453,7 @@ wxString wxFindFirstFile(const wxChar *spec, int flags) return wxEmptyString; } - int dirFlags = 0; + int dirFlags; switch (flags) { case wxDIR: dirFlags = wxDIR_DIRS; break; @@ -1503,7 +1502,7 @@ wxChar *wxGetWorkingDirectory(wxChar *buf, int sz) buf = new wxChar[sz + 1]; } - bool ok = FALSE; + bool ok wxDUMMY_INITIALIZE(FALSE); // for the compilers which have Unicode version of _getcwd(), call it // directly, for the others call the ANSI version and do the translation diff --git a/src/common/ftp.cpp b/src/common/ftp.cpp index 58567d8..83f419d 100644 --- a/src/common/ftp.cpp +++ b/src/common/ftp.cpp @@ -804,7 +804,9 @@ int wxFTP::GetFileSize(const wxString& fileName) SetTransferMode(oldTransfermode); } - if ( !ok ) // this is not a direct else clause.. The size command might return an invalid "2yz" reply + // this is not a direct else clause.. The size command might return an + // invalid "2yz" reply + if ( !ok ) { // The server didn't understand the "SIZE"-command or it // returned an invalid reply. @@ -849,12 +851,7 @@ int wxFTP::GetFileSize(const wxString& fileName) if ( wxSscanf(fileList[i].c_str(), _T("%*s %*s %*s %*s %i %*s %*s %*s %*s"), - &filesize) == 9 ) - { - // We've gotten a good response - ok = TRUE; - } - else + &filesize) != 9 ) { // Hmm... Invalid response wxLogTrace(FTP_TRACE_MASK, @@ -865,12 +862,7 @@ int wxFTP::GetFileSize(const wxString& fileName) { if ( wxSscanf(fileList[i].c_str(), _T("%*s %*s %i %*s"), - &filesize) == 4 ) - { - // valid response - ok = TRUE; - } - else + &filesize) != 4 ) { // something bad happened..? wxLogTrace(FTP_TRACE_MASK, diff --git a/src/common/imagbmp.cpp b/src/common/imagbmp.cpp index 7570226..0e2ab30 100644 --- a/src/common/imagbmp.cpp +++ b/src/common/imagbmp.cpp @@ -459,7 +459,7 @@ bool wxBMPHandler::DoLoadDib(wxImage * image, int width, int height, wxUint16 aWord; // allocate space for palette if needed: - _cmap *cmap = NULL; + _cmap *cmap; if ( bpp < 16 ) { @@ -602,27 +602,23 @@ bool wxBMPHandler::DoLoadDib(wxImage * image, int width, int height, ptr = data; } - int line = 0; - int column = 0; int linesize = ((width * bpp + 31) / 32) * 4; /* BMPs are stored upside down */ - for ( line = (height - 1); line >= 0; line-- ) + for ( int line = (height - 1); line >= 0; line-- ) { int linepos = 0; - for ( column = 0; column < width ; ) + for ( int column = 0; column < width ; ) { if ( bpp < 16 ) { - int index = 0; linepos++; aByte = stream.GetC(); if ( bpp == 1 ) { - int bit = 0; - for (bit = 0; bit < 8 && column < width; bit++) + for (int bit = 0; bit < 8 && column < width; bit++) { - index = ((aByte & (0x80 >> bit)) ? 1 : 0); + int index = ((aByte & (0x80 >> bit)) ? 1 : 0); ptr[poffset] = cmap[index].r; ptr[poffset + 1] = cmap[index].g; ptr[poffset + 2] = cmap[index].b; @@ -700,10 +696,9 @@ bool wxBMPHandler::DoLoadDib(wxImage * image, int width, int height, } else { - int nibble = 0; - for (nibble = 0; nibble < 2 && column < width; nibble++) + for (int nibble = 0; nibble < 2 && column < width; nibble++) { - index = ((aByte & (0xF0 >> nibble * 4)) >> (!nibble * 4)); + int index = ((aByte & (0xF0 >> nibble * 4)) >> (!nibble * 4)); if ( index >= 16 ) index = 15; ptr[poffset] = cmap[index].r; diff --git a/src/common/image.cpp b/src/common/image.cpp index b24e451..a5f3c35 100644 --- a/src/common/image.cpp +++ b/src/common/image.cpp @@ -1804,8 +1804,8 @@ wxImage wxImage::Rotate(double angle, const wxPoint & centre_of_rotation, bool i w3 * *(v3++) + w4 * *(v4++)) / (w1 + w2 + w3 + w4) ); *(dst++) = (unsigned char) - ( (w1 * *(v1++) + w2 * *(v2++) + - w3 * *(v3++) + w4 * *(v4++)) / + ( (w1 * *v1 + w2 * *v2 + + w3 * *v3 + w4 * *v4) / (w1 + w2 + w3 + w4) ); } } @@ -1835,7 +1835,7 @@ wxImage wxImage::Rotate(double angle, const wxPoint & centre_of_rotation, bool i unsigned char *p = data[ys] + (3 * xs); *(dst++) = *(p++); *(dst++) = *(p++); - *(dst++) = *(p++); + *(dst++) = *p; } else { diff --git a/src/common/imagjpeg.cpp b/src/common/imagjpeg.cpp index 4173a9b..a35e1e5 100644 --- a/src/common/imagjpeg.cpp +++ b/src/common/imagjpeg.cpp @@ -178,7 +178,6 @@ void jpeg_wxio_src( j_decompress_ptr cinfo, wxInputStream& infile ) cinfo->src = (struct jpeg_source_mgr *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, sizeof(my_source_mgr)); - src = (my_src_ptr) cinfo->src; } src = (my_src_ptr) cinfo->src; src->pub.bytes_in_buffer = 0; /* forces fill_input_buffer on first read */ diff --git a/src/common/imagpng.cpp b/src/common/imagpng.cpp index 151d3c9..d0da8f6 100644 --- a/src/common/imagpng.cpp +++ b/src/common/imagpng.cpp @@ -460,25 +460,27 @@ void CopyDataFromPNG(wxImage *image, case Transparency_Mask: if ( IsTransparent(a) ) { - // if we couldn't find a unique colour for the mask, we - // can have real pixels with the same value as the mask - // and it's better to slightly change their colour than - // to make them transparent - if ( r == rMask && g == gMask && b == bMask ) - { - r++; - } - *ptrDst++ = rMask; *ptrDst++ = bMask; *ptrDst++ = gMask; break; } - // else: !transparent - - // must be opaque then as otherwise we shouldn't be - // using the mask at all - wxASSERT_MSG( IsOpaque(a), _T("logic error") ); + else // !transparent + { + // must be opaque then as otherwise we shouldn't be + // using the mask at all + wxASSERT_MSG( IsOpaque(a), _T("logic error") ); + + // if we couldn't find a unique colour for the + // mask, we can have real pixels with the same + // value as the mask and it's better to slightly + // change their colour than to make them + // transparent + if ( r == rMask && g == gMask && b == bMask ) + { + r++; + } + } // fall through diff --git a/src/common/intl.cpp b/src/common/intl.cpp index 36c76c3..17900a6 100644 --- a/src/common/intl.cpp +++ b/src/common/intl.cpp @@ -1566,7 +1566,11 @@ bool wxLocale::Init(int language, int flags) } else { - int codepage = -1; + int codepage + #ifdef SETLOCALE_FAILS_ON_UNICODE_LANGS + = -1 + #endif + ; wxUint32 lcid = MAKELCID(MAKELANGID(info->WinLang, info->WinSublang), SORT_DEFAULT); // FIXME diff --git a/src/common/prntbase.cpp b/src/common/prntbase.cpp index c16bc4f..c047f6d 100644 --- a/src/common/prntbase.cpp +++ b/src/common/prntbase.cpp @@ -772,12 +772,6 @@ bool wxPrintPreviewBase::RenderPage(int pageNum) int actualWidth = (int)(zoomScale*m_pageWidth*m_previewScale); int actualHeight = (int)(zoomScale*m_pageHeight*m_previewScale); - int x = (int)((canvasWidth - actualWidth)/2.0); - if (x < m_leftMargin) - x = m_leftMargin; - // int y = m_topMargin; - - if (!m_previewBitmap) { m_previewBitmap = new wxBitmap((int)actualWidth, (int)actualHeight); diff --git a/src/common/quantize.cpp b/src/common/quantize.cpp index 7366197..55fe0fc 100644 --- a/src/common/quantize.cpp +++ b/src/common/quantize.cpp @@ -1302,7 +1302,6 @@ start_pass_2_quant (j_decompress_ptr cinfo, bool is_pre_scan) { my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize; hist3d histogram = cquantize->histogram; - int i; if (is_pre_scan) { /* Set up method pointers */ @@ -1314,9 +1313,6 @@ start_pass_2_quant (j_decompress_ptr cinfo, bool is_pre_scan) cquantize->pub.color_quantize = pass2_fs_dither; cquantize->pub.finish_pass = finish_pass2; - /* Make sure color count is acceptable */ - i = cinfo->actual_number_of_colors; - { size_t arraysize = (size_t) ((cinfo->output_width + 2) * (3 * sizeof(FSERROR))); @@ -1334,7 +1330,7 @@ start_pass_2_quant (j_decompress_ptr cinfo, bool is_pre_scan) } /* Zero the histogram or inverse color map, if necessary */ if (cquantize->needs_zeroed) { - for (i = 0; i < HIST_C0_ELEMS; i++) { + for (int i = 0; i < HIST_C0_ELEMS; i++) { memset((void *) histogram[i], 0, HIST_C1_ELEMS*HIST_C2_ELEMS * sizeof(histcell)); } @@ -1510,8 +1506,6 @@ bool wxQuantize::Quantize(const wxImage& src, wxImage& dest, { int i; - int w = src.GetWidth(); - int h = src.GetHeight(); int windowsSystemColourCount = 20; @@ -1529,8 +1523,9 @@ bool wxQuantize::Quantize(const wxImage& src, wxImage& dest, #endif // create rows info: + int h = src.GetHeight(); + int w = src.GetWidth(); unsigned char **rows = new unsigned char *[h]; - h = src.GetHeight(), w = src.GetWidth(); unsigned char *imgdt = src.GetData(); for (i = 0; i < h; i++) rows[i] = imgdt + 3/*RGB*/ * w * i; diff --git a/src/common/sckipc.cpp b/src/common/sckipc.cpp index 1c68aa5..03e8f09 100644 --- a/src/common/sckipc.cpp +++ b/src/common/sckipc.cpp @@ -531,7 +531,6 @@ void wxTCPEventHandler::Client_OnRequest(wxSocketEvent &event) if (!connection) return; - int msg = 0; wxDataInputStream *codeci; wxDataOutputStream *codeco; wxSocketStream *sockstrm; @@ -551,7 +550,7 @@ void wxTCPEventHandler::Client_OnRequest(wxSocketEvent &event) codeci = connection->m_codeci; codeco = connection->m_codeco; sockstrm = connection->m_sockstrm; - msg = codeci->Read8(); + int msg = codeci->Read8(); switch (msg) { diff --git a/src/common/socket.cpp b/src/common/socket.cpp index f6d8b24..3706c62 100644 --- a/src/common/socket.cpp +++ b/src/common/socket.cpp @@ -303,7 +303,6 @@ wxSocketBase& wxSocketBase::Read(void* buffer, wxUint32 nbytes) wxUint32 wxSocketBase::_Read(void* buffer, wxUint32 nbytes) { int total; - int ret = 1; // Try the pushback buffer first total = GetPushback(buffer, nbytes, FALSE); @@ -325,6 +324,7 @@ wxUint32 wxSocketBase::_Read(void* buffer, wxUint32 nbytes) // wxSOCKET_BLOCK // wxSOCKET_NONE // + int ret; if (m_flags & wxSOCKET_NOWAIT) { GSocket_SetNonBlocking(m_socket, 1); @@ -504,7 +504,6 @@ wxSocketBase& wxSocketBase::Write(const void *buffer, wxUint32 nbytes) wxUint32 wxSocketBase::_Write(const void *buffer, wxUint32 nbytes) { wxUint32 total = 0; - int ret = 1; // If the socket is invalid or parameters are ill, return immediately if (!m_socket || !buffer || !nbytes) @@ -516,6 +515,7 @@ wxUint32 wxSocketBase::_Write(const void *buffer, wxUint32 nbytes) // wxSOCKET_BLOCK // wxSOCKET_NONE // + int ret; if (m_flags & wxSOCKET_NOWAIT) { GSocket_SetNonBlocking(m_socket, 1); @@ -930,6 +930,7 @@ void wxSocketBase::OnRequest(wxSocketNotify notification) // Schedule the event wxSocketEventFlags flag = 0; + wxUnusedVar(flag); switch (notification) { case GSOCK_INPUT: flag = GSOCK_INPUT_FLAG; break; diff --git a/src/common/strconv.cpp b/src/common/strconv.cpp index d2c107e..f13005c 100644 --- a/src/common/strconv.cpp +++ b/src/common/strconv.cpp @@ -111,7 +111,8 @@ static size_t encode_utf16(wxUint32 input, wxUint16 *output) { if (input<=0xffff) { - if (output) *output++ = (wxUint16) input; + if (output) + *output = (wxUint16) input; return 1; } else if (input>=0x110000) @@ -123,7 +124,7 @@ static size_t encode_utf16(wxUint32 input, wxUint16 *output) if (output) { *output++ = (wxUint16) ((input >> 10)+0xd7c0); - *output++ = (wxUint16) ((input&0x3ff)+0xdc00); + *output = (wxUint16) ((input&0x3ff)+0xdc00); } return 2; } diff --git a/src/common/stream.cpp b/src/common/stream.cpp index a612185..1f72c00 100644 --- a/src/common/stream.cpp +++ b/src/common/stream.cpp @@ -454,7 +454,7 @@ size_t wxStreamBuffer::Write(const void *buffer, size_t size) m_stream->Reset(); } - size_t ret = 0; + size_t ret; if ( !HasBuffer() && m_fixed ) { diff --git a/src/common/txtstrm.cpp b/src/common/txtstrm.cpp index 36fab02..27b0b6c 100644 --- a/src/common/txtstrm.cpp +++ b/src/common/txtstrm.cpp @@ -97,10 +97,9 @@ wxChar wxTextInputStream::NextChar() wxChar wxTextInputStream::NextNonSeparators() { - wxChar c = (wxChar) 0; for (;;) { - c = NextChar(); + wxChar c = NextChar(); if (c == wxEOT) return (wxChar) 0; if (c != wxT('\n') && diff --git a/src/common/url.cpp b/src/common/url.cpp index bccda3d..e265e0c 100644 --- a/src/common/url.cpp +++ b/src/common/url.cpp @@ -272,8 +272,6 @@ bool wxURL::FetchProtocol() wxInputStream *wxURL::GetInputStream() { - wxInputStream *the_i_stream = NULL; - if (!m_protocol) { m_error = wxURL_NOPROTO; @@ -310,10 +308,9 @@ wxInputStream *wxURL::GetInputStream() #endif // When we use a proxy, we have to pass the whole URL to it. - if (m_useProxy) - the_i_stream = m_protocol->GetInputStream(m_url); - else - the_i_stream = m_protocol->GetInputStream(m_path); + wxInputStream *the_i_stream = + (m_useProxy) ? m_protocol->GetInputStream(m_url) : + m_protocol->GetInputStream(m_path); if (!the_i_stream) { diff --git a/src/common/zipstrm.cpp b/src/common/zipstrm.cpp index 6a7ebb1..d3053e3 100644 --- a/src/common/zipstrm.cpp +++ b/src/common/zipstrm.cpp @@ -122,7 +122,7 @@ off_t wxZipInputStream::OnSysSeek(off_t seek, wxSeekMode mode) default : nextpos = m_Pos; break; /* just to fool compiler, never happens */ } - size_t toskip = 0; + size_t toskip; if ( nextpos > m_Pos ) { toskip = nextpos - m_Pos; diff --git a/src/generic/calctrl.cpp b/src/generic/calctrl.cpp index bf6dea6..7ab4f77 100644 --- a/src/generic/calctrl.cpp +++ b/src/generic/calctrl.cpp @@ -668,11 +668,9 @@ bool wxCalendarCtrl::IsDateShown(const wxDateTime& date) const bool wxCalendarCtrl::IsDateInRange(const wxDateTime& date) const { - bool retval = TRUE; // Check if the given date is in the range specified - retval = ( ( ( m_lowdate.IsValid() ) ? ( date >= m_lowdate ) : TRUE ) + return ( ( ( m_lowdate.IsValid() ) ? ( date >= m_lowdate ) : TRUE ) && ( ( m_highdate.IsValid() ) ? ( date <= m_highdate ) : TRUE ) ); - return retval; } bool wxCalendarCtrl::ChangeYear(wxDateTime* target) const @@ -1371,7 +1369,7 @@ bool wxCalendarCtrl::GetDateCoord(const wxDateTime& date, int *day, int *week) c } else { - day += ( startOnMonday ) ? 0 : 1; + *day += ( startOnMonday ) ? 0 : 1; } int targetmonth = date.GetMonth() + (12 * date.GetYear()); diff --git a/src/generic/colrdlgg.cpp b/src/generic/colrdlgg.cpp index 494858f..99b3286 100644 --- a/src/generic/colrdlgg.cpp +++ b/src/generic/colrdlgg.cpp @@ -339,7 +339,6 @@ void wxGenericColourDialog::InitializeColours(void) { whichKind = 2; colourSelection = i; - initColourFound = TRUE; break; } } diff --git a/src/generic/dcpsg.cpp b/src/generic/dcpsg.cpp index 9202e61..a4e87ee 100644 --- a/src/generic/dcpsg.cpp +++ b/src/generic/dcpsg.cpp @@ -725,11 +725,7 @@ void wxPostScriptDC::DoDrawRoundedRectangle (wxCoord x, wxCoord y, wxCoord width { // Now, a negative radius is interpreted to mean // 'the proportion of the smallest X or Y dimension' - double smallest = 0.0; - if (width < height) - smallest = width; - else - smallest = height; + double smallest = width < height ? width : height; radius = (-radius * smallest); } @@ -962,8 +958,6 @@ void wxPostScriptDC::SetFont( const wxFont& font ) case wxSCRIPT: { name = "/ZapfChancery-MediumItalic"; - Style = wxNORMAL; - Weight = wxNORMAL; break; } case wxSWISS: @@ -1046,7 +1040,8 @@ void wxPostScriptDC::SetPen( const wxPen& pen ) static const char *wxCoord_dashed = "[4 8] 2"; static const char *dotted_dashed = "[6 6 2 6] 4"; - const char *psdash = (char *) NULL; + const char *psdash; + switch (m_pen.GetStyle()) { case wxDOT: psdash = dotted; break; @@ -1651,7 +1646,8 @@ void wxPostScriptDC::DoDrawSpline( wxList *points ) CalcBoundingBox( (wxCoord)x1, (wxCoord)y1 ); CalcBoundingBox( (wxCoord)x3, (wxCoord)y3 ); - while ((node = node->GetNext())) + node = node->GetNext(); + while (node) { q = (wxPoint *)node->GetData(); @@ -1673,6 +1669,8 @@ void wxPostScriptDC::DoDrawSpline( wxList *points ) CalcBoundingBox( (wxCoord)x1, (wxCoord)y1 ); CalcBoundingBox( (wxCoord)x3, (wxCoord)y3 ); + + node = node->GetNext(); } /* @@ -2194,7 +2192,7 @@ void wxPostScriptDC::DoGetTextExtent(const wxString& string, lastStyle = Style; lastWeight = Weight; - const wxChar *name = NULL; + const wxChar *name; switch (Family) { @@ -2218,8 +2216,7 @@ void wxPostScriptDC::DoGetTextExtent(const wxString& string, case wxSCRIPT: { name = wxT("Zapf.afm"); - Style = wxNORMAL; - Weight = wxNORMAL; + break; } case wxSWISS: default: diff --git a/src/generic/dirctrlg.cpp b/src/generic/dirctrlg.cpp index 6b8b1d6..41b405c 100644 --- a/src/generic/dirctrlg.cpp +++ b/src/generic/dirctrlg.cpp @@ -125,7 +125,7 @@ size_t wxGetAvailableDrives(wxArrayString &paths, wxArrayString &names, wxArrayI path.Printf(wxT("%c:\\"), driveBuffer[i]); name.Printf(wxT("%c:"), driveBuffer[i]); - int imageId = wxFileIconsTable::drive; + int imageId; int driveType = ::GetDriveType(path); switch (driveType) { @@ -1206,8 +1206,7 @@ void wxDirFilterListCtrl::FillFilterList(const wxString& filter, int defaultFilt if (n > 0 && defaultFilter < (int) n) { - size_t i = 0; - for (i = 0; i < n; i++) + for (size_t i = 0; i < n; i++) Append(descriptions[i]); SetSelection(defaultFilter); } diff --git a/src/generic/filedlgg.cpp b/src/generic/filedlgg.cpp index 3d0b66d..2c09334 100644 --- a/src/generic/filedlgg.cpp +++ b/src/generic/filedlgg.cpp @@ -490,7 +490,6 @@ void wxFileCtrl::UpdateFiles() FreeAllItemsData(); DeleteAllItems(); - wxFileData *fd = (wxFileData *) NULL; wxListItem item; item.m_itemId = 0; item.m_col = 0; @@ -504,7 +503,7 @@ void wxFileCtrl::UpdateFiles() for (n=0; nGetStringSelection()); - int fontWeight = 0; - fontWeight = wxFontWeightStringToInt(WXSTRINGCAST weightChoice->GetStringSelection()); - int fontStyle = 0; - fontStyle = wxFontStyleStringToInt(WXSTRINGCAST styleChoice->GetStringSelection()); + int fontFamily = wxFontFamilyStringToInt(WXSTRINGCAST familyChoice->GetStringSelection()); + int fontWeight = wxFontWeightStringToInt(WXSTRINGCAST weightChoice->GetStringSelection()); + int fontStyle = wxFontStyleStringToInt(WXSTRINGCAST styleChoice->GetStringSelection()); int fontSize = wxAtoi(pointSizeChoice->GetStringSelection()); int fontUnderline = underLineCheckBox->GetValue(); @@ -342,8 +339,7 @@ void wxGenericFontDialog::OnChangeFont(wxCommandEvent& WXUNUSED(event)) m_previewer->SetFont(dialogFont); if (colourChoice->GetStringSelection() != wxT("")) { - wxColour *col = (wxColour*) NULL; - col = wxTheColourDatabase->FindColour(colourChoice->GetStringSelection()); + wxColour *col = wxTheColourDatabase->FindColour(colourChoice->GetStringSelection()); if (col) { m_fontData.m_fontColour = *col; diff --git a/src/generic/grid.cpp b/src/generic/grid.cpp index d23afe3..ef6d26c 100644 --- a/src/generic/grid.cpp +++ b/src/generic/grid.cpp @@ -1961,10 +1961,9 @@ wxSize wxGridCellBoolRenderer::GetBestSize(wxGrid& grid, if ( !ms_sizeCheckMark.x ) { // get checkbox size - wxCoord checkSize = 0; wxCheckBox *checkbox = new wxCheckBox(&grid, -1, wxEmptyString); wxSize size = checkbox->GetBestSize(); - checkSize = size.y + 2*wxGRID_CHECKMARK_MARGIN; + wxCoord checkSize = size.y + 2*wxGRID_CHECKMARK_MARGIN; // FIXME wxGTK::wxCheckBox::GetBestSize() gives "wrong" result #if defined(__WXGTK__) || defined(__WXMOTIF__) @@ -2584,13 +2583,9 @@ wxGridCellAttr *wxGridCellAttrProvider::GetAttr(int row, int col, { //Basicaly implement old version. //Also check merge cache, so we don't have to re-merge every time.. - wxGridCellAttr *attrcell = (wxGridCellAttr *)NULL, - *attrrow = (wxGridCellAttr *)NULL, - *attrcol = (wxGridCellAttr *)NULL; - - attrcell = m_data->m_cellAttrs.GetAttr(row, col); - attrcol = m_data->m_colAttrs.GetAttr(col); - attrrow = m_data->m_rowAttrs.GetAttr(row); + wxGridCellAttr *attrcell = m_data->m_cellAttrs.GetAttr(row, col); + wxGridCellAttr *attrrow = m_data->m_rowAttrs.GetAttr(row); + wxGridCellAttr *attrcol = m_data->m_colAttrs.GetAttr(col); if((attrcell != attrrow) && (attrrow !=attrcol) && (attrcell != attrcol)){ // Two or move are non NULL @@ -6002,7 +5997,7 @@ int wxGrid::SendEvent( const wxEventType type, wxMouseEvent& mouseEv ) { bool claimed; - bool vetoed= FALSE; + bool vetoed; if ( type == wxEVT_GRID_ROW_SIZE || type == wxEVT_GRID_COL_SIZE ) { @@ -6069,7 +6064,7 @@ int wxGrid::SendEvent( const wxEventType type, int row, int col ) { bool claimed; - bool vetoed= FALSE; + bool vetoed; if ( type == wxEVT_GRID_ROW_SIZE || type == wxEVT_GRID_COL_SIZE ) { @@ -9092,9 +9087,7 @@ void wxGrid::SetColFormatFloat(int col, int width, int precision) void wxGrid::SetColFormatCustom(int col, const wxString& typeName) { - wxGridCellAttr *attr = (wxGridCellAttr *)NULL; - - attr = m_table->GetAttr(-1, col, wxGridCellAttr::Col ); + wxGridCellAttr *attr = m_table->GetAttr(-1, col, wxGridCellAttr::Col ); if(!attr) attr = new wxGridCellAttr; wxGridCellRenderer *renderer = GetDefaultRendererForType(typeName); diff --git a/src/generic/gridsel.cpp b/src/generic/gridsel.cpp index a86edfc..17e8f0e 100644 --- a/src/generic/gridsel.cpp +++ b/src/generic/gridsel.cpp @@ -589,7 +589,6 @@ void wxGridSelection::ToggleCellSelection( int row, int col, r = m_grid->BlockToDeviceRect( m_cellSelection[n], m_cellSelection[n] ); m_cellSelection.RemoveAt(n); - n--; count--; if ( !m_grid->GetBatchCount() ) ((wxWindow *)m_grid->m_gridWin)->Refresh( FALSE, &r ); diff --git a/src/generic/imaglist.cpp b/src/generic/imaglist.cpp index 9021b54..5fa3b02 100644 --- a/src/generic/imaglist.cpp +++ b/src/generic/imaglist.cpp @@ -109,17 +109,15 @@ bool wxGenericImageList::Replace( int index, const wxBitmap &bitmap ) wxCHECK_MSG( node, FALSE, wxT("wrong index in image list") ); - wxBitmap* newBitmap = NULL; - if (bitmap.IsKindOf(CLASSINFO(wxIcon))) -#if defined(__VISAGECPP__) -//just can't do this in VisualAge now, with all this new Bitmap-Icon stuff -//so construct it from a bitmap object until I can figure this nonsense out. (DW) - newBitmap = new wxBitmap(bitmap) ; -#else - newBitmap = new wxBitmap( (const wxIcon&) bitmap ); -#endif - else - newBitmap = new wxBitmap(bitmap) ; + wxBitmap* newBitmap = (bitmap.IsKindOf(CLASSINFO(wxIcon))) ? + #if defined(__VISAGECPP__) + //just can't do this in VisualAge now, with all this new Bitmap-Icon stuff + //so construct it from a bitmap object until I can figure this nonsense out. (DW) + new wxBitmap(bitmap) + #else + new wxBitmap( (const wxIcon&) bitmap ) + #endif + : new wxBitmap(bitmap) ; if (index == (int) m_images.GetCount() - 1) { diff --git a/src/generic/listctrl.cpp b/src/generic/listctrl.cpp index b6985f9..f5b0ef4 100644 --- a/src/generic/listctrl.cpp +++ b/src/generic/listctrl.cpp @@ -2682,7 +2682,6 @@ void wxListMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) ) { wxPen pen(GetRuleColour(), 1, wxSOLID); - int col = 0; wxRect firstItemRect; wxRect lastItemRect; GetItemRect(visibleFrom, firstItemRect); @@ -2690,7 +2689,7 @@ void wxListMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) ) int x = firstItemRect.GetX(); dc.SetPen(pen); dc.SetBrush(* wxTRANSPARENT_BRUSH); - for (col = 0; col < GetColumnCount(); col++) + for (int col = 0; col < GetColumnCount(); col++) { int colWidth = GetColumnWidth(col); x += colWidth; @@ -3196,15 +3195,7 @@ void wxListMainWindow::OnChar( wxKeyEvent &event ) case WXK_PRIOR: { - int steps = 0; - if ( HasFlag(wxLC_REPORT) ) - { - steps = m_linesPerPage - 1; - } - else - { - steps = m_current % m_linesPerPage; - } + int steps = HasFlag(wxLC_REPORT) ? m_linesPerPage - 1 : m_current % m_linesPerPage; int index = m_current - steps; if (index < 0) @@ -3216,15 +3207,9 @@ void wxListMainWindow::OnChar( wxKeyEvent &event ) case WXK_NEXT: { - int steps = 0; - if ( HasFlag(wxLC_REPORT) ) - { - steps = m_linesPerPage - 1; - } - else - { - steps = m_linesPerPage - (m_current % m_linesPerPage) - 1; - } + int steps = HasFlag(wxLC_REPORT) + ? m_linesPerPage - 1 + : m_linesPerPage - (m_current % m_linesPerPage) - 1; size_t index = m_current + steps; size_t count = GetItemCount(); @@ -4023,7 +4008,6 @@ void wxListMainWindow::RecalculatePositions(bool noRefresh) clientHeight -= wxSystemSettings:: GetMetric(wxSYS_HSCROLL_Y); m_linesPerPage = 0; - currentlyVisibleLines = 0; break; } @@ -5325,7 +5309,8 @@ int wxGenericListCtrl::OnGetItemImage(long WXUNUSED(item)) const return -1; } -wxListItemAttr *wxGenericListCtrl::OnGetItemAttr(long item) const +wxListItemAttr * +wxGenericListCtrl::OnGetItemAttr(long WXUNUSED_UNLESS_DEBUG(item)) const { wxASSERT_MSG( item >= 0 && item < GetItemCount(), _T("invalid item index in OnGetItemAttr()") ); diff --git a/src/generic/logg.cpp b/src/generic/logg.cpp index daea3ac..eb5e177 100644 --- a/src/generic/logg.cpp +++ b/src/generic/logg.cpp @@ -1111,7 +1111,7 @@ static int OpenLogFile(wxFile& file, wxString *pFilename) // open file // --------- - bool bOk = FALSE; + bool bOk; if ( wxFile::Exists(filename) ) { bool bAppend = FALSE; wxString strMsg; diff --git a/src/generic/printps.cpp b/src/generic/printps.cpp index 615fa7e..aea9ddf 100644 --- a/src/generic/printps.cpp +++ b/src/generic/printps.cpp @@ -135,7 +135,7 @@ bool wxPostScriptPrinter::Print(wxWindow *parent, wxPrintout *printout, bool pro m_printDialogData.SetMaxPage(9999); // Create a suitable device context - wxDC *dc = (wxDC *) NULL; + wxDC *dc; if (prompt) { dc = PrintDialog(parent); diff --git a/src/generic/sashwin.cpp b/src/generic/sashwin.cpp index 1a7fdee..55664e5 100644 --- a/src/generic/sashwin.cpp +++ b/src/generic/sashwin.cpp @@ -488,11 +488,7 @@ void wxSashWindow::DrawSash(wxSashEdgePosition edge, wxDC& dc) if ( edge == wxSASH_LEFT || edge == wxSASH_RIGHT ) { - int sashPosition = 0; - if (edge == wxSASH_LEFT) - sashPosition = 0; - else - sashPosition = w - GetEdgeMargin(edge); + int sashPosition = (edge == wxSASH_LEFT) ? 0 : ( w - GetEdgeMargin(edge) ); dc.SetPen(facePen); dc.SetBrush(faceBrush); @@ -518,11 +514,7 @@ void wxSashWindow::DrawSash(wxSashEdgePosition edge, wxDC& dc) } else // top or bottom { - int sashPosition = 0; - if (edge == wxSASH_TOP) - sashPosition = 0; - else - sashPosition = h - GetEdgeMargin(edge); + int sashPosition = (edge == wxSASH_TOP) ? 0 : ( h - GetEdgeMargin(edge) ); dc.SetPen(facePen); dc.SetBrush(faceBrush); diff --git a/src/generic/splitter.cpp b/src/generic/splitter.cpp index 3f1c33e..7f7db32 100644 --- a/src/generic/splitter.cpp +++ b/src/generic/splitter.cpp @@ -376,7 +376,7 @@ void wxSplitterWindow::OnSize(wxSizeEvent& event) parent = parent->GetParent(); } - bool iconized = FALSE; + bool iconized; wxTopLevelWindow *winTop = wxDynamicCast(parent, wxTopLevelWindow); if ( winTop ) @@ -720,7 +720,7 @@ bool wxSplitterWindow::Unsplit(wxWindow *toRemove) if ( ! IsSplit() ) return FALSE; - wxWindow *win = NULL; + wxWindow *win; if ( toRemove == NULL || toRemove == m_windowTwo) { win = m_windowTwo ; diff --git a/src/generic/treectlg.cpp b/src/generic/treectlg.cpp index 2e5ee1b..3e40803 100644 --- a/src/generic/treectlg.cpp +++ b/src/generic/treectlg.cpp @@ -1711,21 +1711,12 @@ bool wxGenericTreeCtrl::TagAllChildrenUntilLast(wxGenericTreeItem *crt_item, wxG void wxGenericTreeCtrl::SelectItemRange(wxGenericTreeItem *item1, wxGenericTreeItem *item2) { - // item2 is not necessary after item1 - wxGenericTreeItem *first=NULL, *last=NULL; m_select_me = NULL; + // item2 is not necessary after item1 // choice first' and 'last' between item1 and item2 - if (item1->GetY()GetY()) - { - first=item1; - last=item2; - } - else - { - first=item2; - last=item1; - } + wxGenericTreeItem *first= (item1->GetY()GetY()) ? item1 : item2; + wxGenericTreeItem *last = (item1->GetY()GetY()) ? item2 : item1; bool select = m_current->IsSelected(); diff --git a/src/generic/vlbox.cpp b/src/generic/vlbox.cpp index df02305..0b978ea 100644 --- a/src/generic/vlbox.cpp +++ b/src/generic/vlbox.cpp @@ -486,7 +486,7 @@ void wxVListBox::OnKeyDown(wxKeyEvent& event) // flags for DoHandleItemClick() int flags = ItemClick_Kbd; - int current = 0; // just to silent the stupid compiler warnings + int current; switch ( event.GetKeyCode() ) { case WXK_HOME: @@ -539,6 +539,7 @@ void wxVListBox::OnKeyDown(wxKeyEvent& event) default: event.Skip(); + current = 0; // just to silent the stupid compiler warnings return; } diff --git a/src/generic/vscroll.cpp b/src/generic/vscroll.cpp index 6c072dc..e592f80 100644 --- a/src/generic/vscroll.cpp +++ b/src/generic/vscroll.cpp @@ -92,7 +92,7 @@ wxCoord wxVScrolledWindow::EstimateTotalHeight() const // use the height of the lines we looked as the average heightTotal = (wxCoord) - (((float)m_heightTotal / (3*NUM_LINES_TO_SAMPLE)) * m_lineMax); + (((float)heightTotal / (3*NUM_LINES_TO_SAMPLE)) * m_lineMax); } return heightTotal; diff --git a/src/html/helpfrm.cpp b/src/html/helpfrm.cpp index 3d743fa..dba3591 100644 --- a/src/html/helpfrm.cpp +++ b/src/html/helpfrm.cpp @@ -454,7 +454,7 @@ bool wxHtmlHelpFrame::Create(wxWindow* parent, wxWindowID id, sizer->Add(m_SearchList, 1, wxALL | wxEXPAND, 2); m_NavigNotebook->AddPage(dummy, _("Search")); - m_SearchPage = notebook_page++; + m_SearchPage = notebook_page; } m_HtmlWin->Show(TRUE); diff --git a/src/html/htmlcell.cpp b/src/html/htmlcell.cpp index cda05a6..c62a65a 100644 --- a/src/html/htmlcell.cpp +++ b/src/html/htmlcell.cpp @@ -752,7 +752,6 @@ void wxHtmlContainerCell::Layout(int w) ypos + line->GetPosY()); line = line->GetNext(); } - xcnt++; } ypos += ysizedown; @@ -968,11 +967,9 @@ const wxHtmlCell* wxHtmlContainerCell::Find(int condition, const void* param) co { if (m_Cells) { - const wxHtmlCell *r = NULL; - for (wxHtmlCell *cell = m_Cells; cell; cell = cell->GetNext()) { - r = cell->Find(condition, param); + const wxHtmlCell *r = cell->Find(condition, param); if (r) return r; } } diff --git a/src/html/htmltag.cpp b/src/html/htmltag.cpp index 656ec5e..16579f6 100644 --- a/src/html/htmltag.cpp +++ b/src/html/htmltag.cpp @@ -66,7 +66,6 @@ bool wxIsCDATAElement(const wxChar *tag) wxHtmlTagsCache::wxHtmlTagsCache(const wxString& source) { const wxChar *src = source.c_str(); - int tg, stpos; int lng = source.Length(); wxChar tagBuffer[256]; @@ -81,8 +80,9 @@ wxHtmlTagsCache::wxHtmlTagsCache(const wxString& source) { if (m_CacheSize % CACHE_INCREMENT == 0) m_Cache = (wxHtmlCacheItem*) realloc(m_Cache, (m_CacheSize + CACHE_INCREMENT) * sizeof(wxHtmlCacheItem)); - tg = m_CacheSize++; - m_Cache[tg].Key = stpos = pos++; + int tg = m_CacheSize++; + int stpos = pos++; + m_Cache[tg].Key = stpos; int i; for ( i = 0; diff --git a/src/html/htmprint.cpp b/src/html/htmprint.cpp index 24c0d77..606cbef 100644 --- a/src/html/htmprint.cpp +++ b/src/html/htmprint.cpp @@ -381,8 +381,10 @@ void wxHtmlPrintout::RenderPage(wxDC *dc, int page) int ppiPrinterX, ppiPrinterY; GetPPIPrinter(&ppiPrinterX, &ppiPrinterY); + wxUnusedVar(ppiPrinterX); int ppiScreenX, ppiScreenY; GetPPIScreen(&ppiScreenX, &ppiScreenY); + wxUnusedVar(ppiScreenX); dc->SetUserScale((double)dc_w / (double)pageWidth, (double)dc_w / (double)pageWidth); diff --git a/src/html/m_pre.cpp b/src/html/m_pre.cpp index 558f29e..76090c9 100644 --- a/src/html/m_pre.cpp +++ b/src/html/m_pre.cpp @@ -35,8 +35,8 @@ FORCE_LINK_ME(m_pre) static wxString LINKAGEMODE HtmlizeWhitespaces(const wxString& str) { wxString out; - size_t i = 0, j = 0, len = str.Len(); - for (i = 0; i < len; i++) + size_t len = str.Len(); + for (size_t i = 0; i < len; i++) { switch (str[i]) { @@ -52,7 +52,10 @@ static wxString LINKAGEMODE HtmlizeWhitespaces(const wxString& str) out << wxT("
"); break; case wxT('\t'): - for (j = 8 - i%8; j > 0; j--) out << wxT(" "); + { + for (size_t j = 8 - i%8; j > 0; j--) + out << wxT(" "); + } break; default: out << str[i]; diff --git a/src/msw/bitmap.cpp b/src/msw/bitmap.cpp index bac7a9c..995596b 100644 --- a/src/msw/bitmap.cpp +++ b/src/msw/bitmap.cpp @@ -1762,14 +1762,11 @@ bool wxCreateDIB(long xSize, long ySize, long bitsPerPixel, HPALETTE hPal, LPBITMAPINFO* lpDIBHeader) { unsigned long i, headerSize; - LPBITMAPINFO lpDIBheader = NULL; - LPPALETTEENTRY lpPe = NULL; - // Allocate space for a DIB header headerSize = (sizeof(BITMAPINFOHEADER) + (256 * sizeof(PALETTEENTRY))); - lpDIBheader = (BITMAPINFO *) malloc(headerSize); - lpPe = (PALETTEENTRY *)((BYTE*)lpDIBheader + sizeof(BITMAPINFOHEADER)); + LPBITMAPINFO lpDIBheader = (BITMAPINFO *) malloc(headerSize); + LPPALETTEENTRY lpPe = (PALETTEENTRY *)((BYTE*)lpDIBheader + sizeof(BITMAPINFOHEADER)); GetPaletteEntries(hPal, 0, 256, lpPe); diff --git a/src/msw/dc.cpp b/src/msw/dc.cpp index f3c558b..f720015 100644 --- a/src/msw/dc.cpp +++ b/src/msw/dc.cpp @@ -878,11 +878,7 @@ void wxDC::DoDrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord h if (radius < 0.0) { - double smallest = 0.0; - if (width < height) - smallest = width; - else - smallest = height; + double smallest = (width < height) ? width : height; radius = (- radius * smallest); } @@ -1432,8 +1428,7 @@ void wxDC::SetBrush(const wxBrush& brush) if ( m_brush.GetResourceHandle() ) { - HBRUSH b = 0; - b = (HBRUSH) ::SelectObject(GetHdc(), (HBRUSH)m_brush.GetResourceHandle()); + HBRUSH b = (HBRUSH) ::SelectObject(GetHdc(), (HBRUSH)m_brush.GetResourceHandle()); if (!m_oldBrush) m_oldBrush = (WXHBRUSH) b; } @@ -1869,7 +1864,7 @@ bool wxDC::DoBlit(wxCoord xdest, wxCoord ydest, ::SetBkColor(GetHdc(), m_textBackgroundColour.GetPixel() ); } - DWORD dwRop = SRCCOPY; + DWORD dwRop; switch (rop) { case wxXOR: dwRop = SRCINVERT; break; diff --git a/src/msw/dcclient.cpp b/src/msw/dcclient.cpp index 800f91f..0bfd4b1 100644 --- a/src/msw/dcclient.cpp +++ b/src/msw/dcclient.cpp @@ -293,11 +293,10 @@ wxPaintDCInfo *wxPaintDC::FindInCache(size_t *index) const // find the entry for this DC in the cache (keyed by the window) WXHDC wxPaintDC::FindDCInCache(wxWindow* win) { - wxPaintDCInfo *info = NULL; size_t nCache = ms_cache.GetCount(); for ( size_t n = 0; n < nCache; n++ ) { - info = &ms_cache[n]; + wxPaintDCInfo *info = &ms_cache[n]; if ( info->hwnd == win->GetHWND() ) { return info->hdc; diff --git a/src/msw/dcprint.cpp b/src/msw/dcprint.cpp index f93544c..17b5533 100644 --- a/src/msw/dcprint.cpp +++ b/src/msw/dcprint.cpp @@ -345,7 +345,8 @@ bool DrawBitmapUsingStretchDIBits(HDC hdc, { #if wxUSE_WXDIB wxDIB dib(bmp); - if ( !dib.IsOk() ) + bool ok = dib.IsOk(); + if ( !ok ) return FALSE; DIBSECTION ds; @@ -374,7 +375,7 @@ bool DrawBitmapUsingStretchDIBits(HDC hdc, return FALSE; } - + else return TRUE; #else return FALSE; diff --git a/src/msw/gdiimage.cpp b/src/msw/gdiimage.cpp index 126da04..26cabaa 100644 --- a/src/msw/gdiimage.cpp +++ b/src/msw/gdiimage.cpp @@ -372,7 +372,8 @@ bool wxBMPFileHandler::LoadFile(wxBitmap *bitmap, wxDIB dib(name); - return dib.IsOk() && bitmap->CopyFromDIB(dib); + bool ok = dib.IsOk() && bitmap->CopyFromDIB(dib); + return ok; #else WXHBITMAP hBitmap = (WXHBITMAP)wxLoadBMP(name); if(hBitmap) { diff --git a/src/msw/gsocket.c b/src/msw/gsocket.c index 60f2a26..9bfb770 100644 --- a/src/msw/gsocket.c +++ b/src/msw/gsocket.c @@ -30,7 +30,6 @@ #include #ifndef __GSOCKET_STANDALONE__ -# include "wx/defs.h" # include "wx/setup.h" #endif diff --git a/src/msw/iniconf.cpp b/src/msw/iniconf.cpp index cc7986e..0184d5a 100644 --- a/src/msw/iniconf.cpp +++ b/src/msw/iniconf.cpp @@ -35,6 +35,7 @@ #include "wx/dynarray.h" #include "wx/log.h" #include "wx/config.h" +#include "wx/file.h" #include "wx/msw/iniconf.h" diff --git a/src/msw/mimetype.cpp b/src/msw/mimetype.cpp index a7242a7..78eb544 100644 --- a/src/msw/mimetype.cpp +++ b/src/msw/mimetype.cpp @@ -514,7 +514,7 @@ wxFileType *wxMimeTypesManagerImpl::Associate(const wxFileTypeInfo& ftInfo) wxCHECK_MSG( !ftInfo.GetExtensions().IsEmpty(), NULL, _T("Associate() needs extension") ); - bool ok = FALSE ; + bool ok; int iExtCount = 0 ; wxString filetype; wxString extWithDot; @@ -551,7 +551,7 @@ wxFileType *wxMimeTypesManagerImpl::Associate(const wxFileTypeInfo& ftInfo) filetype = filetypeOrig; } - ok = key.SetValue(wxEmptyString, filetype); + key.SetValue(wxEmptyString, filetype); } } else @@ -560,11 +560,11 @@ wxFileType *wxMimeTypesManagerImpl::Associate(const wxFileTypeInfo& ftInfo) if (!filetypeOrig.empty()) { filetype = filetypeOrig; - ok = key.SetValue(wxEmptyString, filetype); + key.SetValue(wxEmptyString, filetype); } else { - ok = key.QueryValue(wxEmptyString, filetype); + key.QueryValue(wxEmptyString, filetype); } } // now set a mimetypeif we have it, but ignore it if none @@ -585,7 +585,7 @@ wxFileType *wxMimeTypesManagerImpl::Associate(const wxFileTypeInfo& ftInfo) if ( ok ) { // and provide a back link to the extension - ok = keyMIME.SetValue(_T("Extension"), extWithDot); + keyMIME.SetValue(_T("Extension"), extWithDot); } } } @@ -601,8 +601,8 @@ wxFileType *wxMimeTypesManagerImpl::Associate(const wxFileTypeInfo& ftInfo) extWithDot += ext; wxRegKey key(wxRegKey::HKCR, extWithDot); - if ( !key.Exists() ) ok = key.Create(); - ok = key.SetValue(wxEmptyString, filetype); + if ( !key.Exists() ) key.Create(); + key.SetValue(wxEmptyString, filetype); // now set any mimetypes we may have, but ignore it if none const wxString& mimetype = ftInfo.GetMimeType(); @@ -622,7 +622,7 @@ wxFileType *wxMimeTypesManagerImpl::Associate(const wxFileTypeInfo& ftInfo) if ( ok ) { // and provide a back link to the extension - ok = keyMIME.SetValue(_T("Extension"), extWithDot); + keyMIME.SetValue(_T("Extension"), extWithDot); } } } @@ -633,10 +633,9 @@ wxFileType *wxMimeTypesManagerImpl::Associate(const wxFileTypeInfo& ftInfo) // create the filetype key itself (it will be empty for now, but // SetCommand(), SetDefaultIcon() &c will use it later) wxRegKey keyFT(wxRegKey::HKCR, filetype); - ok = keyFT.Create(); + keyFT.Create(); - wxFileType *ft = NULL; - ft = CreateFileType(filetype, extWithDot); + wxFileType *ft = CreateFileType(filetype, extWithDot); if (ft) { diff --git a/src/msw/pen.cpp b/src/msw/pen.cpp index 90faa37..cc3ae70 100644 --- a/src/msw/pen.cpp +++ b/src/msw/pen.cpp @@ -142,8 +142,7 @@ bool wxPen::RealizeResource() return TRUE; } - COLORREF ms_colour = 0; - ms_colour = M_PENDATA->m_colour.GetPixel(); + COLORREF ms_colour = M_PENDATA->m_colour.GetPixel(); // Join style, Cap style, Pen Stippling only on Win32. // Currently no time to find equivalent on Win3.1, sorry diff --git a/src/msw/taskbar.cpp b/src/msw/taskbar.cpp index 482ca24..23e0025 100644 --- a/src/msw/taskbar.cpp +++ b/src/msw/taskbar.cpp @@ -184,7 +184,6 @@ bool wxTaskBarIcon::PopupMenu(wxMenu *menu) s_inPopup = true; - bool rval = false; wxWindow* win; int x, y; wxGetMousePosition(&x, &y); @@ -202,7 +201,7 @@ bool wxTaskBarIcon::PopupMenu(wxMenu *menu) // Work around a WIN32 bug ::SetForegroundWindow ((HWND) win->GetHWND ()); - rval = win->PopupMenu(menu, 0, 0); + bool rval = win->PopupMenu(menu, 0, 0); // Work around a WIN32 bug ::PostMessage ((HWND) win->GetHWND(),WM_NULL,0,0L); diff --git a/src/msw/thread.cpp b/src/msw/thread.cpp index 0ac2427..4c9b11e 100644 --- a/src/msw/thread.cpp +++ b/src/msw/thread.cpp @@ -690,7 +690,7 @@ wxThreadInternal::WaitForTerminate(wxCriticalSection& cs, // process the Windows messages that result from these functions // (note that even in console applications we might have to process // messages if we use wxExecute() or timers or ...) - DWORD result = 0; // suppress warnings from broken compilers + DWORD result wxDUMMY_INITIALIZE(0); do { if ( wxThread::IsMain() ) diff --git a/src/msw/toplevel.cpp b/src/msw/toplevel.cpp index 16a7ee5..d73404f 100644 --- a/src/msw/toplevel.cpp +++ b/src/msw/toplevel.cpp @@ -445,7 +445,7 @@ bool wxTopLevelWindowMSW::Create(wxWindow *parent, long style, const wxString& name) { - bool ret = false; + bool ret wxDUMMY_INITIALIZE(false); // init our fields Init(); diff --git a/src/msw/utils.cpp b/src/msw/utils.cpp index cc1b2e6..89c2b89 100644 --- a/src/msw/utils.cpp +++ b/src/msw/utils.cpp @@ -922,7 +922,7 @@ bool wxShutdown(wxShutdownFlags wFlags) return FALSE; } - bOK = ::ExitWindowsEx(EWX_SHUTDOWN | EWX_FORCE | EWX_REBOOT, 0) != 0; + bOK = ::ExitWindowsEx(flags, 0) != 0; } return bOK; diff --git a/src/msw/utilsexc.cpp b/src/msw/utilsexc.cpp index 17b1c30..b969c89 100644 --- a/src/msw/utilsexc.cpp +++ b/src/msw/utilsexc.cpp @@ -473,7 +473,7 @@ static bool wxExecuteDDE(const wxString& ddeServer, const wxString& ddeTopic, const wxString& ddeCommand) { - bool ok = FALSE; + bool ok wxDUMMY_INITIALIZE(false); wxDDEClient client; wxConnectionBase *conn = client.MakeConnection(wxEmptyString, diff --git a/src/msw/volume.cpp b/src/msw/volume.cpp index 2b4f329..d82a59a 100644 --- a/src/msw/volume.cpp +++ b/src/msw/volume.cpp @@ -404,7 +404,7 @@ wxArrayString wxFSVolumeBase::GetVolumes(int flagsSet, int flagsUnset) TCHAR* buf = new TCHAR[chars+1]; // Get the list of drives. - chars = GetLogicalDriveStrings(chars, buf); + GetLogicalDriveStrings(chars, buf); // Parse the list into an array, applying appropriate filters. TCHAR *pVol; diff --git a/src/msw/window.cpp b/src/msw/window.cpp index e73ae61..65006bc 100644 --- a/src/msw/window.cpp +++ b/src/msw/window.cpp @@ -4914,7 +4914,7 @@ int wxCharCodeMSWToWX(int keySym) int wxCharCodeWXToMSW(int id, bool *isVirtual) { *isVirtual = TRUE; - int keySym = 0; + int keySym; switch (id) { case WXK_CANCEL: keySym = VK_CANCEL; break; diff --git a/src/univ/textctrl.cpp b/src/univ/textctrl.cpp index 1538bce..3111cdf 100644 --- a/src/univ/textctrl.cpp +++ b/src/univ/textctrl.cpp @@ -2345,7 +2345,7 @@ wxSize wxTextCtrl::DoGetBestClientSize() const lines = 5; else if ( lines > 10 ) lines = 10; - h *= 10; + h *= lines; } wxRect rectText; diff --git a/src/univ/themes/win32.cpp b/src/univ/themes/win32.cpp index 8629507..24e9cd5 100644 --- a/src/univ/themes/win32.cpp +++ b/src/univ/themes/win32.cpp @@ -3598,7 +3598,6 @@ void wxWin32Renderer::DrawFrameTitleBar(wxDC& dc, DrawFrameButton(dc, x, y, wxTOPLEVEL_BUTTON_HELP, (specialButton == wxTOPLEVEL_BUTTON_HELP) ? specialButtonFlags : 0); - x -= FRAME_BUTTON_WIDTH; } } } diff --git a/src/univ/topluniv.cpp b/src/univ/topluniv.cpp index 959ac9f..0ac5717 100644 --- a/src/univ/topluniv.cpp +++ b/src/univ/topluniv.cpp @@ -101,7 +101,7 @@ bool wxTopLevelWindow::Create(wxWindow *parent, style &= ~(wxCAPTION | wxMINIMIZE_BOX | wxMAXIMIZE_BOX | wxSYSTEM_MENU | wxRESIZE_BORDER | wxFRAME_TOOL_WINDOW | wxTHICK_FRAME); - style = wxSIMPLE_BORDER; + style |= wxSIMPLE_BORDER; SetExtraStyle(exstyleOrig & ~(wxFRAME_EX_CONTEXTHELP | wxDIALOG_EX_CONTEXTHELP)); } -- 2.7.4