X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/74639764d0076ce477ed3d69827061063f4b5e9a..89579a60d7ba7da32777647ad7647af69ec4e687:/src/common/utilscmn.cpp?ds=sidebyside diff --git a/src/common/utilscmn.cpp b/src/common/utilscmn.cpp index 303e31881f..48cda637a5 100644 --- a/src/common/utilscmn.cpp +++ b/src/common/utilscmn.cpp @@ -287,22 +287,20 @@ wxString wxGetDataDir() return dir; } -int wxGetOsVersion(int *verMaj, int *verMin) +bool wxIsPlatformLittleEndian() { - // we want this function to work even if there is no wxApp - wxConsoleAppTraits traitsConsole; - wxAppTraits *traits = wxTheApp ? wxTheApp->GetTraits() : NULL; - if ( ! traits ) - traits = &traitsConsole; + // Are we little or big endian? This method is from Harbison & Steele. + union + { + long l; + char c[sizeof(long)]; + } u; + u.l = 1; - wxToolkitInfo& info = traits->GetToolkitInfo(); - if ( verMaj ) - *verMaj = info.versionMajor; - if ( verMin ) - *verMin = info.versionMinor; - return info.os; + return u.c[0] == 1; } + /* * Class to make it easier to specify platform-dependent values */ @@ -442,11 +440,11 @@ void wxPlatform::ClearPlatforms() bool wxPlatform::Is(int platform) { #ifdef __WXMSW__ - if (platform == wxMSW) + if (platform == wxOS_WINDOWS) return true; #endif #ifdef __WXWINCE__ - if (platform == wxWinCE) + if (platform == wxOS_WINDOWS_CE) return true; #endif #if defined(__WXWINCE__) && defined(__POCKETPC__) @@ -458,31 +456,31 @@ bool wxPlatform::Is(int platform) return true; #endif #ifdef __WXGTK__ - if (platform == wxGTK) + if (platform == wxPORT_GTK) return true; #endif #ifdef __WXMAC__ - if (platform == wxMac) + if (platform == wxPORT_MAC) return true; #endif #ifdef __WXX11__ - if (platform == wxX11) + if (platform == wxPORT_X11) return true; #endif #ifdef __UNIX__ - if (platform == wxUnix) + if (platform == wxOS_UNIX) return true; #endif #ifdef __WXMGL__ - if (platform == wxMGL) + if (platform == wxPORT_MGL) return true; #endif #ifdef __WXOS2__ - if (platform == wxOS2) + if (platform == wxPORT_OS2) return true; #endif #ifdef __WXCOCOA__ - if (platform == wxCocoa) + if (platform == wxPORT_MAC) return true; #endif