comparison src/mingw-utils-1-portability-fix.patch @ 1425:6f2842726259

new package: mingw-utils
author Volker Grabsch <vog@notjusthosting.com>
date Fri, 26 Nov 2010 19:29:47 +0100
parents
children f653602a0500
comparison
equal deleted inserted replaced
1424:212aadc668c6 1425:6f2842726259
1 This file is part of mingw-cross-env.
2 See doc/index.html for further information.
3
4 This patch has been taken from:
5 http://sourceforge.net/tracker/?func=detail&aid=3119898&group_id=2435&atid=102435
6
7 diff -r 62cf992c82c9 reimp/reimp.c
8 --- a/reimp/reimp.c Fri Nov 26 19:02:28 2010 +0100
9 +++ b/reimp/reimp.c Fri Nov 26 19:14:59 2010 +0100
10 @@ -80,20 +80,20 @@
11 return 1;
12 }
13
14 -static int do_import (char *, uint32, FILE *);
15 +static int do_import (char *, uint32_t, FILE *);
16
17 /* read second linker member and process all archive members */
18 static int
19 read_link_member (struct ar_hdr *hdr, FILE *f)
20 {
21 - uint32 n_memb;
22 - uint32 n_syms;
23 - uint32 *ofs;
24 - uint16 *idx;
25 + uint32_t n_memb;
26 + uint32_t n_syms;
27 + uint32_t *ofs;
28 + uint16_t *idx;
29 char *buf;
30 char *sym;
31 - uint32 n;
32 - uint16 i;
33 + uint32_t n;
34 + uint16_t i;
35
36 /* FIXME: are offsets and sizes in host endianness? Currently we
37 assume so. */
38 @@ -305,7 +305,7 @@
39 }
40
41 void
42 -extract_member (char *name, uint32 size, FILE *f)
43 +extract_member (char *name, uint32_t size, FILE *f)
44 {
45 static int non_imports = 0;
46 char buf[2048];
47 @@ -379,7 +379,7 @@
48
49 /* process an import */
50 static int
51 -do_import (char *name, uint32 offset, FILE *f)
52 +do_import (char *name, uint32_t offset, FILE *f)
53 {
54 struct ar_hdr ar_hdr;
55 struct imp_hdr imp_hdr;
56 diff -r 62cf992c82c9 reimp/reimp.h
57 --- a/reimp/reimp.h Fri Nov 26 19:02:28 2010 +0100
58 +++ b/reimp/reimp.h Fri Nov 26 19:14:59 2010 +0100
59 @@ -1,14 +1,6 @@
60 #include <stddef.h>
61 +#include <stdint.h>
62 #include <stdio.h>
63 -
64 -/* we need integers of specific sizes */
65 -#ifndef uint32
66 -#define uint32 unsigned long
67 -#endif
68 -
69 -#ifndef uint16
70 -#define uint16 unsigned short
71 -#endif
72
73 /* defines for archive */
74 #ifndef ARMAG
75 @@ -41,13 +33,13 @@
76
77 /* import header */
78 struct imp_hdr {
79 - uint16 sig1;
80 - uint16 sig2;
81 - uint16 version;
82 - uint32 time;
83 - uint32 size;
84 - uint16 ord_or_hint;
85 - uint16 type;
86 + uint16_t sig1;
87 + uint16_t sig2;
88 + uint16_t version;
89 + uint32_t time;
90 + uint32_t size;
91 + uint16_t ord_or_hint;
92 + uint16_t type;
93 };
94
95 /* sig1 */
96 @@ -67,7 +59,7 @@
97 #define IMPORT_NAME_UNDECORATE IMPNT(3)
98 #define TEST_IMPNT(t,v) (((t) & IMPNT(7)) == (v))
99
100 -uint32 swap_endian (uint32);
101 +uint32_t swap_endian (uint32_t);
102
103 #ifdef BIG_ENDIAN
104 #define btonat(u) u
105 @@ -87,7 +79,7 @@
106
107 #if !defined(_WIN32) && !defined(__MSDOS__)
108 #define spawnvp do_spawn
109 -int spawnvp (int, char *, char **);
110 +int spawnvp (int, char *, const char * const *);
111 #define P_WAIT 0
112 #define P_NOWAIT 1
113 #endif
114 diff -r 62cf992c82c9 reimp/util.c
115 --- a/reimp/util.c Fri Nov 26 19:02:28 2010 +0100
116 +++ b/reimp/util.c Fri Nov 26 19:14:59 2010 +0100
117 @@ -1,6 +1,7 @@
118 #include <stdarg.h>
119 #include <stdlib.h>
120 #include <string.h>
121 +#include <unistd.h>
122
123 #include <reimp.h>
124
125 @@ -9,14 +10,14 @@
126 #define swapb(a,b) a ^= b; b ^= a; a ^= b
127
128 /* swap little <=> big endian */
129 -uint32
130 -swap_endian (uint32 u)
131 +uint32_t
132 +swap_endian (uint32_t u)
133 {
134 #define swapb(a,b) a ^= b; b ^= a; a ^= b
135 unsigned char *p = (unsigned char *) &u;
136 swapb (p[0], p[3]);
137 swapb (p[1], p[2]);
138 - return *((uint32 *) p);
139 + return *((uint32_t *) p);
140 }
141
142
143 @@ -79,7 +80,7 @@
144 #endif
145
146 int
147 -spawnvp (int mode, char *path, char **argv)
148 +spawnvp (int mode, char *path, const char * const *argv)
149 {
150 int pid;
151 int status;
152 @@ -89,7 +90,7 @@
153 case -1:
154 return -1;
155 case 0:
156 - execvp (path, argv);
157 + execvp (path, (char * const *) argv);
158
159 _exit (EXIT_FAILURE);
160 break;