[poppler] goo/gfile.cc goo/gfile.h poppler/GlobalParams.cc poppler/GlobalParamsWin.cc

Adrian Johnson ajohnson at kemper.freedesktop.org
Wed Aug 16 11:44:07 UTC 2017


 goo/gfile.cc               |   14 +++++++-------
 goo/gfile.h                |    2 +-
 poppler/GlobalParams.cc    |    2 +-
 poppler/GlobalParamsWin.cc |   20 ++++++++++----------
 4 files changed, 19 insertions(+), 19 deletions(-)

New commits:
commit 535bc8eeaf8d354a84129fe00c3a5e3ac0a85aa3
Author: Christoph Cullmann <cullmann at kde.org>
Date:   Wed Aug 16 21:11:36 2017 +0930

    win32: call ANSI functions directly
    
    to be able to compile with different -DUNICODE variants
    
    Bug 100312

diff --git a/goo/gfile.cc b/goo/gfile.cc
index 3528bb35..bc914785 100644
--- a/goo/gfile.cc
+++ b/goo/gfile.cc
@@ -72,7 +72,7 @@ GooString *getCurrentDir() {
 #if defined(__EMX__)
   if (_getcwd2(buf, sizeof(buf)))
 #elif defined(_WIN32)
-  if (GetCurrentDirectory(sizeof(buf), buf))
+  if (GetCurrentDirectoryA(sizeof(buf), buf))
 #elif defined(ACORN)
   if (strcpy(buf, "@"))
 #elif defined(MACOS)
@@ -134,7 +134,7 @@ GooString *appendToPath(GooString *path, const char *fileName) {
   tmp = new GooString(path);
   tmp->append('/');
   tmp->append(fileName);
-  GetFullPathName(tmp->getCString(), sizeof(buf), buf, &fp);
+  GetFullPathNameA(tmp->getCString(), sizeof(buf), buf, &fp);
   delete tmp;
   path->clear();
   path->append(buf);
@@ -620,7 +620,7 @@ Goffset GooFile::size() const {
 }
 
 GooFile* GooFile::open(const GooString *fileName) {
-  HANDLE handle = CreateFile(fileName->getCString(),
+  HANDLE handle = CreateFileA(fileName->getCString(),
                               GENERIC_READ,
                               FILE_SHARE_READ | FILE_SHARE_WRITE,
                               NULL,
@@ -697,7 +697,7 @@ GDirEntry::GDirEntry(char *dirPath, char *nameA, GBool doStat) {
 #elif defined(ACORN)
 #else
 #ifdef _WIN32
-    fa = GetFileAttributes(fullPath->getCString());
+    fa = GetFileAttributesA(fullPath->getCString());
     dir = (fa != 0xFFFFFFFF && (fa & FILE_ATTRIBUTE_DIRECTORY));
 #else
     if (stat(fullPath->getCString(), &st) == 0)
@@ -720,7 +720,7 @@ GDir::GDir(char *name, GBool doStatA) {
 
   tmp = path->copy();
   tmp->append("/*.*");
-  hnd = FindFirstFile(tmp->getCString(), &ffd);
+  hnd = FindFirstFileA(tmp->getCString(), &ffd);
   delete tmp;
 #elif defined(ACORN)
 #elif defined(MACOS)
@@ -753,7 +753,7 @@ GDirEntry *GDir::getNextEntry() {
 #if defined(_WIN32)
   if (hnd != INVALID_HANDLE_VALUE) {
     e = new GDirEntry(path->getCString(), ffd.cFileName, doStat);
-    if (!FindNextFile(hnd, &ffd)) {
+    if (!FindNextFileA(hnd, &ffd)) {
       FindClose(hnd);
       hnd = INVALID_HANDLE_VALUE;
     }
@@ -797,7 +797,7 @@ void GDir::rewind() {
     FindClose(hnd);
   tmp = path->copy();
   tmp->append("/*.*");
-  hnd = FindFirstFile(tmp->getCString(), &ffd);
+  hnd = FindFirstFileA(tmp->getCString(), &ffd);
   delete tmp;
 #elif defined(ACORN)
 #elif defined(MACOS)
diff --git a/goo/gfile.h b/goo/gfile.h
index 1365a9cf..a8122917 100644
--- a/goo/gfile.h
+++ b/goo/gfile.h
@@ -194,7 +194,7 @@ private:
   GooString *path;		// directory path
   GBool doStat;			// call stat() for each entry?
 #if defined(_WIN32)
-  WIN32_FIND_DATA ffd;
+  WIN32_FIND_DATAA ffd;
   HANDLE hnd;
 #elif defined(ACORN)
 #elif defined(MACOS)
diff --git a/poppler/GlobalParams.cc b/poppler/GlobalParams.cc
index e5434084..1e0cac5c 100644
--- a/poppler/GlobalParams.cc
+++ b/poppler/GlobalParams.cc
@@ -178,7 +178,7 @@ get_poppler_datadir (void)
   if (beenhere)
     return retval;
 
-  if (!GetModuleFileName (hmodule, (CHAR *) retval, sizeof(retval) - 20))
+  if (!GetModuleFileNameA (hmodule, (CHAR *) retval, sizeof(retval) - 20))
     return POPPLER_DATADIR;
 
   p = _mbsrchr ((unsigned char *) retval, '\\');
diff --git a/poppler/GlobalParamsWin.cc b/poppler/GlobalParamsWin.cc
index f9f40ef4..335476aa 100644
--- a/poppler/GlobalParamsWin.cc
+++ b/poppler/GlobalParamsWin.cc
@@ -180,29 +180,29 @@ static struct {
 static void GetWindowsFontDir(char *winFontDir, int cbWinFontDirLen)
 {
     BOOL (__stdcall *SHGetSpecialFolderPathFunc)(HWND  hwndOwner,
-                                                  LPTSTR lpszPath,
+                                                  LPSTR lpszPath,
                                                   int    nFolder,
                                                   BOOL  fCreate);
     HRESULT (__stdcall *SHGetFolderPathFunc)(HWND  hwndOwner,
                                               int    nFolder,
                                               HANDLE hToken,
                                               DWORD  dwFlags,
-                                              LPTSTR pszPath);
+                                              LPSTR pszPath);
 
     // SHGetSpecialFolderPath isn't available in older versions of shell32.dll (Win95 and
     // WinNT4), so do a dynamic load of ANSI versions.
     winFontDir[0] = '\0';
 
-    HMODULE hLib = LoadLibrary("shell32.dll");
+    HMODULE hLib = LoadLibraryA("shell32.dll");
     if (hLib) {
-        SHGetFolderPathFunc = (HRESULT (__stdcall *)(HWND, int, HANDLE, DWORD, LPTSTR)) 
+        SHGetFolderPathFunc = (HRESULT (__stdcall *)(HWND, int, HANDLE, DWORD, LPSTR))
                               GetProcAddress(hLib, "SHGetFolderPathA");
         if (SHGetFolderPathFunc)
             (*SHGetFolderPathFunc)(NULL, CSIDL_FONTS, NULL, SHGFP_TYPE_CURRENT, winFontDir);
 
         if (!winFontDir[0]) {
             // Try an older function
-            SHGetSpecialFolderPathFunc = (BOOL (__stdcall *)(HWND, LPTSTR, int, BOOL))
+            SHGetSpecialFolderPathFunc = (BOOL (__stdcall *)(HWND, LPSTR, int, BOOL))
                                           GetProcAddress(hLib, "SHGetSpecialFolderPathA");
             if (SHGetSpecialFolderPathFunc)
                 (*SHGetSpecialFolderPathFunc)(NULL, winFontDir, CSIDL_FONTS, FALSE);
@@ -213,9 +213,9 @@ static void GetWindowsFontDir(char *winFontDir, int cbWinFontDirLen)
         return;
 
     // Try older DLL
-    hLib = LoadLibrary("SHFolder.dll");
+    hLib = LoadLibraryA("SHFolder.dll");
     if (hLib) {
-        SHGetFolderPathFunc = (HRESULT (__stdcall *)(HWND, int, HANDLE, DWORD, LPTSTR))
+        SHGetFolderPathFunc = (HRESULT (__stdcall *)(HWND, int, HANDLE, DWORD, LPSTR))
                               GetProcAddress(hLib, "SHGetFolderPathA");
         if (SHGetFolderPathFunc)
             (*SHGetFolderPathFunc)(NULL, CSIDL_FONTS, NULL, SHGFP_TYPE_CURRENT, winFontDir);
@@ -225,7 +225,7 @@ static void GetWindowsFontDir(char *winFontDir, int cbWinFontDirLen)
         return;
 
     // Everything else failed so the standard fonts directory.
-    GetWindowsDirectory(winFontDir, cbWinFontDirLen);                                                       
+    GetWindowsDirectoryA(winFontDir, cbWinFontDirLen);
     if (winFontDir[0]) {
         strncat(winFontDir, FONTS_SUBDIR, cbWinFontDirLen);
         winFontDir[cbWinFontDirLen-1] = 0;
@@ -259,14 +259,14 @@ void SysFontList::scanWindowsFonts(GooString *winFontDir) {
   } else {
     path = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Fonts\\";
   }
-  if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, path, 0,
+  if (RegOpenKeyExA(HKEY_LOCAL_MACHINE, path, 0,
 		   KEY_QUERY_VALUE | KEY_ENUMERATE_SUB_KEYS,
 		   &regKey) == ERROR_SUCCESS) {
     idx = 0;
     while (1) {
       valNameLen = sizeof(valName) - 1;
       dataLen = sizeof(data) - 1;
-      if (RegEnumValue(regKey, idx, valName, &valNameLen, NULL,
+      if (RegEnumValueA(regKey, idx, valName, &valNameLen, NULL,
 		       &type, (LPBYTE)data, &dataLen) != ERROR_SUCCESS) {
 	break;
       }


More information about the poppler mailing list