Warning fixes for WinCE.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@27881 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Włodzimierz Skiba
2004-06-18 09:48:15 +00:00
parent ed679e7422
commit 991420e6df
6 changed files with 109 additions and 101 deletions

View File

@@ -27,13 +27,17 @@
# pragma warning(disable:4100) # pragma warning(disable:4100)
#ifdef __WXWINCE__ #ifdef __WXWINCE__
/* /* windows.h results in tons of warnings at max warning level */
"unreferenced inline function has been removed": this is not # ifdef _MSC_VER
suppressed by push above as it is given at the end of the # pragma warning(push, 1)
compilation unit # endif
*/ # include <windows.h>
# pragma warning(disable:4514) # ifdef _MSC_VER
#endif /* __WXWINCE__ */ # pragma warning(pop)
# pragma warning(disable:4514)
# endif
#endif
#endif /* _MSC_VER */ #endif /* _MSC_VER */
#include <winsock.h> #include <winsock.h>
@@ -780,7 +784,7 @@ GSocketEventFlags GSocket_Select(GSocket *socket, GSocketEventFlags flags)
FD_ZERO(&writefds); FD_ZERO(&writefds);
FD_ZERO(&exceptfds); FD_ZERO(&exceptfds);
FD_SET(socket->m_fd, &readfds); FD_SET(socket->m_fd, &readfds);
if (flags & GSOCK_OUTPUT_FLAG || flags & GSOCK_CONNECTION_FLAG) if (flags & GSOCK_OUTPUT_FLAG || flags & GSOCK_CONNECTION_FLAG)
FD_SET(socket->m_fd, &writefds); FD_SET(socket->m_fd, &writefds);
FD_SET(socket->m_fd, &exceptfds); FD_SET(socket->m_fd, &exceptfds);
@@ -799,7 +803,7 @@ GSocketEventFlags GSocket_Select(GSocket *socket, GSocketEventFlags flags)
/* Try select now */ /* Try select now */
if (select(socket->m_fd + 1, &readfds, &writefds, &exceptfds, if (select(socket->m_fd + 1, &readfds, &writefds, &exceptfds,
&socket->m_timeout) <= 0) &socket->m_timeout) <= 0)
{ {
/* What to do here? */ /* What to do here? */
return (result & flags); return (result & flags);

View File

@@ -35,16 +35,11 @@
/* windows.h results in tons of warnings at max warning level */ /* windows.h results in tons of warnings at max warning level */
# ifdef _MSC_VER # ifdef _MSC_VER
# pragma warning(push, 1) # pragma warning(push, 1)
/*
"unreferenced inline function has been removed": this is not
suppressed by push above as it is given at the end of the
compilation unit
*/
# pragma warning(disable:4514)
# endif # endif
# include <windows.h> # include <windows.h>
# ifdef _MSC_VER # ifdef _MSC_VER
# pragma warning(pop) # pragma warning(pop)
# pragma warning(disable:4514)
# endif # endif
#endif #endif

View File

@@ -420,10 +420,11 @@ bool wxTopLevelWindowMSW::CreateFrame(const wxString& title,
#if !defined(__HANDHELDPC__) && ((defined(_WIN32_WCE) && _WIN32_WCE < 400) || \ #if !defined(__HANDHELDPC__) && ((defined(_WIN32_WCE) && _WIN32_WCE < 400) || \
defined(__POCKETPC__) || \ defined(__POCKETPC__) || \
defined(__SMARTPHONE__)) defined(__SMARTPHONE__))
// Always expand to fit the screen in PocketPC or SmartPhone // Always expand to fit the screen in PocketPC or SmartPhone
wxSize sz(wxDefaultSize); wxSize sz(wxDefaultSize);
wxUnusedVar(size);
#else // other (including normal desktop) Windows #else // other (including normal desktop) Windows
wxSize sz(size); wxSize sz(size);
#endif #endif
return MSWCreate(wxCanvasClassName, title, pos, sz, flags, exflags); return MSWCreate(wxCanvasClassName, title, pos, sz, flags, exflags);
@@ -519,12 +520,12 @@ bool wxTopLevelWindowMSW::Create(wxWindow *parent,
); );
} }
// Native look is full screen window on Smartphones and Standard SDK // Native look is full screen window on Smartphones and Standard SDK
#if defined(__WXWINCE__) #if defined(__WXWINCE__)
if ( style & wxMAXIMIZE ) if ( style & wxMAXIMIZE )
{ {
this->Maximize(); this->Maximize();
} }
#endif #endif
#ifdef __SMARTPHONE__ #ifdef __SMARTPHONE__
@@ -576,9 +577,9 @@ bool wxTopLevelWindowMSW::Show(bool show)
// show and maximize // show and maximize
nShowCmd = SW_MAXIMIZE; nShowCmd = SW_MAXIMIZE;
// This is necessary, or no window appears // This is necessary, or no window appears
#ifdef __WINCE_STANDARDSDK__ #ifdef __WINCE_STANDARDSDK__
DoShowWindow(SW_SHOW); DoShowWindow(SW_SHOW);
#endif #endif
m_maximizeOnShow = FALSE; m_maximizeOnShow = FALSE;

View File

@@ -918,11 +918,12 @@ bool wxToolBar::MSWOnNotify(int WXUNUSED(idCtrl),
wxToolBarToolBase *tool = FindById(id); wxToolBarToolBase *tool = FindById(id);
if ( !tool ) if ( !tool )
return FALSE; return false;
return HandleTooltipNotify(code, lParam, tool->GetShortHelp()); return HandleTooltipNotify(code, lParam, tool->GetShortHelp());
#else #else
return FALSE; wxUnusedVar(lParam);
return false;
#endif #endif
} }
@@ -1133,7 +1134,7 @@ void wxToolBar::OnMouseEvent(wxMouseEvent& event)
} }
} }
void wxToolBar::HandleMouseMove(WXWPARAM wParam, WXLPARAM lParam) void wxToolBar::HandleMouseMove(WXWPARAM WXUNUSED(wParam), WXLPARAM lParam)
{ {
wxCoord x = GET_X_LPARAM(lParam), wxCoord x = GET_X_LPARAM(lParam),
y = GET_Y_LPARAM(lParam); y = GET_Y_LPARAM(lParam);

View File

@@ -5,7 +5,7 @@
// Modified by: // Modified by:
// Created: 31-08-2003 // Created: 31-08-2003
// RCS-ID: // RCS-ID:
// Copyright: (c) Marco Cavallini // Copyright: (c) Marco Cavallini
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
@@ -36,65 +36,65 @@
#include <winbase.h> #include <winbase.h>
#define is_leap(y) (y % 4 == 0 && (y % 100 != 0 || y % 400 == 0)) #define is_leap(y) (y % 4 == 0 && (y % 100 != 0 || y % 400 == 0))
#define SECONDS_IN_ONE_MINUTE 60 #define SECONDS_IN_ONE_MINUTE 60
#define DAYS_IN_ONE_YEAR 365 #define DAYS_IN_ONE_YEAR 365
#define SECONDS_IN_ONE_MIN 60 #define SECONDS_IN_ONE_MIN 60
#define SECONDS_IN_ONE_HOUR 3600 #define SECONDS_IN_ONE_HOUR 3600
#define SECONDS_IN_ONE_DAY 86400 #define SECONDS_IN_ONE_DAY 86400
#define DEFAULT_TIMEZONE 28800 #define DEFAULT_TIMEZONE 28800
#define DO_GMTIME 0 #define DO_GMTIME 0
#define DO_LOCALTIME 1 #define DO_LOCALTIME 1
long timezone ; // global variable long timezone ; // global variable
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
// Common code for localtime and gmtime (static) // Common code for localtime and gmtime (static)
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
static struct tm * __cdecl common_localtime(const time_t * t, BOOL bLocal) static struct tm * __cdecl common_localtime(const time_t * WXUNUSED(t), BOOL bLocal)
{ {
wxString str ; wxString str ;
SYSTEMTIME SystemTime; SYSTEMTIME SystemTime;
TIME_ZONE_INFORMATION pTz; TIME_ZONE_INFORMATION pTz;
static struct tm st_res ; // data holder static struct tm st_res ; // data holder
static struct tm * res = &st_res ; // data pointer static struct tm * res = &st_res ; // data pointer
int iLeap; int iLeap;
const unsigned short int __mon_yday[2][13] = const unsigned short int __mon_yday[2][13] =
{ {
// Normal years // Normal years
{ 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 }, { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 },
// Leap years // Leap years
{ 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366 } { 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366 }
}; };
::GetLocalTime(&SystemTime) ; ::GetLocalTime(&SystemTime) ;
::GetTimeZoneInformation(&pTz); ::GetTimeZoneInformation(&pTz);
/////////////////////////////////////////////// ///////////////////////////////////////////////
// Set timezone // Set timezone
timezone = pTz.Bias * SECONDS_IN_ONE_MINUTE ; timezone = pTz.Bias * SECONDS_IN_ONE_MINUTE ;
/////////////////////////////////////////////// ///////////////////////////////////////////////
iLeap = is_leap(SystemTime.wYear) ; iLeap = is_leap(SystemTime.wYear) ;
res->tm_hour = SystemTime.wHour; res->tm_hour = SystemTime.wHour;
res->tm_min = SystemTime.wMinute; res->tm_min = SystemTime.wMinute;
res->tm_sec = SystemTime.wSecond; res->tm_sec = SystemTime.wSecond;
res->tm_mday = SystemTime.wDay; res->tm_mday = SystemTime.wDay;
res->tm_mon = SystemTime.wMonth - 1;// this the correct month but localtime returns month aligned to zero res->tm_mon = SystemTime.wMonth - 1; // this the correct month but localtime returns month aligned to zero
res->tm_year = SystemTime.wYear; // this the correct year res->tm_year = SystemTime.wYear; // this the correct year
res->tm_year = res->tm_year - 1900; // but localtime returns the value starting at the 1900 res->tm_year = res->tm_year - 1900; // but localtime returns the value starting at the 1900
res->tm_wday = SystemTime.wDayOfWeek; res->tm_wday = SystemTime.wDayOfWeek;
res->tm_yday = __mon_yday[iLeap][res->tm_mon] + SystemTime.wDay - 1; // localtime returns year-day aligned to zero res->tm_yday = __mon_yday[iLeap][res->tm_mon] + SystemTime.wDay - 1; // localtime returns year-day aligned to zero
// if localtime behavior and daylight saving // if localtime behavior and daylight saving
if (bLocal && pTz.DaylightBias != 0) if (bLocal && pTz.DaylightBias != 0)
res->tm_isdst = 1; res->tm_isdst = 1;
else else
res->tm_isdst = 0; // without daylight saving or gmtime res->tm_isdst = 0; // without daylight saving or gmtime
return res; return res;
} }
@@ -105,7 +105,7 @@ static struct tm * __cdecl common_localtime(const time_t * t, BOOL bLocal)
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
struct tm * __cdecl localtime(const time_t * t) struct tm * __cdecl localtime(const time_t * t)
{ {
return common_localtime(t, DO_LOCALTIME) ; return common_localtime(t, DO_LOCALTIME) ;
} }
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
@@ -114,7 +114,7 @@ struct tm * __cdecl localtime(const time_t * t)
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
struct tm * __cdecl gmtime(const time_t *t) struct tm * __cdecl gmtime(const time_t *t)
{ {
return common_localtime(t, DO_GMTIME) ; return common_localtime(t, DO_GMTIME) ;
} }
@@ -123,26 +123,26 @@ struct tm * __cdecl gmtime(const time_t *t)
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
static time_t __cdecl common_tm_to_time(int day, int month, int year, int hour, int minute, int second) static time_t __cdecl common_tm_to_time(int day, int month, int year, int hour, int minute, int second)
{ {
time_t prog = 0 ; time_t prog = 0 ;
static int mdays[12] = { 31,28,31,30,31,30,31,31,30,31,30,31 } ; static int mdays[12] = { 31,28,31,30,31,30,31,31,30,31,30,31 } ;
while (--month) while (--month)
{ {
prog += mdays[month - 1] ; prog += mdays[month - 1] ;
if (month == 2 && is_leap(year)) if (month == 2 && is_leap(year))
prog++ ; prog++ ;
} }
// Calculate seconds in elapsed days // Calculate seconds in elapsed days
prog = day - 1 ; // align first day of the year to zero prog = day - 1 ; // align first day of the year to zero
prog += (DAYS_IN_ONE_YEAR * (year - 1970) + (year - 1901) / 4 - 19) ; prog += (DAYS_IN_ONE_YEAR * (year - 1970) + (year - 1901) / 4 - 19) ;
prog *= SECONDS_IN_ONE_DAY ; prog *= SECONDS_IN_ONE_DAY ;
// Add Calculated elapsed seconds in the current day // Add Calculated elapsed seconds in the current day
prog += (hour * SECONDS_IN_ONE_HOUR + minute * prog += (hour * SECONDS_IN_ONE_HOUR + minute *
SECONDS_IN_ONE_MIN + second) ; SECONDS_IN_ONE_MIN + second) ;
return prog ; return prog ;
} }
@@ -152,19 +152,19 @@ static time_t __cdecl common_tm_to_time(int day, int month, int year, int hour,
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
time_t __cdecl time(time_t *t) time_t __cdecl time(time_t *t)
{ {
time_t prog = 0 ; time_t prog = 0 ;
if (t != NULL) if (t != NULL)
{ {
SYSTEMTIME SystemTime; SYSTEMTIME SystemTime;
::GetLocalTime(&SystemTime) ; ::GetLocalTime(&SystemTime) ;
prog = common_tm_to_time(SystemTime.wDay, SystemTime.wMonth, SystemTime.wYear, prog = common_tm_to_time(SystemTime.wDay, SystemTime.wMonth, SystemTime.wYear,
SystemTime.wHour, SystemTime.wMinute, SystemTime.wSecond) ; SystemTime.wHour, SystemTime.wMinute, SystemTime.wSecond) ;
*t = prog ; *t = prog ;
} }
return prog ; return prog ;
} }
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
@@ -173,7 +173,7 @@ time_t __cdecl time(time_t *t)
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
time_t __cdecl mktime(struct tm *t) time_t __cdecl mktime(struct tm *t)
{ {
return (common_tm_to_time(t->tm_mday, t->tm_mon+1, t->tm_year+1900, t->tm_hour, t->tm_min, t->tm_sec)) ; return (common_tm_to_time(t->tm_mday, t->tm_mon+1, t->tm_year+1900, t->tm_hour, t->tm_min, t->tm_sec)) ;
} }

View File

@@ -4710,6 +4710,9 @@ int wxWindowMSW::HandleMenuChar(int chAccel, WXLPARAM lParam)
wxLogLastError(_T("GetMenuItemInfo")); wxLogLastError(_T("GetMenuItemInfo"));
} }
} }
#else
wxUnusedVar(chAccel);
wxUnusedVar(lParam);
#endif #endif
return wxNOT_FOUND; return wxNOT_FOUND;
} }
@@ -4798,6 +4801,10 @@ bool wxWindowMSW::HandleJoystickEvent(WXUINT msg, int x, int y, WXUINT flags)
return GetEventHandler()->ProcessEvent(event); return GetEventHandler()->ProcessEvent(event);
#else #else
wxUnusedVar(msg);
wxUnusedVar(x);
wxUnusedVar(y);
wxUnusedVar(flags);
return false; return false;
#endif #endif
} }