From dd695cb666d6912f615b264eaabbad63592588c1 Mon Sep 17 00:00:00 2001 From: Alexander Gottwald Date: Mon, 15 Nov 2004 15:06:56 +0000 Subject: Bufzilla #1802, http://freedesktop.org/bugzilla/show_bug.cgi?id=1802 Added mingw (Win32) port --- src/fc/fsio.c | 1 + src/fontfile/bufio.c | 4 ++-- src/fontfile/dirfile.c | 25 ++++++++++++++++++------- src/fontfile/fontdir.c | 4 ++-- src/fontfile/fontfile.c | 9 ++++++--- 5 files changed, 29 insertions(+), 14 deletions(-) diff --git a/src/fc/fsio.c b/src/fc/fsio.c index e5c0c05..2c37849 100644 --- a/src/fc/fsio.c +++ b/src/fc/fsio.c @@ -30,6 +30,7 @@ #ifdef WIN32 #define _WILLWINSOCK_ +#include "X11/Xwindows.h" #endif #include "X11/Xtrans.h" diff --git a/src/fontfile/bufio.c b/src/fontfile/bufio.c index 3f6d461..aa2a7a5 100644 --- a/src/fontfile/bufio.c +++ b/src/fontfile/bufio.c @@ -122,7 +122,7 @@ BufFileRawClose (BufFilePtr f, int doClose) BufFilePtr BufFileOpenRead (int fd) { -#ifdef __UNIXOS2__ +#if defined(__UNIXOS2__) || defined (WIN32) /* hv: I'd bet WIN32 has the same effect here */ setmode(fd,O_BINARY); #endif @@ -149,7 +149,7 @@ BufFileOpenWrite (int fd) { BufFilePtr f; -#ifdef __UNIXOS2__ +#if defined(__UNIXOS2__) || defined(WIN32) /* hv: I'd bet WIN32 has the same effect here */ setmode(fd,O_BINARY); #endif diff --git a/src/fontfile/dirfile.c b/src/fontfile/dirfile.c index 688bae1..e4b42dc 100644 --- a/src/fontfile/dirfile.c +++ b/src/fontfile/dirfile.c @@ -73,11 +73,11 @@ FontFileReadDirectory (char *directory, FontDirectoryPtr *pdir) #ifdef FONTDIRATTRIB /* Check for font directory attributes */ -#ifndef __UNIXOS2__ +#if !defined(__UNIXOS2__) && !defined(WIN32) if ((ptr = strchr(directory, ':'))) { #else - /* OS/2 path might start with a drive letter, don't clip this */ - if (ptr = strchr(directory+2, ':')) { + /* OS/2 and WIN32 path might start with a drive letter, don't clip this */ + if ((ptr = strchr(directory+2, ':'))) { #endif strncpy(dir_path, directory, ptr - directory); dir_path[ptr - directory] = '\0'; @@ -91,12 +91,19 @@ FontFileReadDirectory (char *directory, FontDirectoryPtr *pdir) if (dir_file[strlen(dir_file) - 1] != '/') strcat(dir_file, "/"); strcat(dir_file, FontDirFile); - file = fopen(dir_file, "r"); + file = fopen(dir_file, "rt"); if (file) { Bool found_font = FALSE; - + +#ifndef WIN32 if (fstat (fileno(file), &statb) == -1) +#else + if (stat (dir_file, &statb) == -1) +#endif + { + fclose(file); return BadFontPath; + } count = fscanf(file, "%d\n", &i); if ((count == EOF) || (count != 1)) { fclose(file); @@ -113,7 +120,7 @@ FontFileReadDirectory (char *directory, FontDirectoryPtr *pdir) MAXFONTFILENAMELEN-1, MAXFONTNAMELEN-1); while ((count = fscanf(file, format, file_name, font_name)) != EOF) { -#ifdef __UNIXOS2__ +#if defined(__UNIXOS2__) || defined(WIN32) /* strip any existing trailing CR */ for (i=0; i +#endif /* * Map FPE functions to renderer functions @@ -49,9 +52,9 @@ int FontFileNameCheck (char *name) { #ifndef NCD -#ifdef __UNIXOS2__ +#if defined(__UNIXOS2__) || defined(WIN32) /* OS/2 uses D:/... as a path name for fonts, so accept this as a valid - * path if it starts with a letter and a colon + * path if it starts with a letter and a colon. Same applies for WIN32 */ if (isalpha(*name) && name[1]==':') return TRUE; -- cgit v1.2.1