]> git.saurik.com Git - wxWidgets.git/commitdiff
1. misc compilation (errors, warnings) fixes (from the build logs)
authorVadim Zeitlin <vadim@wxwidgets.org>
Sun, 26 Dec 1999 21:52:50 +0000 (21:52 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sun, 26 Dec 1999 21:52:50 +0000 (21:52 +0000)
2. fixed a bug in wxGTK::wxGetResource

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@5118 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/date.h
include/wx/datetime.h
include/wx/datetime.inl
include/wx/longlong.h
src/common/datetime.cpp
src/common/fileconf.cpp
src/gtk/tbargtk.cpp
src/gtk/utilsres.cpp
src/gtk1/tbargtk.cpp
src/gtk1/utilsres.cpp
src/unix/threadpsx.cpp

index d4dd19c745d2064c4cbe855e3b561a5b55ec36f6..1b3f2e778894d4a8adab62d17f5a9baaee501dab 100644 (file)
@@ -179,11 +179,11 @@ public:
 
     wxDate Previous(int dayOfWeek) const
     {
+        wxDate prev = *this;
         int dow = GetDayOfWeek();
-        if ( dayOfWeek <= dow )
-            return *this - (dow - dayOfWeek);
-        else
-            return *this - 7 + (dayOfWeek - dow);
+        prev -= dayOfWeek > dow ? 7 - (dayOfWeek - dow) : dow - dayOfWeek;
+
+        return prev;
     }
 
     wxString FormatDate(int type = -1) const
index d0de3f9773fa5365a5e88f0c36b0f6273537f9d5..a41287b335387307cf6e65ff58f5145b31f92151 100644 (file)
@@ -848,7 +848,7 @@ public:
         // default to Today() otherwise)
     const wxChar *ParseFormat(const wxChar *date,
                               const wxChar *format = _T("%c"),
-                              const wxDateTime& dateDef = ms_InvDateTime);
+                              const wxDateTime& dateDef = wxDateTime::ms_InvDateTime);
         // parse a string containing the date/time in "free" format, this
         // function will try to make an educated guess at the string contents
     const wxChar *ParseDateTime(const wxChar *datetime);
index 8be3bf69b28469012663c14ff9f1967a68d06b71..9c0dec16a370c2370f240537036bc834c4387829 100644 (file)
@@ -401,10 +401,10 @@ wxDateSpan::operator+=(const wxDateSpan& other)
 
 wxDateSpan& wxDateSpan::Multiply(int factor)
 {
-    m_years *= m_years;
-    m_months *= m_months;
-    m_weeks *= m_weeks;
-    m_days *= m_days;
+    m_years *= factor;
+    m_months *= factor;
+    m_weeks *= factor;
+    m_days *= factor;
 
     return *this;
 }
index c9fca339ef0cb15569fd94bd0dad02e84a5c0288..4fd611a7103fe93201bf582e7d237c74a1634608 100644 (file)
         #error "See the documentation on the 'longlong' pragma."
     #endif
 #else // no native long long type
-    // we don't give warnings for the compilers we know about that they don't
-    // have any 64 bit integer type
-    #if 0 // !defined(__VISAGECPP__) && \
-        !defined(__VISUALC__) && \
-        !defined(__BORLANDC__)
-        #warning "Your compiler does not appear to support 64 bit integers, "\
-                 "using emulation class instead."
-    #endif // known compilers without long long
+    // both warning and pragma warning are not portable, but at least an
+    // unknown pragma should never be an error
+    #pragma warning "Your compiler does not appear to support 64 bit "\
+                    "integers, using emulation class instead."
 
     #define wxUSE_LONGLONG_WX 1
 #endif // compiler
index 8cd374b31f3abbf0bbc3bd4e53133595033724a7..93682aaca7346b257670cbf6a664ef37204b4d18 100644 (file)
@@ -584,7 +584,6 @@ wxDateTime::Month wxDateTime::GetCurrentMonth(wxDateTime::Calendar cal)
     {
         case Gregorian:
             return Now().GetMonth();
-            break;
 
         case Julian:
             wxFAIL_MSG(_T("TODO"));
@@ -612,7 +611,6 @@ wxDateTime::wxDateTime_t wxDateTime::GetNumberOfDays(int year, Calendar cal)
         case Gregorian:
         case Julian:
             return IsLeapYear(year) ? 366 : 365;
-            break;
 
         default:
             wxFAIL_MSG(_T("unsupported calendar"));
@@ -1117,7 +1115,7 @@ wxDateTime& wxDateTime::Set(double jdn)
 
     jdn *= MILLISECONDS_PER_DAY;
 
-    m_time = jdn;
+    m_time.Assign(jdn);
 
     return *this;
 }
@@ -1530,7 +1528,7 @@ wxDateTime::wxDateTime_t wxDateTime::GetWeekOfYear(const TimeZone& tz) const
 
     return week;
 #else // this seems to be a bit simpler and I believe is also correct
-    return (WeekDay)((GetDayOfYear() - (GetWeekDay() - 1 + 7) % 7 + 7) / 7);
+    return (WeekDay)((GetDayOfYear(tz) - (GetWeekDay(tz) - 1 + 7) % 7 + 7) / 7);
 #endif // 0/1
 }
 
@@ -1673,10 +1671,10 @@ wxString wxDateTime::Format(const wxChar *format, const TimeZone& tz) const
             time += tz.GetOffset();
 
 #ifdef __VMS__ /* time is unsigned so VMS gives a warning on the original */
-          time2 = (int) time;
-          if ( time2 >= 0 )
+            time2 = (int) time;
+            if ( time2 >= 0 )
 #else
-          if ( time >= 0 )
+            if ( time >= 0 )
 #endif
             {
                 tm = gmtime(&time);
index 54bc21641a83d76157a032d94ba8e223c1e00699..49f612750062956e0ae9097c1c3ae6d99388c741 100644 (file)
@@ -595,7 +595,7 @@ bool wxFileConfig::GetFirstGroup(wxString& str, long& lIndex) const
 bool wxFileConfig::GetNextGroup (wxString& str, long& lIndex) const
 {
   if ( size_t(lIndex) < m_pCurrentGroup->Groups().Count() ) {
-    str = m_pCurrentGroup->Groups()[lIndex++]->Name();
+    str = m_pCurrentGroup->Groups()[(size_t)lIndex++]->Name();
     return TRUE;
   }
   else
@@ -611,7 +611,7 @@ bool wxFileConfig::GetFirstEntry(wxString& str, long& lIndex) const
 bool wxFileConfig::GetNextEntry (wxString& str, long& lIndex) const
 {
   if ( size_t(lIndex) < m_pCurrentGroup->Entries().Count() ) {
-    str = m_pCurrentGroup->Entries()[lIndex++]->Name();
+    str = m_pCurrentGroup->Entries()[(size_t)lIndex++]->Name();
     return TRUE;
   }
   else
index c6961b6381e588b1c1e3a72cbcdd281d18005883..5cbd3c990ea2e76f2f1344e5bd61372891fc53e5 100644 (file)
@@ -407,7 +407,7 @@ bool wxToolBar::DoInsertTool(size_t pos, wxToolBarToolBase *toolBase)
     return TRUE;
 }
 
-bool wxToolBar::DoDeleteTool(size_t pos, wxToolBarToolBase *toolBase)
+bool wxToolBar::DoDeleteTool(size_t WXUNUSED(pos), wxToolBarToolBase *toolBase)
 {
     wxToolBarTool *tool = (wxToolBarTool *)toolBase;
 
index cf8a946da7e89b3fc37e71f402ea65a6521cc9f8..749a722e1de4fdd46bcfdaa71e6bb8e1a36660cf 100644 (file)
@@ -62,23 +62,23 @@ bool wxGetResource(const wxString& section, const wxString& entry, char **value,
 {
     wxString filename( file );
     if (filename.IsEmpty()) filename = wxT(".wxWindows");
-    
+
     wxFileConfig conf( wxTheApp->GetAppName(), wxTheApp->GetVendorName(), filename );
-    
+
     conf.SetPath( section );
-    
+
     wxString result;
-    if (conf.Write( entry, &result ))
+    if (conf.Read( entry, &result ))
     {
         if (!result.IsEmpty())
-       {
+        {
             char *s = new char[result.Len()+1];
-           wxStrcpy( s, result.c_str() );
-           *value = s;
-           return TRUE;
-       }
+            wxStrcpy( s, result.c_str() );
+            *value = s;
+            return TRUE;
+        }
     }
-    
+
     return FALSE;
 }
 
index c6961b6381e588b1c1e3a72cbcdd281d18005883..5cbd3c990ea2e76f2f1344e5bd61372891fc53e5 100644 (file)
@@ -407,7 +407,7 @@ bool wxToolBar::DoInsertTool(size_t pos, wxToolBarToolBase *toolBase)
     return TRUE;
 }
 
-bool wxToolBar::DoDeleteTool(size_t pos, wxToolBarToolBase *toolBase)
+bool wxToolBar::DoDeleteTool(size_t WXUNUSED(pos), wxToolBarToolBase *toolBase)
 {
     wxToolBarTool *tool = (wxToolBarTool *)toolBase;
 
index cf8a946da7e89b3fc37e71f402ea65a6521cc9f8..749a722e1de4fdd46bcfdaa71e6bb8e1a36660cf 100644 (file)
@@ -62,23 +62,23 @@ bool wxGetResource(const wxString& section, const wxString& entry, char **value,
 {
     wxString filename( file );
     if (filename.IsEmpty()) filename = wxT(".wxWindows");
-    
+
     wxFileConfig conf( wxTheApp->GetAppName(), wxTheApp->GetVendorName(), filename );
-    
+
     conf.SetPath( section );
-    
+
     wxString result;
-    if (conf.Write( entry, &result ))
+    if (conf.Read( entry, &result ))
     {
         if (!result.IsEmpty())
-       {
+        {
             char *s = new char[result.Len()+1];
-           wxStrcpy( s, result.c_str() );
-           *value = s;
-           return TRUE;
-       }
+            wxStrcpy( s, result.c_str() );
+            *value = s;
+            return TRUE;
+        }
     }
-    
+
     return FALSE;
 }
 
index c0a1a533a8c32b0ca0a014ac5bc503c97373e582..d708dbd7032d1108c52456cb5ada8d92ac4a76bb 100644 (file)
@@ -725,7 +725,7 @@ void wxThreadInternal::Wait()
         wxMutexGuiLeave();
 
     bool isDetached = m_isDetached;
-    long id = GetId();
+    long id = (long)GetId();
     wxLogTrace(TRACE_THREADS, _T("Starting to wait for thread %ld to exit."),
                id);
 
@@ -749,7 +749,7 @@ void wxThreadInternal::Wait()
             //       we're cancelled inside pthread_join(), things will almost
             //       certainly break - but if we disable the cancellation, we
             //       might deadlock
-            if ( pthread_join(id, &m_exitcode) != 0 )
+            if ( pthread_join((pthread *)id, &m_exitcode) != 0 )
             {
                 wxLogError(_("Failed to join a thread, potential memory leak "
                              "detected - please restart the program"));