2. fixed a bug in wxGTK::wxGetResource
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@5118
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
wxDate Previous(int dayOfWeek) const
{
wxDate Previous(int dayOfWeek) const
{
int dow = GetDayOfWeek();
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
}
wxString FormatDate(int type = -1) const
// default to Today() otherwise)
const wxChar *ParseFormat(const wxChar *date,
const wxChar *format = _T("%c"),
// 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);
// 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);
wxDateSpan& wxDateSpan::Multiply(int factor)
{
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;
#error "See the documentation on the 'longlong' pragma."
#endif
#else // no native long long type
#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
#define wxUSE_LONGLONG_WX 1
#endif // compiler
{
case Gregorian:
return Now().GetMonth();
{
case Gregorian:
return Now().GetMonth();
case Julian:
wxFAIL_MSG(_T("TODO"));
case Julian:
wxFAIL_MSG(_T("TODO"));
case Gregorian:
case Julian:
return IsLeapYear(year) ? 366 : 365;
case Gregorian:
case Julian:
return IsLeapYear(year) ? 366 : 365;
default:
wxFAIL_MSG(_T("unsupported calendar"));
default:
wxFAIL_MSG(_T("unsupported calendar"));
jdn *= MILLISECONDS_PER_DAY;
jdn *= MILLISECONDS_PER_DAY;
return week;
#else // this seems to be a bit simpler and I believe is also correct
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);
time += tz.GetOffset();
#ifdef __VMS__ /* time is unsigned so VMS gives a warning on the original */
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 )
#endif
{
tm = gmtime(&time);
#endif
{
tm = gmtime(&time);
bool wxFileConfig::GetNextGroup (wxString& str, long& lIndex) const
{
if ( size_t(lIndex) < m_pCurrentGroup->Groups().Count() ) {
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();
bool wxFileConfig::GetNextEntry (wxString& str, long& lIndex) const
{
if ( size_t(lIndex) < m_pCurrentGroup->Entries().Count() ) {
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();
-bool wxToolBar::DoDeleteTool(size_t pos, wxToolBarToolBase *toolBase)
+bool wxToolBar::DoDeleteTool(size_t WXUNUSED(pos), wxToolBarToolBase *toolBase)
{
wxToolBarTool *tool = (wxToolBarTool *)toolBase;
{
wxToolBarTool *tool = (wxToolBarTool *)toolBase;
{
wxString filename( file );
if (filename.IsEmpty()) filename = wxT(".wxWindows");
{
wxString filename( file );
if (filename.IsEmpty()) filename = wxT(".wxWindows");
wxFileConfig conf( wxTheApp->GetAppName(), wxTheApp->GetVendorName(), filename );
wxFileConfig conf( wxTheApp->GetAppName(), wxTheApp->GetVendorName(), filename );
- if (conf.Write( entry, &result ))
+ if (conf.Read( entry, &result ))
char *s = new char[result.Len()+1];
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;
+ }
-bool wxToolBar::DoDeleteTool(size_t pos, wxToolBarToolBase *toolBase)
+bool wxToolBar::DoDeleteTool(size_t WXUNUSED(pos), wxToolBarToolBase *toolBase)
{
wxToolBarTool *tool = (wxToolBarTool *)toolBase;
{
wxToolBarTool *tool = (wxToolBarTool *)toolBase;
{
wxString filename( file );
if (filename.IsEmpty()) filename = wxT(".wxWindows");
{
wxString filename( file );
if (filename.IsEmpty()) filename = wxT(".wxWindows");
wxFileConfig conf( wxTheApp->GetAppName(), wxTheApp->GetVendorName(), filename );
wxFileConfig conf( wxTheApp->GetAppName(), wxTheApp->GetVendorName(), filename );
- if (conf.Write( entry, &result ))
+ if (conf.Read( entry, &result ))
char *s = new char[result.Len()+1];
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;
+ }
wxMutexGuiLeave();
bool isDetached = m_isDetached;
wxMutexGuiLeave();
bool isDetached = m_isDetached;
+ long id = (long)GetId();
wxLogTrace(TRACE_THREADS, _T("Starting to wait for thread %ld to exit."),
id);
wxLogTrace(TRACE_THREADS, _T("Starting to wait for thread %ld to exit."),
id);
// we're cancelled inside pthread_join(), things will almost
// certainly break - but if we disable the cancellation, we
// might deadlock
// 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"));
{
wxLogError(_("Failed to join a thread, potential memory leak "
"detected - please restart the program"));