]> git.saurik.com Git - wxWidgets.git/blobdiff - src/os2/utils.cpp
fix row/column deselection in row-or-column selection mode (it wasn't doing anything)
[wxWidgets.git] / src / os2 / utils.cpp
index e3bc440f2714d8cafe12dd5a4bf423ce4f7a36c6..5a03ba30f3070e1c6d2aba8f569a2a59d4d04a37 100644 (file)
@@ -93,13 +93,12 @@ bool wxGetHostName( wxChar* zBuf, int nMaxSize )
                                 ,(void*)zBuf
                                 ,(ULONG)nMaxSize - 1
                                );
+        zBuf[nMaxSize] = _T('\0');
     }
     else
     {
-        wxStrncpy(zBuf, zSysname, nMaxSize - 1);
+        wxStrlcpy(zBuf, zSysname, nMaxSize);
     }
-
-    zBuf[nMaxSize] = _T('\0');
 #endif
 
     return *zBuf ? true : false;
@@ -121,7 +120,7 @@ bool wxGetUserName( wxChar* zBuf, int nMaxSize )
 #ifdef USE_NET_API
     wxGetUserId( zBuf, nMaxSize );
 #else
-    wxStrncpy(zBuf, _T("Unknown User"), nMaxSize);
+    wxStrlcpy(zBuf, _T("Unknown User"), nMaxSize);
 #endif
     return true;
 }
@@ -241,6 +240,14 @@ bool wxGetEnv(const wxString& var, wxString *value)
 static bool wxDoSetEnv(const wxString& variable, const char *value)
 {
 #if defined(HAVE_SETENV)
+    if ( !value ) 
+    { 
+#ifdef HAVE_UNSETENV 
+        return unsetenv(variable.mb_str()) == 0; 
+#else 
+        value = _T(""); // mustn't pass NULL to setenv() 
+#endif 
+    } 
     return setenv(variable.mb_str(), value, 1 /* overwrite */) == 0;
 #elif defined(HAVE_PUTENV)
     wxString s = variable;