bug-global
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

path2url DOS/Win32 patch


From: Jason Hood
Subject: path2url DOS/Win32 patch
Date: Thu, 02 Aug 2007 20:57:33 +1000
User-agent: Thunderbird 1.5.0.12 (Windows/20070509)

I have attached a patch for the DOS and Win32 ports of the
htags-refkit.  It is necessary for htags_load_filemap() to
open the file in binary mode, otherwise the return value
of read() will not agree with the file size, causing the
function to fail.  I also just noticed a typo in the
leading comments: "requried" should be "required".

Jason.
diff -ur global-5.6.orig/htags-refkit/htags_path2url.c 
global-5.6/htags-refkit/htags_path2url.c
--- global-5.6.orig/htags-refkit/htags_path2url.c       2007-07-06 10:47:40 
+1000
+++ global-5.6/htags-refkit/htags_path2url.c    2007-07-09 16:34:40 +1000
@@ -13,6 +13,12 @@
 #include <sys/param.h>
 #include <sys/stat.h>
 
+#if defined(_WIN32) || defined(__DJGPP__)
+# define OPENMODE O_BINARY
+#else
+# define OPENMODE 0
+#endif
+
 int htags_load_filemap(const char *);
 void htags_unload_filemap(void);
 int htags_path2url(const char *, int, char *, int);
@@ -83,7 +89,7 @@
 
        /* Load FILEMAP contents */
        status = -2;
-       if ((fd = open(file, 0)) < 0)
+       if ((fd = open(file, OPENMODE)) < 0)
                goto err;
        status = -3;
        if (fstat(fd, &st) < 0)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]