summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Gottwald <alexander.gottwald@s1999.tu-chemnitz.de>2004-11-15 15:06:56 +0000
committerAlexander Gottwald <alexander.gottwald@s1999.tu-chemnitz.de>2004-11-15 15:06:56 +0000
commitdd695cb666d6912f615b264eaabbad63592588c1 (patch)
treee4474c544b7d6d7aff67d525f608230bc238cefe
parent8cb3bec3667fa6ee57277956d3be71671915a73b (diff)
Bufzilla #1802, http://freedesktop.org/bugzilla/show_bug.cgi?id=1802 AddedXORG-6_8_99_3XORG-6_8_99_2XORG-6_8_99_1
mingw (Win32) port
-rw-r--r--src/fc/fsio.c1
-rw-r--r--src/fontfile/bufio.c4
-rw-r--r--src/fontfile/dirfile.c25
-rw-r--r--src/fontfile/fontdir.c4
-rw-r--r--src/fontfile/fontfile.c9
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<strlen(font_name); i++) {
if (font_name[i]=='\r') font_name[i] = '\0';
@@ -275,7 +282,7 @@ ReadFontAlias(char *directory, Bool isFile, FontDirectoryPtr *pdir)
strcat(alias_file, "/");
strcat(alias_file, FontAliasFile);
}
- file = fopen(alias_file, "r");
+ file = fopen(alias_file, "rt");
if (!file)
return ((errno == ENOENT) ? Successful : BadFontPath);
if (!dir)
@@ -285,7 +292,11 @@ ReadFontAlias(char *directory, Bool isFile, FontDirectoryPtr *pdir)
fclose (file);
return AllocError;
}
+#ifndef WIN32
if (fstat (fileno (file), &statb) == -1)
+#else
+ if (stat (alias_file, &statb) == -1)
+#endif
{
fclose (file);
return BadFontPath;
diff --git a/src/fontfile/fontdir.c b/src/fontfile/fontdir.c
index 024ec03..455c6c4 100644
--- a/src/fontfile/fontdir.c
+++ b/src/fontfile/fontdir.c
@@ -1,4 +1,4 @@
-/* $XdotOrg: fontdir.c,v 1.4 2001/02/09 02:04:03 xorgcvs Exp $ */
+/* $XdotOrg: xc/lib/font/fontfile/fontdir.c,v 1.2 2004/04/23 18:44:21 eich Exp $ */
/* $Xorg: fontdir.c,v 1.4 2001/02/09 02:04:03 xorgcvs Exp $ */
/*
@@ -110,7 +110,7 @@ FontFileMakeDir(char *dirName, int size)
#endif
#ifdef FONTDIRATTRIB
-#ifndef __UNIXOS2__
+#if !defined(__UNIXOS2__) && !defined(WIN32)
attrib = strchr(dirName, ':');
#else
/* OS/2 uses the colon in the drive letter descriptor, skip this */
diff --git a/src/fontfile/fontfile.c b/src/fontfile/fontfile.c
index d32c4a1..82c6fd9 100644
--- a/src/fontfile/fontfile.c
+++ b/src/fontfile/fontfile.c
@@ -1,4 +1,4 @@
-/* $XdotOrg: xc/lib/font/fontfile/fontfile.c,v 1.1.4.3 2003/12/06 13:24:23 kaleb Exp $ */
+/* $XdotOrg: xc/lib/font/fontfile/fontfile.c,v 1.2 2004/04/23 18:44:21 eich Exp $ */
/* $Xorg: fontfile.c,v 1.4 2001/02/09 02:04:03 xorgcvs Exp $ */
/*
@@ -34,6 +34,9 @@ in this Software without prior written authorization from The Open Group.
/* $NCDXorg: @(#)fontfile.c,v 1.6 1991/07/02 17:00:46 lemke Exp $ */
#include "fntfilst.h"
+#ifdef WIN32
+#include <ctype.h>
+#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;