Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add patch for windows 32bit #7

Merged
merged 1 commit into from
Sep 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions alienfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use alienfile;
use Config;

plugin 'Probe::CommandLine' => (
command => 'unzip',
Expand Down Expand Up @@ -29,6 +30,11 @@ share {

plugin 'Build::Make' => 'gmake';

if($Config{ptrsize} == 4)
{
patch [ 'patch --binary -p1 < %{.install.patch}/windows-32-bit.diff' ];
}

build [
[ '%{make}', -f => 'win32/Makefile.gcc', 'CC_CPU_OPT=', 'NOASM=1' ],
[ 'mkdir', '%{prefix_win}\\bin' ],
Expand Down
57 changes: 57 additions & 0 deletions patch/windows-32-bit.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
diff --git a/fileio.c b/fileio.c
index ba0a1d0..024b9ec 100644
--- a/fileio.c
+++ b/fileio.c
@@ -1011,7 +1011,7 @@ static int partflush(__G__ rawbuf, size, unshrink)
++p;
G.didCRlast = FALSE;
for (q = transbuf; (extent)(p-rawbuf) < (extent)size; ++p) {
- if (*p == CR) { /* lone CR or CR/LF: treat as EOL */
+ if (*p == CRX) { /* lone CR or CR/LF: treat as EOL */
PutNativeEOL
if ((extent)(p-rawbuf) == (extent)size-1)
/* last char in buffer */
@@ -2115,7 +2115,7 @@ int do_string(__G__ length, option) /* return PK-type error code */
* (since used before A_TO_N(), check for CR instead of '\r')
*/
while (*p) {
- while (*p == CR)
+ while (*p == CRX)
++p;
*q++ = *p++;
}
@@ -2164,7 +2164,7 @@ int do_string(__G__ length, option) /* return PK-type error code */
pause = TRUE;
if (p[1] == LF) /* ASCII LF */
*q++ = *++p;
- else if (p[1] == CR && p[2] == LF) { /* ASCII CR LF */
+ else if (p[1] == CRX && p[2] == LF) { /* ASCII CR LF */
*q++ = *++p;
*q++ = *++p;
}
diff --git a/unzpriv.h b/unzpriv.h
index dc9eff5..eee0517 100644
--- a/unzpriv.h
+++ b/unzpriv.h
@@ -1841,7 +1841,7 @@
#define HSIZE (1 << MAX_BITS) /* size of global work area */

#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 CRX 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) */

#ifdef EBCDIC
diff --git a/win32/w32cfg.h b/win32/w32cfg.h
index bb140ce..9958ae0 100644
--- a/win32/w32cfg.h
+++ b/win32/w32cfg.h
@@ -184,7 +184,7 @@
#endif
#define DATE_SEPCHAR dateseparator()
#define lenEOL 2
-#define PutNativeEOL {*q++ = native(CR); *q++ = native(LF);}
+#define PutNativeEOL {*q++ = native(CRX); *q++ = native(LF);}

#if (defined(__RSXNT__) && !defined(HAVE_MKTIME))
# define HAVE_MKTIME /* use mktime() in time conversion routines */