Commit 535bc8ee authored by Christoph Cullmann's avatar Christoph Cullmann Committed by Adrian Johnson

win32: call ANSI functions directly

to be able to compile with different -DUNICODE variants

Bug 100312
parent a8d670b5
......@@ -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)
......
......@@ -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)
......
......@@ -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, '\\');
......
......@@ -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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment