]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/wxcrt.cpp
Strip mnemonics from the label before passing it to Cocoa.
[wxWidgets.git] / src / common / wxcrt.cpp
index a098825bf3e40799ddc587c2a28c9e8f5c26a249..6d5c08774d341b599fa56c2c73e18dc284459e41 100644 (file)
@@ -552,7 +552,7 @@ namespace
 {
 
 #if !wxUSE_UTF8_LOCALE_ONLY
-int wxInternalConvertStringToBuf(const wxString& s, char *out, size_t outsize)
+int ConvertStringToBuf(const wxString& s, char *out, size_t outsize)
 {
     const wxWX2WCbuf buf = s.wc_str();
 
@@ -565,13 +565,19 @@ int wxInternalConvertStringToBuf(const wxString& s, char *out, size_t outsize)
 #endif // !wxUSE_UTF8_LOCALE_ONLY
 
 #if wxUSE_UNICODE_UTF8
-int wxInternalConvertStringToBuf(const wxString& s, wchar_t *out, size_t outsize)
+int ConvertStringToBuf(const wxString& s, wchar_t *out, size_t outsize)
 {
     const wxWX2WCbuf buf(s.wc_str());
-    size_t len = wxWcslen(buf);
+    size_t len = s.length(); // same as buf length for wchar_t*
     if ( outsize > len )
+    {
         memcpy(out, buf, (len+1) * sizeof(wchar_t));
-    // else: not enough space
+    }
+    else // not enough space
+    {
+        memcpy(out, buf, (outsize-1) * sizeof(wchar_t));
+        out[outsize-1] = 0;
+    }
     return len;
 }
 #endif // wxUSE_UNICODE_UTF8
@@ -585,7 +591,7 @@ static size_t PrintfViaString(T *out, size_t outsize,
     wxString s;
     s.PrintfV(format, argptr);
 
-    return wxInternalConvertStringToBuf(s, out, outsize);
+    return ConvertStringToBuf(s, out, outsize);
 }
 #endif // wxUSE_UNICODE
 
@@ -866,6 +872,7 @@ wxCRT_StrftimeW(wchar_t *s, size_t maxsize, const wchar_t *fmt, const struct tm
 
 #endif // wxUSE_WCHAR_T
 
+#ifdef wxLongLong_t
 template<typename T>
 static wxULongLong_t
 wxCRT_StrtoullBase(const T* nptr, T** endptr, int base, T* sign)
@@ -1019,6 +1026,8 @@ wxULongLong_t wxCRT_StrtoullW(const wchar_t* nptr, wchar_t** endptr, int base)
     { return wxCRT_DoStrtoull(nptr, endptr, base); }
 #endif
 
+#endif // wxLongLong_t
+
 // ----------------------------------------------------------------------------
 // functions which we may need even if !wxUSE_WCHAR_T
 // ----------------------------------------------------------------------------
@@ -1097,22 +1106,6 @@ int wxCRT_RemoveW(const wchar_t *path)
 }
 #endif
 
-#ifndef wxCRT_TmpnamW
-wchar_t *wxCRT_TmpnamW(wchar_t *s)
-{
-    // tmpnam_r() returns NULL if s=NULL, do the same
-    wxCHECK_MSG( s, NULL, "wxTmpnam must be called with a buffer" );
-
-#ifndef L_tmpnam
-    #define L_tmpnam 1024
-#endif
-    wxCharBuffer buf(L_tmpnam);
-    tmpnam(buf.data());
-
-    wxConvLibc.ToWChar(s, L_tmpnam+1, buf.data());
-    return s;
-}
-#endif // !wxCRT_TmpnamW
 
 
 // ============================================================================