compilation/linking fixes for DLL build in release mode

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_2_BRANCH@6914 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2000-03-24 01:56:00 +00:00
parent f7b5f357d4
commit 9be2e3416d
27 changed files with 465 additions and 310 deletions

133
distrib/msw/tmake/vc6bdll.t Normal file
View File

@@ -0,0 +1,133 @@
#!#############################################################################
#! File: vc6bdll.t
#! Purpose: tmake template file from which wxBaseDll.dsp is generated by running
#! tmake -t vc6bdll wxwin.pro -o wxBaseDll.dsp
#! Author: Vadim Zeitlin
#! Created: 22.03.00
#! Version: $Id$
#!#############################################################################
#${
#! include the code which parses filelist.txt file and initializes
#! %wxCommon, %wxGeneric and %wxMSW hashes.
IncludeTemplate("filelist.t");
#! now transform these hashes into $project tags
foreach $file (sort keys %wxCommon) {
next if $wxCommon{$file} !~ /\bB\b/;
my $tag = $file =~ /\.c$/ ? "WXCSRCS" : "WXCOMMONSRCS";
$project{$tag} .= $file . " "
}
foreach $file (sort keys %wxMSW) {
next if $wxMSW{$file} !~ /\bB\b/;
my $tag = $file =~ /\.c$/ ? "WXMSWCSRCS" : "WXMSWSRCS";
$project{$tag} .= $file . " "
}
foreach $file (sort keys %wxBase) {
my $tag = $file =~ /\.c$/ ? "WXCSRCS" : "WXCOMMONSRCS";
$project{$tag} .= $file . " "
}
#$}
# Microsoft Developer Studio Project File - Name="wxBaseDll" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
CFG=wxBaseDll - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "wxBaseDll.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "wxBaseDll.mak" CFG="wxBaseDll - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "wxBaseDll - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "wxBaseDll - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "wxBaseDll - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "BaseDllRelease"
# PROP Intermediate_Dir "BaseDllRelease"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "WXBASEDLL_EXPORTS" /YX /FD /c
# ADD CPP /nologo /MT /W4 /O2 /I "$(wx)\include" /I "$(wx)\src\zlib" /D "NDEBUG" /D wxUSE_GUI=0 /D "__WIN95__" /D "WIN32" /D "_WIN32" /D WINVER=0x400 /D "__WINDOWS__" /D "__WIN32__" /D "__WXMSW__" /D "_MT" /D "WXMAKINGDLL" /Yu"wx/wxprec.h" /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /i "$(wx)\include" /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
# ADD LINK32 kernel32.lib user32.lib advapi32.lib wsock32.lib /nologo /version:2.2 /dll /machine:I386
!ELSEIF "$(CFG)" == "wxBaseDll - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "BaseDllDebug"
# PROP Intermediate_Dir "BaseDllDebug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "WXBASEDLL_EXPORTS" /YX /FD /GZ /c
# ADD CPP /nologo /MTd /W4 /Gm /ZI /Od /I "$(wx)\include" /I "$(wx)\src\zlib" /D "_DEBUG" /D wxUSE_GUI=0 /D "__WIN95__" /D "WIN32" /D "_WIN32" /D WINVER=0x400 /D "__WINDOWS__" /D "__WIN32__" /D "__WXMSW__" /D "_MT" /D "WXMAKINGDLL" /D "__WXDEBUG__" /Yu"wx/wxprec.h" /FD /GZ /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /i "$(wx)\include" /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib advapi32.lib wsock32.lib /nologo /version:2.2 /dll /debug /machine:I386 /pdbtype:sept
!ENDIF
# Begin Target
# Name "wxBaseDll - Win32 Release"
# Name "wxBaseDll - Win32 Debug"
# Begin Source File
SOURCE=.\src\msw\dummydll.cpp
# ADD CPP /Yc"wx/wxprec.h"
# End Source File
#$ ExpandGlue("WXCOMMONSRCS", "# Begin Source File\n\nSOURCE=.\\src\\common\\", "\n# End Source File\n# Begin Source File\n\nSOURCE=.\\src\\common\\", "\n# End Source File\n");
#$ ExpandGlue("WXMSWSRCS", "# Begin Source File\n\nSOURCE=.\\src\\msw\\", "\n# End Source File\n# Begin Source File\n\nSOURCE=.\\src\\msw\\", "\n# End Source File\n");
#$ ExpandGlue("WXCSRCS", "# Begin Source File\n\nSOURCE=.\\src\\common\\", "\n# SUBTRACT CPP /YX /Yc /Yu\n# End Source File\n# Begin Source File\n\nSOURCE=.\\src\\common\\", "\n# SUBTRACT CPP /YX /Yc /Yu\n# End Source File\n");
#$ ExpandGlue("WXMSWCSRCS", "# Begin Source File\n\nSOURCE=.\\src\\msw\\", "\n# SUBTRACT CPP /YX /Yc /Yu\n# End Source File\n# Begin Source File\n\nSOURCE=.\\src\\msw\\", "\n# SUBTRACT CPP /YX /Yc /Yu\n# End Source File\n");
# End Target
# End Project

View File

@@ -113,7 +113,7 @@ public:
long style = 0); long style = 0);
// empty but ensures that dtor of all derived classes is virtual // empty but ensures that dtor of all derived classes is virtual
virtual ~wxConfigBase() { } virtual ~wxConfigBase();
// path management // path management
// set current path: if the first character is '/', it's the absolute path, // set current path: if the first character is '/', it's the absolute path,
@@ -226,6 +226,7 @@ public:
// misc accessors // misc accessors
wxString GetAppName() const { return m_appName; } wxString GetAppName() const { return m_appName; }
wxString GetVendorName() const { return m_vendorName; } wxString GetVendorName() const { return m_vendorName; }
// Used wxIniConfig to set members in constructor // Used wxIniConfig to set members in constructor
void SetAppName(const wxString& appName) { m_appName = appName; } void SetAppName(const wxString& appName) { m_appName = appName; }
void SetVendorName(const wxString& vendorName) { m_vendorName = vendorName; } void SetVendorName(const wxString& vendorName) { m_vendorName = vendorName; }

View File

@@ -250,7 +250,7 @@ private:
// wxDataObject directly. // wxDataObject directly.
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
WX_DECLARE_LIST(wxDataObjectSimple, wxSimpleDataObjectList); WX_DECLARE_EXPORTED_LIST(wxDataObjectSimple, wxSimpleDataObjectList);
class WXDLLEXPORT wxDataObjectComposite : public wxDataObject class WXDLLEXPORT wxDataObjectComposite : public wxDataObject
{ {

View File

@@ -1245,7 +1245,7 @@ private:
#include "wx/dynarray.h" #include "wx/dynarray.h"
WX_DECLARE_OBJARRAY(wxDateTime, wxDateTimeArray); WX_DECLARE_EXPORTED_OBJARRAY(wxDateTime, wxDateTimeArray);
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// wxDateTimeHolidayAuthority: an object of this class will decide whether a // wxDateTimeHolidayAuthority: an object of this class will decide whether a

View File

@@ -40,19 +40,19 @@
const long wxDateTime::TIME_T_FACTOR = 1000l; const long wxDateTime::TIME_T_FACTOR = 1000l;
#endif // wxDEFINE_TIME_CONSTANTS #endif // wxDEFINE_TIME_CONSTANTS
bool wxDateTime::IsInStdRange() const inline bool wxDateTime::IsInStdRange() const
{ {
return m_time >= 0l && (m_time / TIME_T_FACTOR) < LONG_MAX; return m_time >= 0l && (m_time / TIME_T_FACTOR) < LONG_MAX;
} }
/* static */ /* static */
wxDateTime wxDateTime::Now() inline wxDateTime wxDateTime::Now()
{ {
return wxDateTime(*GetTmNow()); return wxDateTime(*GetTmNow());
} }
/* static */ /* static */
wxDateTime wxDateTime::Today() inline wxDateTime wxDateTime::Today()
{ {
struct tm *tm = GetTmNow(); struct tm *tm = GetTmNow();
tm->tm_hour = tm->tm_hour =
@@ -63,7 +63,7 @@ wxDateTime wxDateTime::Today()
} }
#if (!(defined(__VISAGECPP__) && __IBMCPP__ >= 400)) #if (!(defined(__VISAGECPP__) && __IBMCPP__ >= 400))
wxDateTime& wxDateTime::Set(time_t timet) inline wxDateTime& wxDateTime::Set(time_t timet)
{ {
// assign first to avoid long multiplication overflow! // assign first to avoid long multiplication overflow!
m_time = timet; m_time = timet;
@@ -73,42 +73,42 @@ wxDateTime& wxDateTime::Set(time_t timet)
} }
#endif #endif
wxDateTime& wxDateTime::SetToCurrent() inline wxDateTime& wxDateTime::SetToCurrent()
{ {
*this = Now(); *this = Now();
return *this; return *this;
} }
#if (!(defined(__VISAGECPP__) && __IBMCPP__ >= 400)) #if (!(defined(__VISAGECPP__) && __IBMCPP__ >= 400))
wxDateTime::wxDateTime(time_t timet) inline wxDateTime::wxDateTime(time_t timet)
{ {
Set(timet); Set(timet);
} }
#endif #endif
wxDateTime::wxDateTime(const struct tm& tm) inline wxDateTime::wxDateTime(const struct tm& tm)
{ {
Set(tm); Set(tm);
} }
wxDateTime::wxDateTime(const Tm& tm) inline wxDateTime::wxDateTime(const Tm& tm)
{ {
Set(tm); Set(tm);
} }
wxDateTime::wxDateTime(double jdn) inline wxDateTime::wxDateTime(double jdn)
{ {
Set(jdn); Set(jdn);
} }
wxDateTime& wxDateTime::Set(const Tm& tm) inline wxDateTime& wxDateTime::Set(const Tm& tm)
{ {
wxASSERT_MSG( tm.IsValid(), _T("invalid broken down date/time") ); wxASSERT_MSG( tm.IsValid(), _T("invalid broken down date/time") );
return Set(tm.mday, (Month)tm.mon, tm.year, tm.hour, tm.min, tm.sec); return Set(tm.mday, (Month)tm.mon, tm.year, tm.hour, tm.min, tm.sec);
} }
wxDateTime::wxDateTime(wxDateTime_t hour, inline wxDateTime::wxDateTime(wxDateTime_t hour,
wxDateTime_t minute, wxDateTime_t minute,
wxDateTime_t second, wxDateTime_t second,
wxDateTime_t millisec) wxDateTime_t millisec)
@@ -116,7 +116,7 @@ wxDateTime::wxDateTime(wxDateTime_t hour,
Set(hour, minute, second, millisec); Set(hour, minute, second, millisec);
} }
wxDateTime::wxDateTime(wxDateTime_t day, inline wxDateTime::wxDateTime(wxDateTime_t day,
Month month, Month month,
int year, int year,
wxDateTime_t hour, wxDateTime_t hour,
@@ -131,14 +131,14 @@ wxDateTime::wxDateTime(wxDateTime_t day,
// wxDateTime accessors // wxDateTime accessors
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
wxLongLong wxDateTime::GetValue() const inline wxLongLong wxDateTime::GetValue() const
{ {
wxASSERT_MSG( IsValid(), _T("invalid wxDateTime")); wxASSERT_MSG( IsValid(), _T("invalid wxDateTime"));
return m_time; return m_time;
} }
time_t wxDateTime::GetTicks() const inline time_t wxDateTime::GetTicks() const
{ {
wxASSERT_MSG( IsValid(), _T("invalid wxDateTime")); wxASSERT_MSG( IsValid(), _T("invalid wxDateTime"));
if ( !IsInStdRange() ) if ( !IsInStdRange() )
@@ -149,29 +149,29 @@ time_t wxDateTime::GetTicks() const
return (time_t)((m_time / (long)TIME_T_FACTOR).GetLo()); return (time_t)((m_time / (long)TIME_T_FACTOR).GetLo());
} }
bool wxDateTime::SetToLastWeekDay(WeekDay weekday, inline bool wxDateTime::SetToLastWeekDay(WeekDay weekday,
Month month, Month month,
int year) int year)
{ {
return SetToWeekDay(weekday, -1, month, year); return SetToWeekDay(weekday, -1, month, year);
} }
wxDateTime wxDateTime::GetWeekDayInSameWeek(WeekDay weekday) const inline wxDateTime wxDateTime::GetWeekDayInSameWeek(WeekDay weekday) const
{ {
MODIFY_AND_RETURN( SetToWeekDayInSameWeek(weekday) ); MODIFY_AND_RETURN( SetToWeekDayInSameWeek(weekday) );
} }
wxDateTime wxDateTime::GetNextWeekDay(WeekDay weekday) const inline wxDateTime wxDateTime::GetNextWeekDay(WeekDay weekday) const
{ {
MODIFY_AND_RETURN( SetToNextWeekDay(weekday) ); MODIFY_AND_RETURN( SetToNextWeekDay(weekday) );
} }
wxDateTime wxDateTime::GetPrevWeekDay(WeekDay weekday) const inline wxDateTime wxDateTime::GetPrevWeekDay(WeekDay weekday) const
{ {
MODIFY_AND_RETURN( SetToPrevWeekDay(weekday) ); MODIFY_AND_RETURN( SetToPrevWeekDay(weekday) );
} }
wxDateTime wxDateTime::GetWeekDay(WeekDay weekday, inline wxDateTime wxDateTime::GetWeekDay(WeekDay weekday,
int n, int n,
Month month, Month month,
int year) const int year) const
@@ -181,7 +181,7 @@ wxDateTime wxDateTime::GetWeekDay(WeekDay weekday,
return dt.SetToWeekDay(weekday, n, month, year) ? dt : wxInvalidDateTime; return dt.SetToWeekDay(weekday, n, month, year) ? dt : wxInvalidDateTime;
} }
wxDateTime wxDateTime::GetLastWeekDay(WeekDay weekday, inline wxDateTime wxDateTime::GetLastWeekDay(WeekDay weekday,
Month month, Month month,
int year) int year)
{ {
@@ -190,19 +190,20 @@ wxDateTime wxDateTime::GetLastWeekDay(WeekDay weekday,
return dt.SetToLastWeekDay(weekday, month, year) ? dt : wxInvalidDateTime; return dt.SetToLastWeekDay(weekday, month, year) ? dt : wxInvalidDateTime;
} }
wxDateTime wxDateTime::GetWeek(wxDateTime_t numWeek, WeekDay weekday) const inline wxDateTime wxDateTime::GetWeek(wxDateTime_t numWeek,
WeekDay weekday) const
{ {
wxDateTime dt(*this); wxDateTime dt(*this);
return dt.SetToTheWeek(numWeek, weekday) ? dt : wxInvalidDateTime; return dt.SetToTheWeek(numWeek, weekday) ? dt : wxInvalidDateTime;
} }
wxDateTime wxDateTime::GetLastMonthDay(Month month, int year) const inline wxDateTime wxDateTime::GetLastMonthDay(Month month, int year) const
{ {
MODIFY_AND_RETURN( SetToLastMonthDay(month, year) ); MODIFY_AND_RETURN( SetToLastMonthDay(month, year) );
} }
wxDateTime wxDateTime::GetYearDay(wxDateTime_t yday) const inline wxDateTime wxDateTime::GetYearDay(wxDateTime_t yday) const
{ {
MODIFY_AND_RETURN( SetToYearDay(yday) ); MODIFY_AND_RETURN( SetToYearDay(yday) );
} }
@@ -211,46 +212,47 @@ wxDateTime wxDateTime::GetYearDay(wxDateTime_t yday) const
// wxDateTime comparison // wxDateTime comparison
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
bool wxDateTime::IsEqualTo(const wxDateTime& datetime) const inline bool wxDateTime::IsEqualTo(const wxDateTime& datetime) const
{ {
wxASSERT_MSG( IsValid() && datetime.IsValid(), _T("invalid wxDateTime")); wxASSERT_MSG( IsValid() && datetime.IsValid(), _T("invalid wxDateTime"));
return m_time == datetime.m_time; return m_time == datetime.m_time;
} }
bool wxDateTime::IsEarlierThan(const wxDateTime& datetime) const inline bool wxDateTime::IsEarlierThan(const wxDateTime& datetime) const
{ {
wxASSERT_MSG( IsValid() && datetime.IsValid(), _T("invalid wxDateTime")); wxASSERT_MSG( IsValid() && datetime.IsValid(), _T("invalid wxDateTime"));
return m_time < datetime.m_time; return m_time < datetime.m_time;
} }
bool wxDateTime::IsLaterThan(const wxDateTime& datetime) const inline bool wxDateTime::IsLaterThan(const wxDateTime& datetime) const
{ {
wxASSERT_MSG( IsValid() && datetime.IsValid(), _T("invalid wxDateTime")); wxASSERT_MSG( IsValid() && datetime.IsValid(), _T("invalid wxDateTime"));
return m_time > datetime.m_time; return m_time > datetime.m_time;
} }
bool wxDateTime::IsStrictlyBetween(const wxDateTime& t1, inline bool wxDateTime::IsStrictlyBetween(const wxDateTime& t1,
const wxDateTime& t2) const const wxDateTime& t2) const
{ {
// no need for assert, will be checked by the functions we call // no need for assert, will be checked by the functions we call
return IsLaterThan(t1) && IsEarlierThan(t2); return IsLaterThan(t1) && IsEarlierThan(t2);
} }
bool wxDateTime::IsBetween(const wxDateTime& t1, const wxDateTime& t2) const inline bool wxDateTime::IsBetween(const wxDateTime& t1,
const wxDateTime& t2) const
{ {
// no need for assert, will be checked by the functions we call // no need for assert, will be checked by the functions we call
return IsEqualTo(t1) || IsEqualTo(t2) || IsStrictlyBetween(t1, t2); return IsEqualTo(t1) || IsEqualTo(t2) || IsStrictlyBetween(t1, t2);
} }
bool wxDateTime::IsSameDate(const wxDateTime& dt) const inline bool wxDateTime::IsSameDate(const wxDateTime& dt) const
{ {
return (m_time - dt.m_time).Abs() < MILLISECONDS_PER_DAY; return (m_time - dt.m_time).Abs() < MILLISECONDS_PER_DAY;
} }
bool wxDateTime::IsSameTime(const wxDateTime& dt) const inline bool wxDateTime::IsSameTime(const wxDateTime& dt) const
{ {
// notice that we can't do something like this: // notice that we can't do something like this:
// //
@@ -266,7 +268,8 @@ bool wxDateTime::IsSameTime(const wxDateTime& dt) const
tm1.msec == tm2.msec; tm1.msec == tm2.msec;
} }
bool wxDateTime::IsEqualUpTo(const wxDateTime& dt, const wxTimeSpan& ts) const inline bool wxDateTime::IsEqualUpTo(const wxDateTime& dt,
const wxTimeSpan& ts) const
{ {
return IsBetween(dt.Substract(ts), dt.Add(ts)); return IsBetween(dt.Substract(ts), dt.Add(ts));
} }
@@ -275,14 +278,14 @@ bool wxDateTime::IsEqualUpTo(const wxDateTime& dt, const wxTimeSpan& ts) const
// wxDateTime arithmetics // wxDateTime arithmetics
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
wxDateTime wxDateTime::Add(const wxTimeSpan& diff) const inline wxDateTime wxDateTime::Add(const wxTimeSpan& diff) const
{ {
wxASSERT_MSG( IsValid(), _T("invalid wxDateTime")); wxASSERT_MSG( IsValid(), _T("invalid wxDateTime"));
return wxDateTime(m_time + diff.GetValue()); return wxDateTime(m_time + diff.GetValue());
} }
wxDateTime& wxDateTime::Add(const wxTimeSpan& diff) inline wxDateTime& wxDateTime::Add(const wxTimeSpan& diff)
{ {
wxASSERT_MSG( IsValid(), _T("invalid wxDateTime")); wxASSERT_MSG( IsValid(), _T("invalid wxDateTime"));
@@ -291,19 +294,19 @@ wxDateTime& wxDateTime::Add(const wxTimeSpan& diff)
return *this; return *this;
} }
wxDateTime& wxDateTime::operator+=(const wxTimeSpan& diff) inline wxDateTime& wxDateTime::operator+=(const wxTimeSpan& diff)
{ {
return Add(diff); return Add(diff);
} }
wxDateTime wxDateTime::Substract(const wxTimeSpan& diff) const inline wxDateTime wxDateTime::Substract(const wxTimeSpan& diff) const
{ {
wxASSERT_MSG( IsValid(), _T("invalid wxDateTime")); wxASSERT_MSG( IsValid(), _T("invalid wxDateTime"));
return wxDateTime(m_time - diff.GetValue()); return wxDateTime(m_time - diff.GetValue());
} }
wxDateTime& wxDateTime::Substract(const wxTimeSpan& diff) inline wxDateTime& wxDateTime::Substract(const wxTimeSpan& diff)
{ {
wxASSERT_MSG( IsValid(), _T("invalid wxDateTime")); wxASSERT_MSG( IsValid(), _T("invalid wxDateTime"));
@@ -312,39 +315,39 @@ wxDateTime& wxDateTime::Substract(const wxTimeSpan& diff)
return *this; return *this;
} }
wxDateTime& wxDateTime::operator-=(const wxTimeSpan& diff) inline wxDateTime& wxDateTime::operator-=(const wxTimeSpan& diff)
{ {
return Substract(diff); return Substract(diff);
} }
wxTimeSpan wxDateTime::Substract(const wxDateTime& datetime) const inline wxTimeSpan wxDateTime::Substract(const wxDateTime& datetime) const
{ {
wxASSERT_MSG( IsValid() && datetime.IsValid(), _T("invalid wxDateTime")); wxASSERT_MSG( IsValid() && datetime.IsValid(), _T("invalid wxDateTime"));
return wxTimeSpan(datetime.GetValue() - GetValue()); return wxTimeSpan(datetime.GetValue() - GetValue());
} }
wxDateTime wxDateTime::Add(const wxDateSpan& diff) const inline wxDateTime wxDateTime::Add(const wxDateSpan& diff) const
{ {
return wxDateTime(*this).Add(diff); return wxDateTime(*this).Add(diff);
} }
wxDateTime& wxDateTime::Substract(const wxDateSpan& diff) inline wxDateTime& wxDateTime::Substract(const wxDateSpan& diff)
{ {
return Add(diff.Negate()); return Add(diff.Negate());
} }
wxDateTime wxDateTime::Substract(const wxDateSpan& diff) const inline wxDateTime wxDateTime::Substract(const wxDateSpan& diff) const
{ {
return wxDateTime(*this).Substract(diff); return wxDateTime(*this).Substract(diff);
} }
wxDateTime& wxDateTime::operator-=(const wxDateSpan& diff) inline wxDateTime& wxDateTime::operator-=(const wxDateSpan& diff)
{ {
return Substract(diff); return Substract(diff);
} }
wxDateTime& wxDateTime::operator+=(const wxDateSpan& diff) inline wxDateTime& wxDateTime::operator+=(const wxDateSpan& diff)
{ {
return Add(diff); return Add(diff);
} }
@@ -353,7 +356,7 @@ wxDateTime& wxDateTime::operator+=(const wxDateSpan& diff)
// wxDateTime and timezones // wxDateTime and timezones
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
wxDateTime wxDateTime::ToTimezone(const wxDateTime::TimeZone& tz, inline wxDateTime wxDateTime::ToTimezone(const wxDateTime::TimeZone& tz,
bool noDST) const bool noDST) const
{ {
MODIFY_AND_RETURN( MakeTimezone(tz, noDST) ); MODIFY_AND_RETURN( MakeTimezone(tz, noDST) );
@@ -363,7 +366,10 @@ wxDateTime wxDateTime::ToTimezone(const wxDateTime::TimeZone& tz,
// wxTimeSpan construction // wxTimeSpan construction
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
wxTimeSpan::wxTimeSpan(long hours, long minutes, long seconds, long milliseconds) inline wxTimeSpan::wxTimeSpan(long hours,
long minutes,
long seconds,
long milliseconds)
{ {
// assign first to avoid precision loss // assign first to avoid precision loss
m_diff = hours; m_diff = hours;
@@ -379,27 +385,27 @@ wxTimeSpan::wxTimeSpan(long hours, long minutes, long seconds, long milliseconds
// wxTimeSpan accessors // wxTimeSpan accessors
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
wxLongLong wxTimeSpan::GetSeconds() const inline wxLongLong wxTimeSpan::GetSeconds() const
{ {
return m_diff / 1000l; return m_diff / 1000l;
} }
int wxTimeSpan::GetMinutes() const inline int wxTimeSpan::GetMinutes() const
{ {
return (GetSeconds() / 60l).GetLo(); return (GetSeconds() / 60l).GetLo();
} }
int wxTimeSpan::GetHours() const inline int wxTimeSpan::GetHours() const
{ {
return GetMinutes() / 60; return GetMinutes() / 60;
} }
int wxTimeSpan::GetDays() const inline int wxTimeSpan::GetDays() const
{ {
return GetHours() / 24; return GetHours() / 24;
} }
int wxTimeSpan::GetWeeks() const inline int wxTimeSpan::GetWeeks() const
{ {
return GetDays() / 7; return GetDays() / 7;
} }
@@ -408,53 +414,53 @@ int wxTimeSpan::GetWeeks() const
// wxTimeSpan arithmetics // wxTimeSpan arithmetics
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
wxTimeSpan wxTimeSpan::Add(const wxTimeSpan& diff) const inline wxTimeSpan wxTimeSpan::Add(const wxTimeSpan& diff) const
{ {
return wxTimeSpan(m_diff + diff.GetValue()); return wxTimeSpan(m_diff + diff.GetValue());
} }
wxTimeSpan& wxTimeSpan::Add(const wxTimeSpan& diff) inline wxTimeSpan& wxTimeSpan::Add(const wxTimeSpan& diff)
{ {
m_diff += diff.GetValue(); m_diff += diff.GetValue();
return *this; return *this;
} }
wxTimeSpan wxTimeSpan::Substract(const wxTimeSpan& diff) const inline wxTimeSpan wxTimeSpan::Substract(const wxTimeSpan& diff) const
{ {
return wxTimeSpan(m_diff - diff.GetValue()); return wxTimeSpan(m_diff - diff.GetValue());
} }
wxTimeSpan& wxTimeSpan::Substract(const wxTimeSpan& diff) inline wxTimeSpan& wxTimeSpan::Substract(const wxTimeSpan& diff)
{ {
m_diff -= diff.GetValue(); m_diff -= diff.GetValue();
return *this; return *this;
} }
wxTimeSpan& wxTimeSpan::Multiply(int n) inline wxTimeSpan& wxTimeSpan::Multiply(int n)
{ {
m_diff *= (long)n; m_diff *= (long)n;
return *this; return *this;
} }
wxTimeSpan wxTimeSpan::Multiply(int n) const inline wxTimeSpan wxTimeSpan::Multiply(int n) const
{ {
return wxTimeSpan(m_diff * (long)n); return wxTimeSpan(m_diff * (long)n);
} }
wxTimeSpan wxTimeSpan::Abs() const inline wxTimeSpan wxTimeSpan::Abs() const
{ {
return wxTimeSpan(GetValue().Abs()); return wxTimeSpan(GetValue().Abs());
} }
bool wxTimeSpan::IsEqualTo(const wxTimeSpan& ts) const inline bool wxTimeSpan::IsEqualTo(const wxTimeSpan& ts) const
{ {
return GetValue() == ts.GetValue(); return GetValue() == ts.GetValue();
} }
bool wxTimeSpan::IsLongerThan(const wxTimeSpan& ts) const inline bool wxTimeSpan::IsLongerThan(const wxTimeSpan& ts) const
{ {
return GetValue().Abs() > ts.GetValue().Abs(); return GetValue().Abs() > ts.GetValue().Abs();
} }
@@ -463,8 +469,7 @@ bool wxTimeSpan::IsLongerThan(const wxTimeSpan& ts) const
// wxDateSpan // wxDateSpan
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
wxDateSpan& inline wxDateSpan& wxDateSpan::operator+=(const wxDateSpan& other)
wxDateSpan::operator+=(const wxDateSpan& other)
{ {
m_years += other.m_years; m_years += other.m_years;
m_months += other.m_months; m_months += other.m_months;
@@ -474,7 +479,7 @@ wxDateSpan::operator+=(const wxDateSpan& other)
return *this; return *this;
} }
wxDateSpan& wxDateSpan::Multiply(int factor) inline wxDateSpan& wxDateSpan::Multiply(int factor)
{ {
m_years *= factor; m_years *= factor;
m_months *= factor; m_months *= factor;
@@ -484,17 +489,17 @@ wxDateSpan& wxDateSpan::Multiply(int factor)
return *this; return *this;
} }
wxDateSpan wxDateSpan::Multiply(int factor) const inline wxDateSpan wxDateSpan::Multiply(int factor) const
{ {
return wxDateSpan(*this).Multiply(factor); return wxDateSpan(*this).Multiply(factor);
} }
wxDateSpan wxDateSpan::Negate() const inline wxDateSpan wxDateSpan::Negate() const
{ {
return wxDateSpan(-m_years, -m_months, -m_weeks, -m_days); return wxDateSpan(-m_years, -m_months, -m_weeks, -m_days);
} }
wxDateSpan& wxDateSpan::Neg() inline wxDateSpan& wxDateSpan::Neg()
{ {
m_years = -m_years; m_years = -m_years;
m_months = -m_months; m_months = -m_months;

View File

@@ -121,7 +121,7 @@ private:
*m_pPrev; // previous one *m_pPrev; // previous one
}; };
class wxFileConfig : public wxConfigBase class WXDLLEXPORT wxFileConfig : public wxConfigBase
{ {
public: public:
// construct the "standard" full name for global (system-wide) and // construct the "standard" full name for global (system-wide) and

View File

@@ -200,8 +200,8 @@ private:
// defines a new type safe hash table which stores the elements of type eltype // defines a new type safe hash table which stores the elements of type eltype
// in lists of class listclass // in lists of class listclass
#define WX_DECLARE_HASH(eltype, listclass, hashclass) \ #define _WX_DECLARE_HASH(eltype, listclass, hashclass, classexp) \
class WXDLLEXPORT hashclass : public wxHashTableBase \ classexp hashclass : public wxHashTableBase \
{ \ { \
public: \ public: \
hashclass(wxKeyType keyType = wxKEY_INTEGER, \ hashclass(wxKeyType keyType = wxKEY_INTEGER, \
@@ -258,5 +258,14 @@ private:
} \ } \
} }
// this macro is to be used in the user code
#define WX_DECLARE_HASH(el, list, hash) \
_WX_DECLARE_HASH(el, list, hash, class)
// and this one does exactly the same thing but should be used inside the
// library
#define WX_DECLARE_EXPORTED_HASH(el, list, hash) \
_WX_DECLARE_HASH(el, list, hash, class WXDLLEXPORT)
#endif #endif
// _WX_HASH_H__ // _WX_HASH_H__

View File

@@ -353,10 +353,10 @@ private:
// wxWindowBase pointers are put into the list, but wxWindow pointers are // wxWindowBase pointers are put into the list, but wxWindow pointers are
// retrieved from it. // retrieved from it.
#define WX_DECLARE_LIST_3(T, Tbase, name, nodetype) \ #define WX_DECLARE_LIST_3(T, Tbase, name, nodetype, classexp) \
typedef int (*wxSortFuncFor_##name)(const T **, const T **); \ typedef int (*wxSortFuncFor_##name)(const T **, const T **); \
\ \
class WXDLLEXPORT nodetype : public wxNodeBase \ classexp nodetype : public wxNodeBase \
{ \ { \
public: \ public: \
nodetype(wxListBase *list = (wxListBase *)NULL, \ nodetype(wxListBase *list = (wxListBase *)NULL, \
@@ -379,7 +379,7 @@ private:
virtual void DeleteData(); \ virtual void DeleteData(); \
}; \ }; \
\ \
class WXDLLEXPORT name : public wxListBase \ classexp name : public wxListBase \
{ \ { \
public: \ public: \
typedef nodetype Node; \ typedef nodetype Node; \
@@ -447,12 +447,16 @@ private:
} \ } \
} }
#define WX_DECLARE_LIST_2(elementtype, listname, nodename) \ #define WX_DECLARE_LIST_2(elementtype, listname, nodename, classexp) \
WX_DECLARE_LIST_3(elementtype, elementtype, listname, nodename) WX_DECLARE_LIST_3(elementtype, elementtype, listname, nodename, classexp)
#define WX_DECLARE_LIST(elementtype, listname) \ #define WX_DECLARE_LIST(elementtype, listname) \
typedef elementtype _WX_LIST_ITEM_TYPE_##listname; \ typedef elementtype _WX_LIST_ITEM_TYPE_##listname; \
WX_DECLARE_LIST_2(elementtype, listname, wx##listname##Node) WX_DECLARE_LIST_2(elementtype, listname, wx##listname##Node, class)
#define WX_DECLARE_EXPORTED_LIST(elementtype, listname) \
typedef elementtype _WX_LIST_ITEM_TYPE_##listname; \
WX_DECLARE_LIST_2(elementtype, listname, wx##listname##Node, class WXDLLEXPORT)
// this macro must be inserted in your program after // this macro must be inserted in your program after
// #include <wx/listimpl.cpp> // #include <wx/listimpl.cpp>
@@ -472,7 +476,7 @@ private:
// wxList compatibility class: in fact, it's a list of wxObjects // wxList compatibility class: in fact, it's a list of wxObjects
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
WX_DECLARE_LIST_2(wxObject, wxObjectList, wxObjectListNode); WX_DECLARE_LIST_2(wxObject, wxObjectList, wxObjectListNode, class WXDLLEXPORT);
class WXDLLEXPORT wxList : public wxObjectList class WXDLLEXPORT wxList : public wxObjectList
{ {
@@ -489,7 +493,7 @@ public:
// wxStringList class for compatibility with the old code // wxStringList class for compatibility with the old code
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
WX_DECLARE_LIST_2(wxChar, wxStringListBase, wxStringListNode); WX_DECLARE_LIST_2(wxChar, wxStringListBase, wxStringListNode, class WXDLLEXPORT);
class WXDLLEXPORT wxStringList : public wxStringListBase class WXDLLEXPORT wxStringList : public wxStringListBase
{ {

View File

@@ -10,7 +10,7 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#define _DEFINE_LIST(T, name) \ #define _DEFINE_LIST(T, name) \
void wx##name##Node::DeleteData() \ inline void wx##name##Node::DeleteData() \
{ \ { \
delete (T *)GetData(); \ delete (T *)GetData(); \
} }

View File

@@ -32,8 +32,8 @@ class WXDLLEXPORT wxMenuBar;
class WXDLLEXPORT wxMenuItem; class WXDLLEXPORT wxMenuItem;
// pseudo template list classes // pseudo template list classes
WX_DECLARE_LIST(wxMenu, wxMenuList); WX_DECLARE_EXPORTED_LIST(wxMenu, wxMenuList);
WX_DECLARE_LIST(wxMenuItem, wxMenuItemList); WX_DECLARE_EXPORTED_LIST(wxMenuItem, wxMenuItemList);
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// conditional compilation // conditional compilation

View File

@@ -21,7 +21,7 @@
// declare a linked list of modules // declare a linked list of modules
class wxModule; class wxModule;
WX_DECLARE_LIST(wxModule, wxModuleList); WX_DECLARE_EXPORTED_LIST(wxModule, wxModuleList);
// declaring a class derived from wxModule will automatically create an // declaring a class derived from wxModule will automatically create an
// instance of this class on program startup, call its OnInit() method and call // instance of this class on program startup, call its OnInit() method and call

View File

@@ -216,6 +216,8 @@ extern LONG APIENTRY _EXPORT
#define wxZeroMemory(obj) memset((void*) & obj, 0, sizeof(obj)) #define wxZeroMemory(obj) memset((void*) & obj, 0, sizeof(obj))
#endif #endif
#if wxUSE_GUI
#include <wx/gdicmn.h> #include <wx/gdicmn.h>
// make conversion from wxColour and COLORREF a bit less painful // make conversion from wxColour and COLORREF a bit less painful
@@ -314,15 +316,12 @@ private:
#define GetHcursor() ((HCURSOR)GetHCURSOR()) #define GetHcursor() ((HCURSOR)GetHCURSOR())
#define GetHcursorOf(cursor) ((HCURSOR)(cursor).GetHCURSOR()) #define GetHcursorOf(cursor) ((HCURSOR)(cursor).GetHCURSOR())
#endif // wxUSE_GUI
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// global data // global data
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
#if 0 // where is this??
// The MakeProcInstance version of the function wxSubclassedGenericControlProc
WXDLLEXPORT_DATA(extern FARPROC) wxGenericControlSubClassProc;
#endif // 0
WXDLLEXPORT_DATA(extern wxChar*) wxBuffer; WXDLLEXPORT_DATA(extern wxChar*) wxBuffer;
WXDLLEXPORT_DATA(extern HINSTANCE) wxhInstance; WXDLLEXPORT_DATA(extern HINSTANCE) wxhInstance;

View File

@@ -205,6 +205,12 @@ struct WXDLLEXPORT wxStringData
// lock/unlock // lock/unlock
void Lock() { if ( !IsEmpty() ) nRefs++; } void Lock() { if ( !IsEmpty() ) nRefs++; }
// VC++ will refuse to inline this function but profiling shows that it
// is wrong
#if defined(__VISUALC__) && defined(__WIN32__)
__forceinline
#endif
void Unlock() { if ( !IsEmpty() && --nRefs == 0) free(this); } void Unlock() { if ( !IsEmpty() && --nRefs == 0) free(this); }
// if we had taken control over string memory (GetWriteBuf), it's // if we had taken control over string memory (GetWriteBuf), it's

View File

@@ -206,7 +206,7 @@ protected:
}; };
// a list of toolbar tools // a list of toolbar tools
WX_DECLARE_LIST(wxToolBarToolBase, wxToolBarToolsList); WX_DECLARE_EXPORTED_LIST(wxToolBarToolBase, wxToolBarToolsList);
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// the base class for all toolbars // the base class for all toolbars

View File

@@ -58,7 +58,7 @@ class WXDLLEXPORT wxWindow;
// (pseudo)template list classes // (pseudo)template list classes
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
WX_DECLARE_LIST_3(wxWindow, wxWindowBase, wxWindowList, wxWindowListNode); WX_DECLARE_LIST_3(wxWindow, wxWindowBase, wxWindowList, wxWindowListNode, class WXDLLEXPORT);
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// global variables // global variables

View File

@@ -59,15 +59,22 @@ bool wxConfigBase::ms_bAutoCreate = TRUE;
// wxConfigBase // wxConfigBase
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// Not all args will always be used by derived classes, but // Not all args will always be used by derived classes, but including them all
// including them all in each class ensures compatibility. // in each class ensures compatibility.
wxConfigBase::wxConfigBase(const wxString& appName, const wxString& vendorName, wxConfigBase::wxConfigBase(const wxString& appName,
const wxString& WXUNUSED(localFilename), const wxString& WXUNUSED(globalFilename), long style): const wxString& vendorName,
m_appName(appName), m_vendorName(vendorName), m_style(style) const wxString& WXUNUSED(localFilename),
const wxString& WXUNUSED(globalFilename),
long style)
: m_appName(appName), m_vendorName(vendorName), m_style(style)
{ {
m_bExpandEnvVars = TRUE; m_bRecordDefaults = FALSE; m_bExpandEnvVars = TRUE; m_bRecordDefaults = FALSE;
} }
wxConfigBase::~wxConfigBase()
{
}
wxConfigBase *wxConfigBase::Set(wxConfigBase *pConfig) wxConfigBase *wxConfigBase::Set(wxConfigBase *pConfig)
{ {
wxConfigBase *pOld = ms_pConfig; wxConfigBase *pOld = ms_pConfig;
@@ -130,7 +137,7 @@ bool wxConfigBase::Read(const wxString& key, double* val) const
*val = wxAtof(str); *val = wxAtof(str);
return TRUE; return TRUE;
} }
else
return FALSE; return FALSE;
} }
@@ -400,7 +407,7 @@ void wxSplitPath(wxArrayString& aParts, const wxChar *sz)
// could log an error here, but we prefer to ignore extra '/' // could log an error here, but we prefer to ignore extra '/'
if ( *pc == wxT('\0') ) if ( *pc == wxT('\0') )
return; break;
} }
else else
strCurrent += *pc; strCurrent += *pc;

View File

@@ -3446,7 +3446,7 @@ wxString wxTimeSpan::Format(const wxChar *format) const
#include "wx/arrimpl.cpp" #include "wx/arrimpl.cpp"
WX_DEFINE_OBJARRAY(wxDateTimeArray) WX_DEFINE_OBJARRAY(wxDateTimeArray);
static int wxCMPFUNC_CONV static int wxCMPFUNC_CONV
wxDateTimeCompareFunc(wxDateTime **first, wxDateTime **second) wxDateTimeCompareFunc(wxDateTime **first, wxDateTime **second)

View File

@@ -684,11 +684,10 @@ bool wxFileConfig::Read(const wxString& key,
if (pEntry == NULL) { if (pEntry == NULL) {
return FALSE; return FALSE;
} }
else {
*pStr = ExpandEnvVars(pEntry->Value()); *pStr = ExpandEnvVars(pEntry->Value());
return TRUE; return TRUE;
} }
}
bool wxFileConfig::Read(const wxString& key, bool wxFileConfig::Read(const wxString& key,
wxString* pStr, const wxString& defVal) const wxString* pStr, const wxString& defVal) const
@@ -696,28 +695,31 @@ bool wxFileConfig::Read(const wxString& key,
wxConfigPathChanger path(this, key); wxConfigPathChanger path(this, key);
ConfigEntry *pEntry = m_pCurrentGroup->FindEntry(path.Name()); ConfigEntry *pEntry = m_pCurrentGroup->FindEntry(path.Name());
bool ok;
if (pEntry == NULL) { if (pEntry == NULL) {
if( IsRecordingDefaults() ) if( IsRecordingDefaults() )
((wxFileConfig *)this)->Write(key,defVal); ((wxFileConfig *)this)->Write(key,defVal);
*pStr = ExpandEnvVars(defVal); *pStr = ExpandEnvVars(defVal);
return FALSE; ok = FALSE;
} }
else { else {
*pStr = ExpandEnvVars(pEntry->Value()); *pStr = ExpandEnvVars(pEntry->Value());
return TRUE; ok = TRUE;
} }
return ok;
} }
bool wxFileConfig::Read(const wxString& key, long *pl) const bool wxFileConfig::Read(const wxString& key, long *pl) const
{ {
wxString str; wxString str;
if ( Read(key, & str) ) { if ( !Read(key, & str) )
*pl = wxAtol(str); {
return TRUE;
}
else {
return FALSE; return FALSE;
} }
*pl = wxAtol(str);
return TRUE;
} }
bool wxFileConfig::Write(const wxString& key, const wxString& szValue) bool wxFileConfig::Write(const wxString& key, const wxString& szValue)

View File

@@ -1485,9 +1485,9 @@ wxString wxFindFirstFile(const wxChar *spec, int flags)
result += gs_findDataStruct.cFileName; result += gs_findDataStruct.cFileName;
return result; return result;
#else #else // !Win32
int flag = _A_NORMAL; int flag = _A_NORMAL;
if (flags & wxDIR) /* MATTHEW: [5] Use & */ if (flags & wxDIR)
flag = _A_SUBDIR; flag = _A_SUBDIR;
#ifdef __BORLANDC__ #ifdef __BORLANDC__
@@ -1496,7 +1496,6 @@ wxString wxFindFirstFile(const wxChar *spec, int flags)
if (_dos_findfirst(WXSTRINGCAST spec, flag, &gs_findDataStruct) == 0) if (_dos_findfirst(WXSTRINGCAST spec, flag, &gs_findDataStruct) == 0)
#endif #endif
{ {
/* MATTHEW: [5] Check directory flag */
char attrib; char attrib;
#ifdef __BORLANDC__ #ifdef __BORLANDC__
@@ -1519,9 +1518,9 @@ wxString wxFindFirstFile(const wxChar *spec, int flags)
#endif #endif
; ;
} }
#endif // __WIN32__
return result; return result;
#endif // __WIN32__
} }
@@ -1591,9 +1590,9 @@ try_again:
#endif #endif
; ;
} }
#endif // Win32/16
return result; return result;
#endif // Win32/16
} }
#elif defined(__WXPM__) #elif defined(__WXPM__)
@@ -1771,7 +1770,7 @@ bool wxFindFileInPath(wxString *pStr, const wxChar *pszPath, const wxChar *pszFi
{ {
// we assume that it's not empty // we assume that it's not empty
wxCHECK_MSG( !wxIsEmpty(pszFile), FALSE, wxCHECK_MSG( !wxIsEmpty(pszFile), FALSE,
_("empty file name in wxFindFileInPath")); _T("empty file name in wxFindFileInPath"));
// skip path separator in the beginning of the file name if present // skip path separator in the beginning of the file name if present
if ( wxIsPathSeparator(*pszFile) ) if ( wxIsPathSeparator(*pszFile) )
@@ -1868,8 +1867,6 @@ void WXDLLEXPORT wxSplitPath(const wxChar *pszFileName,
} }
} }
time_t WXDLLEXPORT wxFileModificationTime(const wxString& filename) time_t WXDLLEXPORT wxFileModificationTime(const wxString& filename)
{ {
struct stat buf; struct stat buf;

View File

@@ -35,7 +35,7 @@
// global vars // global vars
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
wxApp * WXDLLEXPORT wxTheApp = NULL; WXDLLEXPORT wxApp *wxTheApp = NULL;
wxAppInitializerFunction wxAppInitializerFunction
wxAppBase::m_appInitFn = (wxAppInitializerFunction)NULL; wxAppBase::m_appInitFn = (wxAppInitializerFunction)NULL;

View File

@@ -220,22 +220,20 @@ bool wxTCPServer::Create(const wxString& serverName)
// Create a socket listening on the specified port // Create a socket listening on the specified port
m_server = new wxSocketServer(addr, SCKIPC_FLAGS); m_server = new wxSocketServer(addr, SCKIPC_FLAGS);
if (m_server->Ok()) if (!m_server->Ok())
{
m_server->SetEventHandler(*gs_handler, _SERVER_ONREQUEST_ID);
m_server->SetClientData(this);
m_server->SetNotify(wxSOCKET_CONNECTION_FLAG);
m_server->Notify(TRUE);
return TRUE;
}
else
{ {
m_server->Destroy(); m_server->Destroy();
m_server = NULL; m_server = NULL;
return FALSE; return FALSE;
} }
m_server->SetEventHandler(*gs_handler, _SERVER_ONREQUEST_ID);
m_server->SetClientData(this);
m_server->SetNotify(wxSOCKET_CONNECTION_FLAG);
m_server->Notify(TRUE);
return TRUE;
} }
wxTCPServer::~wxTCPServer() wxTCPServer::~wxTCPServer()

View File

@@ -1352,8 +1352,8 @@ bool wxVariant::operator== (const wxString& value) const
wxString thisValue; wxString thisValue;
if (!Convert(&thisValue)) if (!Convert(&thisValue))
return FALSE; return FALSE;
else
return (value == thisValue); return value == thisValue;
} }
bool wxVariant::operator!= (const wxString& value) const bool wxVariant::operator!= (const wxString& value) const
@@ -1450,8 +1450,8 @@ bool wxVariant::operator== (const wxTime& value) const
wxTime thisValue; wxTime thisValue;
if (!Convert(&thisValue)) if (!Convert(&thisValue))
return FALSE; return FALSE;
else
return (value == thisValue); return value == thisValue;
} }
bool wxVariant::operator!= (const wxTime& value) const bool wxVariant::operator!= (const wxTime& value) const
@@ -1478,7 +1478,7 @@ bool wxVariant::operator== (const wxDate& value) const
wxDate thisValue; wxDate thisValue;
if (!Convert(&thisValue)) if (!Convert(&thisValue))
return FALSE; return FALSE;
else
return (value == thisValue); return (value == thisValue);
} }
@@ -1668,13 +1668,12 @@ bool wxVariant::GetBool() const
wxString wxVariant::GetString() const wxString wxVariant::GetString() const
{ {
wxString value; wxString value;
if (Convert(& value)) if (!Convert(& value))
return value;
else
{ {
wxFAIL_MSG(wxT("Could not convert to a string")); wxFAIL_MSG(wxT("Could not convert to a string"));
return wxString("");
} }
return value;
} }
// For some reason, Watcom C++ can't link variant.cpp with time/date classes compiled // For some reason, Watcom C++ can't link variant.cpp with time/date classes compiled
@@ -1682,27 +1681,25 @@ wxString wxVariant::GetString() const
wxTime wxVariant::GetTime() const wxTime wxVariant::GetTime() const
{ {
wxTime value; wxTime value;
if (Convert(& value)) if (!Convert(& value))
return value;
else
{ {
wxFAIL_MSG(wxT("Could not convert to a time")); wxFAIL_MSG(wxT("Could not convert to a time"));
return wxTime();
} }
return value;
} }
wxDate wxVariant::GetDate() const wxDate wxVariant::GetDate() const
{ {
wxDate value; wxDate value;
if (Convert(& value)) if (!Convert(& value))
return value;
else
{ {
wxFAIL_MSG(wxT("Could not convert to a date")); wxFAIL_MSG(wxT("Could not convert to a date"));
return wxDate();
} }
return value;
} }
#endif #endif // wxUSE_TIMEDATE
void* wxVariant::GetVoidPtr() const void* wxVariant::GetVoidPtr() const
{ {

View File

@@ -227,12 +227,8 @@ bool wxFileTypeImpl::GetMimeType(wxString *mimeType) const
// suppress possible error messages // suppress possible error messages
wxLogNull nolog; wxLogNull nolog;
wxRegKey key(wxRegKey::HKCR, wxT(".") + m_ext); wxRegKey key(wxRegKey::HKCR, wxT(".") + m_ext);
if ( key.Open() && key.QueryValue(wxT("Content Type"), *mimeType) ) {
return TRUE; return key.Open() && key.QueryValue(wxT("Content Type"), *mimeType);
}
else {
return FALSE;
}
} }
@@ -240,15 +236,15 @@ bool wxFileTypeImpl::GetMimeTypes(wxArrayString& mimeTypes) const
{ {
wxString s; wxString s;
if (GetMimeType(&s)) if ( !GetMimeType(&s) )
{ {
return FALSE;
}
mimeTypes.Clear(); mimeTypes.Clear();
mimeTypes.Add(s); mimeTypes.Add(s);
return TRUE; return TRUE;
} }
else
return FALSE;
}
bool wxFileTypeImpl::GetIcon(wxIcon *icon) const bool wxFileTypeImpl::GetIcon(wxIcon *icon) const
@@ -378,18 +374,16 @@ wxMimeTypesManagerImpl::GetFileTypeFromExtension(const wxString& ext)
} }
} }
if ( knownExtension ) if ( !knownExtension )
{
wxFileType *fileType = new wxFileType;
fileType->m_impl->Init(wxEmptyString, ext);
return fileType;
}
else
{ {
// unknown extension // unknown extension
return NULL; return NULL;
} }
wxFileType *fileType = new wxFileType;
fileType->m_impl->Init(wxEmptyString, ext);
return fileType;
} }
// MIME type -> extension -> file type // MIME type -> extension -> file type

View File

@@ -709,12 +709,11 @@ bool wxRegKey::HasValue(const wxChar *szValue) const
wxLogNull nolog; wxLogNull nolog;
#ifdef __WIN32__ #ifdef __WIN32__
if ( CONST_CAST Open() ) { if ( !CONST_CAST Open() )
return FALSE;
return RegQueryValueEx((HKEY) m_hKey, WXSTRINGCAST szValue, RESERVED, return RegQueryValueEx((HKEY) m_hKey, WXSTRINGCAST szValue, RESERVED,
NULL, NULL, NULL) == ERROR_SUCCESS; NULL, NULL, NULL) == ERROR_SUCCESS;
}
else
return FALSE;
#else // WIN16 #else // WIN16
// only unnamed value exists // only unnamed value exists
return IsEmpty(szValue); return IsEmpty(szValue);
@@ -751,10 +750,10 @@ bool wxRegKey::HasSubKey(const wxChar *szKey) const
// this function should be silent, so suppress possible messages from Open() // this function should be silent, so suppress possible messages from Open()
wxLogNull nolog; wxLogNull nolog;
if ( CONST_CAST Open() ) if ( !CONST_CAST Open() )
return KeyExists(m_hKey, szKey);
else
return FALSE; return FALSE;
return KeyExists(m_hKey, szKey);
} }
wxRegKey::ValueType wxRegKey::GetValueType(const wxChar *szValue) const wxRegKey::ValueType wxRegKey::GetValueType(const wxChar *szValue) const

View File

@@ -186,7 +186,7 @@ void wxStatusBar95::CopyFieldsWidth(const int widths[])
void wxStatusBar95::SetFieldsCount(int nFields, const int *widths) void wxStatusBar95::SetFieldsCount(int nFields, const int *widths)
{ {
// this is Windows limitation // this is a Windows limitation
wxASSERT_MSG( (nFields > 0) && (nFields < 255), _T("too many fields") ); wxASSERT_MSG( (nFields > 0) && (nFields < 255), _T("too many fields") );
m_nFields = nFields; m_nFields = nFields;

View File

@@ -910,8 +910,6 @@ bool wxCheckForInterrupt(wxWindow *wnd)
return TRUE; return TRUE;
} }
#endif // wxUSE_GUI
// MSW only: get user-defined resource from the .res file. // MSW only: get user-defined resource from the .res file.
// Returns NULL or newly-allocated memory, so use delete[] to clean up. // Returns NULL or newly-allocated memory, so use delete[] to clean up.
@@ -1052,6 +1050,8 @@ WXWORD WXDLLEXPORT wxGetWindowId(WXHWND hWnd)
#endif // Win16/32 #endif // Win16/32
} }
#endif // wxUSE_GUI
#if 0 #if 0
//------------------------------------------------------------------------ //------------------------------------------------------------------------
// wild character routines // wild character routines
@@ -1209,7 +1209,7 @@ bool wxMatchWild( const wxString& pat, const wxString& text, bool dot_special )
return ((*str == '\0') && (*pattern == '\0')); return ((*str == '\0') && (*pattern == '\0'));
}; };
#endif #endif // 0
#if 0 #if 0

View File

@@ -657,6 +657,8 @@ long wxExecute(char **argv, bool sync, wxProcess *handler)
return wxExecute(command, sync, handler); return wxExecute(command, sync, handler);
} }
#if wxUSE_GUI
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// Metafile helpers // Metafile helpers
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -690,3 +692,5 @@ extern void HIMETRICToPixel(LONG *x, LONG *y)
*y *= iHeightPels; *y *= iHeightPels;
*y /= (iHeightMM * 100); *y /= (iHeightMM * 100);
} }
#endif // wxUSE_GUI