OSSP CVS Repository

ossp - Check-in [3829]
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [Patchset]  [Tagging/Branching

Check-in Number: 3829
Date: 2002-Dec-04 16:50:29 (local)
2002-Dec-04 15:50:29 (UTC)
User:ms
Branch:
Comment: Repair windows username logic, and consider using cuserid(3) instead of getlogin(2) for better portability and robustness.
Tickets:
Inspections:
Files:
ossp-pkg/as/as-gui/as_assist.cpp      1.44 -> 1.45     20 inserted, 11 deleted

ossp-pkg/as/as-gui/as_assist.cpp 1.44 -> 1.45

--- as_assist.cpp        2002/12/04 14:50:08     1.44
+++ as_assist.cpp        2002/12/04 15:50:29     1.45
@@ -79,18 +79,27 @@
 
 // Start the show by getting the username
 #if defined(Q_WS_WIN)
-    DWORD winUserNameSize = sizeof(winUserName);
+    {
+        DWORD dwWinusernamesize = sizeof(dwWinusernamesize);
 #if defined(UNICODE)
-    TCHAR winUserName[UNLEN + 1];   // UNLEN is defined in lmcons.h
-    GetUserName(winUserName, &winUserNameSize);
-    userName = qt_winQString(winUserName);
-#endif // #if defined(UNICODE)
-    char winUserName[UNLEN + 1];    // UNLEN is defined in lmcons.h
-    GetUserNameA(winUserName, &winUserNameSize);
-    userName = QString::fromLocal8Bit(winUserName);
-#else // #if defined(Q_WS_WIN)
-    Username = QString::fromLocal8Bit(getlogin());
-#endif
+        TCHAR szWinusername[UNLEN + 1];   // UNLEN is defined in lmcons.h
+        GetUserName(szWinusername, &dwWinusernamesize);
+        Username = qt_winQString(szWinusername);
+#else   // not unicode
+        char szWinusername[UNLEN + 1];    // UNLEN is defined in lmcons.h
+        GetUserNameA(szWinusername, &dwWinusernamesize);
+        Username = QString::fromLocal8Bit(szWinusername);
+    }
+#endif  // #if defined(UNICODE)
+#else   // not windows
+    {
+//#include <stdio.h>
+//        char *szUser = NULL;
+//        szUser = cuserid();
+//        Username = QString::fromLocal8Bit(szUser);
+        Username = QString::fromLocal8Bit(getlogin());
+    }
+#endif  // #if defined(Q_WS_WIN)
 
     m_pPrefs = new Preferences(TITRAQ_PREFNAME, TITRAQ_APPTITLE, TITRAQ_PREFVER);
     if (!m_pPrefs->fileState()) {   // No file was found, so assume a null state

CVSTrac 2.0.1