summaryrefslogtreecommitdiffstats
path: root/src/zip-1-fixes.patch
blob: daa55833c4a301edb9f24327e0f06fc832c7a487 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
This file is part of MXE. See LICENSE.md for licensing information.

Contains ad hoc patches for cross building.

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Mark Brand <mabrand@mabrand.nl>
Date: Tue, 27 Feb 2018 16:22:41 +0100
Subject: [PATCH 1/2] MXE build fixes


diff --git a/win32/makefile.gcc b/win32/makefile.gcc
index 1111111..2222222 100644
--- a/win32/makefile.gcc
+++ b/win32/makefile.gcc
@@ -150,10 +150,10 @@ zipcloak.exe: $(OBJC)
 	$(LD) $(LDFLAGS) $(OBJC) $(LIBS)
 
 zipnote.exe: $(OBJN)
-	$(LD) $(LDFLAGS) $(OBJN)
+	$(LD) $(LDFLAGS) $(OBJN) $(LIBS)
 
 zipsplit.exe: $(OBJS)
-	$(LD) $(LDFLAGS) $(OBJS)
+	$(LD) $(LDFLAGS) $(OBJS) $(LIBS)
 
 clean:
 	rm -f *.o $(ZIPS)
diff --git a/win32/osdep.h b/win32/osdep.h
index 1111111..2222222 100644
--- a/win32/osdep.h
+++ b/win32/osdep.h
@@ -438,10 +438,10 @@
 #endif
 
 #ifdef _MBCS
-#  if (!defined(__EMX__) && !defined(__MINGW32__) && !defined(__CYGWIN__))
+//#  if (!defined(__EMX__) && !defined(__MINGW32__) && !defined(__CYGWIN__))
 #    include <stdlib.h>
 #    include <mbstring.h>
-#  endif
+//#  endif
 #  if (defined(__MINGW32__) && !defined(MB_CUR_MAX))
 #    ifdef __MSVCRT__
        IZ_IMP extern int *__p___mb_cur_max(void);

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Mark Brand <mabrand@mabrand.nl>
Date: Mon, 17 Sep 2018 22:10:32 +0200
Subject: [PATCH 2/2] avoid define clash on CR


diff --git a/zip.h b/zip.h
index 1111111..2222222 100644
--- a/zip.h
+++ b/zip.h
@@ -262,7 +262,7 @@ struct plist {
 
 /* ASCII definitions for line terminators in text files: */
 #define LF     10        /* '\n' on ASCII machines; must be 10 due to EBCDIC */
-#define CR     13        /* '\r' on ASCII machines; must be 13 due to EBCDIC */
+#define ZIPCR  13        /* '\r' on ASCII machines; must be 13 due to EBCDIC */
 #define CTRLZ  26        /* DOS & OS/2 EOF marker (used in fileio.c, vms.c) */
 
 /* return codes of password fetches (negative: user abort; positive: error) */
diff --git a/zipup.c b/zipup.c
index 1111111..2222222 100644
--- a/zipup.c
+++ b/zipup.c
@@ -1207,7 +1207,7 @@ local unsigned file_read(buf, size)
             char c;
 
             if ((c = *b++) == '\n') {
-               *buf++ = CR; *buf++ = LF; len++;
+               *buf++ = ZIPCR; *buf++ = LF; len++;
             } else {
               *buf++ = (char)ascii[(uch)c];
             }
@@ -1217,7 +1217,7 @@ local unsigned file_read(buf, size)
 #endif /* EBCDIC */
       {
          do {
-            if ((*buf++ = *b++) == '\n') *(buf-1) = CR, *buf++ = LF, len++;
+            if ((*buf++ = *b++) == '\n') *(buf-1) = ZIPCR, *buf++ = LF, len++;
          } while (--size != 0);
       }
       buf -= len;
@@ -1257,7 +1257,7 @@ local unsigned file_read(buf, size)
 #endif /* EBCDIC */
       {
          do {
-            if (( *buf++ = *b++) == CR && *b == LF) buf--, len--;
+            if (( *buf++ = *b++) == ZIPCR && *b == LF) buf--, len--;
          } while (--size != 0);
       }
       if (len == 0) {