]> git.saurik.com Git - wxWidgets.git/commitdiff
'Dummy' warning fixes (might be used uninitialized).
authorWłodzimierz Skiba <abx@abx.art.pl>
Mon, 14 Mar 2005 20:00:42 +0000 (20:00 +0000)
committerWłodzimierz Skiba <abx@abx.art.pl>
Mon, 14 Mar 2005 20:00:42 +0000 (20:00 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@32826 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/datetime.cpp
src/common/string.cpp
src/common/xpmdecod.cpp
src/common/zipstrm.cpp
src/generic/logg.cpp

index b211b4ee2d594689f5f9a08fdf43a75deece0184..2a4491edaf19eaba4a7a0d5a903a8d71008a125f 100644 (file)
@@ -364,7 +364,7 @@ static long GetTruncatedJDN(wxDateTime::wxDateTime_t day,
 static wxString CallStrftime(const wxChar *format, const tm* tm)
 {
     wxChar buf[4096];
-       if ( !wxStrftime(buf, WXSIZEOF(buf), format, tm) )
+    if ( !wxStrftime(buf, WXSIZEOF(buf), format, tm) )
     {
         // buffer is too small?
         wxFAIL_MSG(_T("strftime() failed"));
@@ -829,47 +829,47 @@ wxString wxDateTime::GetMonthName(wxDateTime::Month month,
 
     return CallStrftime(flags == Name_Abbr ? _T("%b") : _T("%B"), &tm);
 #else
-       wxString ret;
-       switch(month)
-       {
-               case Jan: 
-                       ret = (flags == Name_Abbr ? wxT("Jan"): wxT("January"));
-                       break;
-               case Feb: 
-                       ret = (flags == Name_Abbr ? wxT("Feb"): wxT("Febuary"));
-                       break;
-               case Mar: 
-                       ret = (flags == Name_Abbr ? wxT("Mar"): wxT("March"));
-                       break;
-               case Apr: 
-                       ret = (flags == Name_Abbr ? wxT("Apr"): wxT("April"));
-                       break;
-               case May: 
-                       ret = (flags == Name_Abbr ? wxT("May"): wxT("May"));
-                       break;
-               case Jun: 
-                       ret = (flags == Name_Abbr ? wxT("Jun"): wxT("June"));
-                       break;
-               case Jul: 
-                       ret = (flags == Name_Abbr ? wxT("Jul"): wxT("July"));
-                       break;
-               case Aug: 
-                       ret = (flags == Name_Abbr ? wxT("Aug"): wxT("August"));
-                       break;
-               case Sep: 
-                       ret = (flags == Name_Abbr ? wxT("Sep"): wxT("September"));
-                       break;
-               case Oct: 
-                       ret = (flags == Name_Abbr ? wxT("Oct"): wxT("October"));
-                       break;
-               case Nov: 
-                       ret = (flags == Name_Abbr ? wxT("Nov"): wxT("November"));
-                       break;
-               case Dec: 
-                       ret = (flags == Name_Abbr ? wxT("Dec"): wxT("December"));
-                       break;
-       }
-       return ret;
+    wxString ret;
+    switch(month)
+    {
+        case Jan:
+            ret = (flags == Name_Abbr ? wxT("Jan"): wxT("January"));
+            break;
+        case Feb:
+            ret = (flags == Name_Abbr ? wxT("Feb"): wxT("Febuary"));
+            break;
+        case Mar:
+            ret = (flags == Name_Abbr ? wxT("Mar"): wxT("March"));
+            break;
+        case Apr:
+            ret = (flags == Name_Abbr ? wxT("Apr"): wxT("April"));
+            break;
+        case May:
+            ret = (flags == Name_Abbr ? wxT("May"): wxT("May"));
+            break;
+        case Jun:
+            ret = (flags == Name_Abbr ? wxT("Jun"): wxT("June"));
+            break;
+        case Jul:
+            ret = (flags == Name_Abbr ? wxT("Jul"): wxT("July"));
+            break;
+        case Aug:
+            ret = (flags == Name_Abbr ? wxT("Aug"): wxT("August"));
+            break;
+        case Sep:
+            ret = (flags == Name_Abbr ? wxT("Sep"): wxT("September"));
+            break;
+        case Oct:
+            ret = (flags == Name_Abbr ? wxT("Oct"): wxT("October"));
+            break;
+        case Nov:
+            ret = (flags == Name_Abbr ? wxT("Nov"): wxT("November"));
+            break;
+        case Dec:
+            ret = (flags == Name_Abbr ? wxT("Dec"): wxT("December"));
+            break;
+    }
+    return ret;
 #endif
 }
 
@@ -897,32 +897,32 @@ wxString wxDateTime::GetWeekDayName(wxDateTime::WeekDay wday,
     // ... and call strftime()
     return CallStrftime(flags == Name_Abbr ? _T("%a") : _T("%A"), &tm);
 #else
-       wxString ret;
-       switch(wday)
-       {
-               case Sun: 
-                       ret = (flags == Name_Abbr ? wxT("Sun") : wxT("Sunday"));
-                       break;
-               case Mon:
-                       ret = (flags == Name_Abbr ? wxT("Mon") : wxT("Monday"));
-                       break;
-               case Tue:
-                       ret = (flags == Name_Abbr ? wxT("Tue") : wxT("Tuesday"));
-                       break;
-               case Wed:
-                       ret = (flags == Name_Abbr ? wxT("Wed") : wxT("Wednesday"));
-                       break;
-               case Thu:
-                       ret = (flags == Name_Abbr ? wxT("Thu") : wxT("Thursday"));
-                       break;
-               case Fri:
-                       ret = (flags == Name_Abbr ? wxT("Fri") : wxT("Friday"));
-                       break;
-               case Sat:
-                       ret = (flags == Name_Abbr ? wxT("Sat") : wxT("Saturday"));
-                       break;
-       }
-       return ret;
+    wxString ret;
+    switch(wday)
+    {
+        case Sun:
+            ret = (flags == Name_Abbr ? wxT("Sun") : wxT("Sunday"));
+            break;
+        case Mon:
+            ret = (flags == Name_Abbr ? wxT("Mon") : wxT("Monday"));
+            break;
+        case Tue:
+            ret = (flags == Name_Abbr ? wxT("Tue") : wxT("Tuesday"));
+            break;
+        case Wed:
+            ret = (flags == Name_Abbr ? wxT("Wed") : wxT("Wednesday"));
+            break;
+        case Thu:
+            ret = (flags == Name_Abbr ? wxT("Thu") : wxT("Thursday"));
+            break;
+        case Fri:
+            ret = (flags == Name_Abbr ? wxT("Fri") : wxT("Friday"));
+            break;
+        case Sat:
+            ret = (flags == Name_Abbr ? wxT("Sat") : wxT("Saturday"));
+            break;
+    }
+    return ret;
 
 #endif
 }
@@ -2201,7 +2201,7 @@ wxString wxDateTime::Format(const wxChar *format, const TimeZone& tz) const
             }
         }
 #ifndef __WXWINCE__
-       //Windows CE doesn't support strftime or wcsftime, so we use the generic implementation
+    //Windows CE doesn't support strftime or wcsftime, so we use the generic implementation
         if ( tm )
         {
             return CallStrftime(format, tm);
@@ -2416,9 +2416,9 @@ wxString wxDateTime::Format(const wxChar *format, const TimeZone& tz) const
                         res += str;
                     }
 #else
-                                       //Use "%m/%d/%y %H:%M:%S" format instead
-                                       res += wxString::Format(wxT("%02d/%02d/%04d %02d:%02d:%02d"),
-                                                       tm.mon+1,tm.mday, tm.year, tm.hour, tm.min, tm.sec);
+                    //Use "%m/%d/%y %H:%M:%S" format instead
+                    res += wxString::Format(wxT("%02d/%02d/%04d %02d:%02d:%02d"),
+                            tm.mon+1,tm.mday, tm.year, tm.hour, tm.min, tm.sec);
 #endif
                     break;
 
@@ -2459,7 +2459,7 @@ wxString wxDateTime::Format(const wxChar *format, const TimeZone& tz) const
 #ifndef __WXWINCE__
                     res += CallStrftime(_T("%p"), &tmTimeOnly);
 #else
-                                       res += (tmTimeOnly.tm_hour > 12) ? wxT("pm") : wxT("am");
+                    res += (tmTimeOnly.tm_hour > 12) ? wxT("pm") : wxT("am");
 #endif
                     break;
 
@@ -2486,7 +2486,7 @@ wxString wxDateTime::Format(const wxChar *format, const TimeZone& tz) const
 #ifndef __WXWINCE__
                     res += CallStrftime(_T("%X"), &tmTimeOnly);
 #else
-                                       res += wxString::Format(wxT("%02d:%02d:%02d"),tm.hour, tm.min, tm.sec);
+                    res += wxString::Format(wxT("%02d:%02d:%02d"),tm.hour, tm.min, tm.sec);
 #endif
                     break;
 
@@ -2739,7 +2739,7 @@ const wxChar *wxDateTime::ParseRfc822Date(const wxChar* date)
     }
 
     // and now the interesting part: the timezone
-    int offset;
+    int offset wxDUMMY_INITIALIZE(0);
     if ( *p == _T('-') || *p == _T('+') )
     {
         // the explicit offset given: it has the form of hhmm
index c95d6729e8859d4726c3c18b1ad84ed9c600c91b..38351ff5f0d552dfa9d01d028ac6a0ef846a8add 100644 (file)
@@ -1796,46 +1796,43 @@ wxString wxString::FormatV(const wxChar *pszFormat, va_list argptr)
 
 int wxString::Printf(const wxChar *pszFormat, ...)
 {
-  va_list argptr;
-  va_start(argptr, pszFormat);
+    va_list argptr;
+    va_start(argptr, pszFormat);
 
-  int iLen = PrintfV(pszFormat, argptr);
+    int iLen = PrintfV(pszFormat, argptr);
 
-  va_end(argptr);
+    va_end(argptr);
 
-  return iLen;
+    return iLen;
 }
 
 int wxString::PrintfV(const wxChar* pszFormat, va_list argptr)
 {
     int size = 1024;
-    int len;
 
     for ( ;; )
     {
-        {
-            wxStringBuffer tmp(*this, size + 1);
-            wxChar* buf = tmp;
+        wxStringBuffer tmp(*this, size + 1);
+        wxChar* buf = tmp;
 
-            if ( !buf )
-            {
-                // out of memory
-                return -1;
-            }
-
-            // wxVsnprintf() may modify the original arg pointer, so pass it
-            // only a copy
-            va_list argptrcopy;
-            wxVaCopy(argptrcopy, argptr);
-            len = wxVsnprintf(buf, size, pszFormat, argptrcopy);
-            va_end(argptrcopy);
-
-            // some implementations of vsnprintf() don't NUL terminate
-            // the string if there is not enough space for it so
-            // always do it manually
-            buf[size] = _T('\0');
+        if ( !buf )
+        {
+            // out of memory
+            return -1;
         }
 
+        // wxVsnprintf() may modify the original arg pointer, so pass it
+        // only a copy
+        va_list argptrcopy;
+        wxVaCopy(argptrcopy, argptr);
+        int len = wxVsnprintf(buf, size, pszFormat, argptrcopy);
+        va_end(argptrcopy);
+
+        // some implementations of vsnprintf() don't NUL terminate
+        // the string if there is not enough space for it so
+        // always do it manually
+        buf[size] = _T('\0');
+
         // vsnprintf() may return either -1 (traditional Unix behaviour) or the
         // total number of characters which would have been written if the
         // buffer were large enough
index 89cdad65eed7b0b2da8c0ebecdd890af03ba260f..ed784fb578cc9b061c69e8b9fcb3cc5aa6721a7f 100644 (file)
@@ -668,7 +668,6 @@ wxImage wxXPMDecoder::ReadData(const char **xpm_data)
     wxChar key[64];
     const char *clr_def;
     bool hasMask;
-    wxXPMColourMapData clr_data;
     wxXPMColourMap clr_tbl;
     wxXPMColourMap::iterator it;
     wxString maskKey;
@@ -702,6 +701,8 @@ wxImage wxXPMDecoder::ReadData(const char **xpm_data)
      */
     for (i = 0; i < colors_cnt; i++)
     {
+        wxXPMColourMapData clr_data = {255,0,255};
+
         for (i_key = 0; i_key < chars_per_pixel; i_key++)
             key[i_key] = (wxChar)xpm_data[1 + i][i_key];
         clr_def = ParseColor(xpm_data[1 + i] + chars_per_pixel);
@@ -710,17 +711,15 @@ wxImage wxXPMDecoder::ReadData(const char **xpm_data)
         {
             wxLogError(_("XPM: malformed colour definition '%s'!"),
                        xpm_data[1+i]);
-            clr_data.R = 255, clr_data.G = 0, clr_data.B = 255;
         }
         else
         {
-            bool isNone;
+            bool isNone = false;
             if ( !GetRGBFromName(clr_def, &isNone,
                                  &clr_data.R, &clr_data.G, &clr_data.B) )
             {
                 wxLogError(_("XPM: malformed colour definition '%s'!"),
                            xpm_data[1+i]);
-                clr_data.R = 255, clr_data.G = 0, clr_data.B = 255;
             }
             else
             {
@@ -729,7 +728,6 @@ wxImage wxXPMDecoder::ReadData(const char **xpm_data)
                     img.SetMask(true);
                     img.SetMaskColour(255, 0, 255);
                     hasMask = true;
-                    clr_data.R = 255, clr_data.G = 0, clr_data.B = 255;
                     maskKey = key;
                 }
             }
index f9f9826428dc678dc707b157feb48cd6b2ab8a18..1c10609715cc014d6fdc790afa46be4636624c88 100644 (file)
@@ -593,7 +593,7 @@ wxZipEntry::wxZipEntry(
     const wxString& name /*=wxEmptyString*/,
     const wxDateTime& dt /*=wxDateTime::Now()*/,
     wxFileOffset size    /*=wxInvalidOffset*/)
-  : 
+  :
     m_SystemMadeBy(wxZIP_SYSTEM_MSDOS),
     m_VersionMadeBy(wxMAJOR_VERSION * 10 + wxMINOR_VERSION),
     m_VersionNeeded(VERSION_NEEDED_TO_EXTRACT),
@@ -907,7 +907,7 @@ size_t wxZipEntry::WriteLocal(wxOutputStream& stream, wxMBConv& conv) const
 
     ds << m_VersionNeeded << m_Flags << m_Method;
     ds.Write32(GetDateTime().GetAsDOS());
-    
+
     ds.Write32(m_Crc);
     ds.Write32(m_CompressedSize != wxInvalidOffset ? (wxUint32)m_CompressedSize : 0);
     ds.Write32(m_Size != wxInvalidOffset ? (wxUint32)m_Size : 0);
@@ -942,7 +942,7 @@ size_t wxZipEntry::ReadCentral(wxInputStream& stream, wxMBConv& conv)
     ds >> nameLen >> extraLen >> commentLen
        >> m_DiskStart >> m_InternalAttributes >> m_ExternalAttributes;
     SetOffset(ds.Read32());
+
     SetName(ReadString(stream, nameLen, conv), wxPATH_UNIX);
 
     if (extraLen || GetExtraLen()) {
@@ -990,7 +990,7 @@ size_t wxZipEntry::WriteCentral(wxOutputStream& stream, wxMBConv& conv) const
 
     ds << commentLen << m_DiskStart << m_InternalAttributes
        << m_ExternalAttributes << (wxUint32)GetOffset();
+
     stream.Write(name, nameLen);
     if (extraLen)
         stream.Write(GetExtra(), extraLen);
@@ -1007,7 +1007,7 @@ size_t wxZipEntry::WriteCentral(wxOutputStream& stream, wxMBConv& conv) const
 size_t wxZipEntry::ReadDescriptor(wxInputStream& stream)
 {
     wxDataInputStream ds(stream);
-    
+
     m_Crc = ds.Read32();
     m_CompressedSize = ds.Read32();
     m_Size = ds.Read32();
@@ -1019,7 +1019,7 @@ size_t wxZipEntry::ReadDescriptor(wxInputStream& stream)
         stream.Read(buf, sizeof(buf));
         wxUint32 u1 = CrackUint32(buf);
         wxUint32 u2 = CrackUint32(buf + 4);
-        
+
         // look for the signature of the following record to decide which
         if ((u1 == LOCAL_MAGIC || u1 == CENTRAL_MAGIC) &&
             (u2 != LOCAL_MAGIC && u2 != CENTRAL_MAGIC))
@@ -1241,7 +1241,7 @@ wxZipInputStream::~wxZipInputStream()
     delete m_ffile;
 
     m_weaklinks->Release(this);
-    
+
     if (m_streamlink)
         m_streamlink->Release(this);
 }
@@ -1325,7 +1325,7 @@ bool wxZipInputStream::LoadEndRecord()
     m_Comment = endrec.GetComment();
 
     // Now find the central-directory. we have the file offset of
-    // the CD, so look there first. 
+    // the CD, so look there first.
     if (m_parent_i_stream->SeekI(endrec.GetOffset()) != wxInvalidOffset &&
             ReadSignature() == CENTRAL_MAGIC) {
         m_signature = CENTRAL_MAGIC;
@@ -1333,7 +1333,7 @@ bool wxZipInputStream::LoadEndRecord()
         m_offsetAdjustment = 0;
         return true;
     }
+
     // If it's not there, then it could be that the zip has been appended
     // to a self extractor, so take the CD size (also in endrec), subtract
     // it from the file offset of the end-central-directory and look there.
@@ -1359,7 +1359,7 @@ bool wxZipInputStream::FindEndRecord()
         return false;
 
     // usually it's 22 bytes in size and the last thing in the file
-    { 
+    {
         wxLogNull nolog;
         if (m_parent_i_stream->SeekI(-END_SIZE, wxFromEnd) == wxInvalidOffset)
             return false;
@@ -1386,7 +1386,7 @@ bool wxZipInputStream::FindEndRecord()
         size_t len = (size_t)(pos - wxMax(pos - (BUFSIZE - 3), minpos));
         memcpy(buf.data() + len, buf, 3);
         pos -= len;
-    
+
         if (m_parent_i_stream->SeekI(pos, wxFromStart) == wxInvalidOffset ||
                 m_parent_i_stream->Read(buf.data(), len).LastRead() != len)
             return false;
@@ -1470,7 +1470,7 @@ wxStreamError wxZipInputStream::ReadLocal(bool readEndRec /*=false*/)
     while (m_signature == CENTRAL_MAGIC) {
         if (m_weaklinks->IsEmpty() && m_streamlink == NULL)
             return wxSTREAM_EOF;
-        
+
         m_position += m_entry.ReadCentral(*m_parent_i_stream, GetConv());
         m_signature = 0;
         if (m_parent_i_stream->GetLastError() == wxSTREAM_READ_ERROR)
@@ -1506,7 +1506,7 @@ wxStreamError wxZipInputStream::ReadLocal(bool readEndRec /*=false*/)
         }
         return wxSTREAM_EOF;
     }
-            
+
     if (m_signature != LOCAL_MAGIC) {
         wxLogError(_("error reading zip local header"));
         return wxSTREAM_READ_ERROR;
@@ -1557,9 +1557,9 @@ bool wxZipInputStream::DoOpen(wxZipEntry *entry, bool raw)
         // can only open the current entry on a non-seekable stream
         wxCHECK(m_parentSeekable, false);
     }
-    
+
     m_lasterror = wxSTREAM_READ_ERROR;
-    
+
     if (entry)
         m_entry = *entry;
 
@@ -1765,7 +1765,7 @@ wxFileOffset wxZipInputStream::OnSysSeek(wxFileOffset seek, wxSeekMode mode)
         default : nextpos = pos; break; /* just to fool compiler, never happens */
     }
 
-    size_t toskip;
+    size_t toskip wxDUMMY_INITIALIZE(0);
     if ( nextpos >= pos )
     {
         toskip = (size_t)(nextpos - pos);
@@ -1825,7 +1825,7 @@ wxZipOutputStream::wxZipOutputStream(wxOutputStream& stream,
     m_offsetAdjustment(wxInvalidOffset)
 {
 }
-                                
+
 wxZipOutputStream::~wxZipOutputStream()
 {
     Close();
index 8c20b7af42cd042af06340658a8d19b244f6b138..ee26cbdd017c701f129b05829745fc6beb9168c7 100644 (file)
@@ -1157,7 +1157,7 @@ static int OpenLogFile(wxFile& file, wxString *pFilename, wxWindow *parent)
 
     // open file
     // ---------
-    bool bOk;
+    bool bOk wxDUMMY_INITIALIZE(false);
     if ( wxFile::Exists(filename) ) {
         bool bAppend = false;
         wxString strMsg;