forked from msys2/MINGW-packages
-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
On the surface, this patch looks as if it only fixes a compile warning: the canonicalize_file_name() and win2unixpath() functions are used without having them declared. Everything still compiles fine, and cursory testing in most setups shows that everything is fine. Except that it is not. When GCC sees that canonicalize_file_name() is used without a declaration, it will assume implicitly that the return value is an int. A 32-bit one, to be precise. So when those two functions return a pointer (a 64-bit one), the most significant 32 bits are simply cut off. Except they are not cut off: they are left in the state as before. This developer encountered this issue in the form of a segmentation fault when running with the FLG_LDR_TOP_DOWN enabled [*1*], because the machine register holding the return value still held a 0xffffffff from the return address. Footnote *1*: https://technet.microsoft.com/en-us/library/cc779664%28v=ws.10%29.aspx Signed-off-by: Johannes Schindelin <[email protected]>
- Loading branch information
Showing
2 changed files
with
54 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,16 +20,21 @@ GnuWin32: http://gnuwin32.sourceforge.net/ | |
|
||
Great thanks to GnuWin32 maintainer Kees Zeelenberg. | ||
|
||
-- | ||
[jes: fixed for 64-bit] | ||
|
||
Signed-off-by: Johannes Schindelin <[email protected]> | ||
--- | ||
MINGW-PATCHES/README-relocatex-libintl.txt | 23 ++ | ||
gettext-runtime/intl/Makefile.in | 9 + | ||
gettext-runtime/intl/bindtextdom.c | 22 ++ | ||
gettext-runtime/intl/canonicalize.c | 329 +++++++++++++++++++++++++++++ | ||
gettext-runtime/intl/relocatex.c | 295 ++++++++++++++++++++++++++ | ||
gettext-runtime/intl/canonicalize.c | 343 +++++++++++++++++++++++++++++ | ||
gettext-runtime/intl/canonicalize.h | 18 ++ | ||
gettext-runtime/intl/relocatex.c | 284 ++++++++++++++++++++++++ | ||
gettext-runtime/intl/relocatex.h | 41 ++++ | ||
6 files changed, 719 insertions(+) | ||
7 files changed, 740 insertions(+) | ||
create mode 100644 MINGW-PATCHES/README-relocatex-libintl.txt | ||
create mode 100644 gettext-runtime/intl/canonicalize.c | ||
create mode 100644 gettext-runtime/intl/canonicalize.h | ||
create mode 100644 gettext-runtime/intl/relocatex.c | ||
create mode 100644 gettext-runtime/intl/relocatex.h | ||
|
||
|
@@ -154,10 +159,10 @@ index 2e7ada4..bd0cddd 100644 | |
/* Specify the character encoding in which the messages from the | ||
diff --git a/gettext-runtime/intl/canonicalize.c b/gettext-runtime/intl/canonicalize.c | ||
new file mode 100644 | ||
index 0000000..532eb5a | ||
index 0000000..ae2aa93 | ||
--- /dev/null | ||
+++ b/gettext-runtime/intl/canonicalize.c | ||
@@ -0,0 +1,329 @@ | ||
@@ -0,0 +1,343 @@ | ||
+/* Return the canonical absolute name of a given file. | ||
+ Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc. | ||
+ This file is part of the GNU C Library. | ||
|
@@ -191,6 +196,7 @@ index 0000000..532eb5a | |
+# include <windows.h> | ||
+//# include <gw32.h> | ||
+#endif /* __WIN32__ */ | ||
+#include "canonicalize.h" | ||
+ | ||
+#ifndef MAXSYMLINKS | ||
+# define MAXSYMLINKS 20 | ||
|
@@ -217,6 +223,19 @@ index 0000000..532eb5a | |
+# define ISDIRSEP(C) ((C) == '/') | ||
+#endif | ||
+ | ||
+#ifdef __WIN32__ | ||
+char *win2unixpath (char *FileName) | ||
+{ | ||
+ char *s = FileName; | ||
+ while (*s) { | ||
+ if (*s == '\\') | ||
+ *s = '/'; | ||
+ *s++; | ||
+ } | ||
+ return FileName; | ||
+} | ||
+#endif | ||
+ | ||
+/* Return the canonical absolute name of file NAME. A canonical name | ||
+ does not contain any `.', `..' components nor any repeated path | ||
+ separators ('/') or symlinks. All path components must exist. If | ||
|
@@ -487,12 +506,36 @@ index 0000000..532eb5a | |
+{ | ||
+ return canonicalize (name, NULL); | ||
+} | ||
diff --git a/gettext-runtime/intl/canonicalize.h b/gettext-runtime/intl/canonicalize.h | ||
new file mode 100644 | ||
index 0000000..ea707bf | ||
--- /dev/null | ||
+++ b/gettext-runtime/intl/canonicalize.h | ||
@@ -0,0 +1,18 @@ | ||
+#ifndef __CANONICALIZE_H__ | ||
+#define __CANONICALIZE_H__ 1 | ||
+ | ||
+#ifdef __cplusplus | ||
+extern "C" { | ||
+#endif | ||
+ | ||
+char *canonicalize_file_name (const char *name); | ||
+ | ||
+#ifdef __WIN32__ | ||
+char *win2unixpath (char *path); | ||
+#endif | ||
+ | ||
+#ifdef __cplusplus | ||
+} | ||
+#endif | ||
+ | ||
+#endif /* __CANONICALIZE_H__ */ | ||
diff --git a/gettext-runtime/intl/relocatex.c b/gettext-runtime/intl/relocatex.c | ||
new file mode 100644 | ||
index 0000000..8e91a88 | ||
index 0000000..a2b7438 | ||
--- /dev/null | ||
+++ b/gettext-runtime/intl/relocatex.c | ||
@@ -0,0 +1,295 @@ | ||
@@ -0,0 +1,284 @@ | ||
+/* Provide relocatable packages. | ||
+ Copyright (C) 2003 Free Software Foundation, Inc. | ||
+ Written by Bruno Haible <[email protected]>, 2003. | ||
|
@@ -522,7 +565,7 @@ index 0000000..8e91a88 | |
+#include <unistd.h> | ||
+/* #include <path.h> */ | ||
+#include "relocatex.h" | ||
+//#include "canonicalize.h" | ||
+#include "canonicalize.h" | ||
+/* #include <gw32.h> */ | ||
+ | ||
+ | ||
|
@@ -552,17 +595,6 @@ index 0000000..8e91a88 | |
+ to them must start with a slash. */ | ||
+ | ||
+ | ||
+char *win2unixpath (char *FileName) | ||
+{ | ||
+ char *s = FileName; | ||
+ while (*s) { | ||
+ if (*s == '\\') | ||
+ *s = '/'; | ||
+ *s++; | ||
+ } | ||
+ return FileName; | ||
+} | ||
+ | ||
+int win2posixpath (const char *winpath, char *posixpath) | ||
+{ | ||
+ strcpy (posixpath, winpath); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters