Author: dquintana
Date: Mon Jul 24 18:37:25 2017
New Revision: 75399
URL:
http://svn.reactos.org/svn/reactos?rev=75399&view=rev
Log:
[CABMAN]
Fix pointer math ('unsigned long' will truncate the pointer).
[MKISOFS/SCHILY TOOLS]
Fix the invalid assumption that a 'long' variable can hold pointers. Will be sent
upstream.
With this the whole of reactos and rostests builds on x64. Rosapps still has issues.
Modified:
trunk/reactos/sdk/tools/cabman/mszip.cxx
trunk/reactos/sdk/tools/mkisofs/schilytools/include/schily/schily.h
trunk/reactos/sdk/tools/mkisofs/schilytools/libschily/format.c
trunk/reactos/sdk/tools/mkisofs/schilytools/libschily/jsprintf.c
trunk/reactos/sdk/tools/mkisofs/schilytools/libschily/jssnprintf.c
Modified: trunk/reactos/sdk/tools/cabman/mszip.cxx
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/tools/cabman/mszip.cxx…
==============================================================================
--- trunk/reactos/sdk/tools/cabman/mszip.cxx [iso-8859-1] (original)
+++ trunk/reactos/sdk/tools/cabman/mszip.cxx [iso-8859-1] Mon Jul 24 18:37:25 2017
@@ -74,7 +74,7 @@
ZStream.next_in = (unsigned char*)InputBuffer;
ZStream.avail_in = InputLength;
- ZStream.next_out = (unsigned char*)((unsigned long)OutputBuffer + 2);
+ ZStream.next_out = ((unsigned char *)OutputBuffer + 2);
ZStream.avail_out = CAB_BLOCKSIZE + 12;
/* WindowBits is passed < 0 to tell that there is no zlib header */
@@ -137,7 +137,7 @@
return CS_BADSTREAM;
}
- ZStream.next_in = (unsigned char*)((unsigned long)InputBuffer + 2);
+ ZStream.next_in = ((unsigned char*)InputBuffer + 2);
ZStream.avail_in = InputLength - 2;
ZStream.next_out = (unsigned char*)OutputBuffer;
ZStream.avail_out = CAB_BLOCKSIZE + 12;
Modified: trunk/reactos/sdk/tools/mkisofs/schilytools/include/schily/schily.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/tools/mkisofs/schilyto…
==============================================================================
--- trunk/reactos/sdk/tools/mkisofs/schilytools/include/schily/schily.h [iso-8859-1]
(original)
+++ trunk/reactos/sdk/tools/mkisofs/schilytools/include/schily/schily.h [iso-8859-1] Mon
Jul 24 18:37:25 2017
@@ -46,6 +46,9 @@
#endif
#ifndef _SCHILY_CCOMDEFS_H
#include <schily/ccomdefs.h>
+#endif
+#ifndef _SCHILY_STDINT_H
+#include <schily/stdint.h>
#endif
#ifdef __cplusplus
@@ -464,12 +467,12 @@
extern int wcseql __PR((const wchar_t *, const wchar_t *));
#endif
#ifdef va_arg
-extern int format __PR((void (*)(char, long), long, const char *,
+extern int format __PR((void (*)(char, intptr_t), intptr_t, const char *,
va_list));
-extern int fprformat __PR((long, const char *, va_list));
+extern int fprformat __PR((intptr_t, const char *, va_list));
#else
-extern int format __PR((void (*)(char, long), long, const char *, void *));
-extern int fprformat __PR((long, const char *, void *));
+extern int format __PR((void (*)(char, intptr_t), intptr_t, const char *, void *));
+extern int fprformat __PR((intptr_t, const char *, void *));
#endif
extern int ftoes __PR((char *, double, int, int));
Modified: trunk/reactos/sdk/tools/mkisofs/schilytools/libschily/format.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/tools/mkisofs/schilyto…
==============================================================================
--- trunk/reactos/sdk/tools/mkisofs/schilytools/libschily/format.c [iso-8859-1]
(original)
+++ trunk/reactos/sdk/tools/mkisofs/schilytools/libschily/format.c [iso-8859-1] Mon Jul 24
18:37:25 2017
@@ -138,9 +138,9 @@
char *ptr; /* Current ptr in buf */
int cnt; /* Free char count in buf */
#else
- void (*outf)__PR((char, long)); /* Func from format(fun, arg) */
-#endif
- long farg; /* Arg from format (fun, arg) */
+ void (*outf)__PR((char, intptr_t)); /* Func from format(fun, arg) */
+#endif
+ intptr_t farg; /* Arg from format (fun, arg) */
int minusflag; /* Fieldwidth is negative */
int flags; /* General flags (+-#) */
int fldwidth; /* Field width as in %3d */
@@ -227,7 +227,7 @@
#define FORMAT_FUNC_NAME format
#define FORMAT_FUNC_PARM
-#define FORMAT_FUNC_PROTO_DECL void (*fun)(char, long),
+#define FORMAT_FUNC_PROTO_DECL void (*fun)(char, intptr_t),
#define FORMAT_FUNC_KR_DECL register void (*fun)();
#define FORMAT_FUNC_KR_ARGS fun,
@@ -243,14 +243,14 @@
#ifdef PROTOTYPES
EXPORT int
FORMAT_FUNC_NAME(FORMAT_FUNC_PROTO_DECL
- long farg,
+ intptr_t farg,
const char *fmt,
va_list oargs)
#else
EXPORT int
FORMAT_FUNC_NAME(FORMAT_FUNC_KR_ARGS farg, fmt, oargs)
FORMAT_FUNC_KR_DECL
- register long farg;
+ register intptr_t farg;
register char *fmt;
va_list oargs;
#endif
@@ -292,7 +292,7 @@
fa.ptr = fa.iobuf;
fa.fp = (FILE *)farg;
fa.err = 0;
- farg = fa.farg = (long)&fa;
+ farg = fa.farg = (intptr_t)&fa;
} else { /* recursion */
farg &= ~1;
}
@@ -1023,7 +1023,7 @@
}
out:
#ifdef FORMAT_BUFFER
- if (farg == (long)&fa) { /* Top level call, flush buffer */
+ if (farg == (intptr_t)&fa) { /* Top level call, flush buffer */
if (fa.err)
return (EOF);
if ((fa.ptr != fa.iobuf) &&
@@ -1208,9 +1208,9 @@
{
register int diff;
register int rfillc;
- register long arg = fa->farg;
+ register intptr_t arg = fa->farg;
#ifdef FORMAT_FUNC_PARM
- register void (*fun) __PR((char, long)) = fa->outf;
+ register void (*fun) __PR((char, intptr_t)) = fa->outf;
#endif
register int count;
register int lzero = 0;
@@ -1274,9 +1274,9 @@
{
register int diff;
register int rfillc;
- register long arg = fa->farg;
+ register intptr_t arg = fa->farg;
#ifdef FORMAT_FUNC_PARM
- register void (*fun) __PR((char, long)) = fa->outf;
+ register void (*fun) __PR((char, intptr_t)) = fa->outf;
#endif
register int count;
Modified: trunk/reactos/sdk/tools/mkisofs/schilytools/libschily/jsprintf.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/tools/mkisofs/schilyto…
==============================================================================
--- trunk/reactos/sdk/tools/mkisofs/schilytools/libschily/jsprintf.c [iso-8859-1]
(original)
+++ trunk/reactos/sdk/tools/mkisofs/schilytools/libschily/jsprintf.c [iso-8859-1] Mon Jul
24 18:37:25 2017
@@ -57,7 +57,7 @@
#else
va_start(args);
#endif
- ret = fprformat((long)stdout, form, args);
+ ret = fprformat((intptr_t)stdout, form, args);
va_end(args);
return (ret);
}
@@ -82,7 +82,7 @@
#else
va_start(args);
#endif
- ret = fprformat((long)file, form, args);
+ ret = fprformat((intptr_t)file, form, args);
va_end(args);
return (ret);
}
@@ -103,7 +103,7 @@
} *BUF, _BUF;
LOCAL void _bflush __PR((BUF));
-LOCAL void _bput __PR((char, long));
+LOCAL void _bput __PR((char, intptr_t));
EXPORT int js_fprintf __PR((FILE *, const char *, ...));
EXPORT int js_printf __PR((const char *, ...));
@@ -120,12 +120,12 @@
#ifdef PROTOTYPES
LOCAL void
-_bput(char c, long l)
+_bput(char c, intptr_t l)
#else
LOCAL void
_bput(c, l)
char c;
- long l;
+ intptr_t l;
#endif
{
register BUF bp = (BUF)l;
@@ -158,7 +158,7 @@
#else
va_start(args);
#endif
- format(_bput, (long)&bb, form, args);
+ format(_bput, (intptr_t)&bb, form, args);
va_end(args);
if (bb.cnt < BFSIZ)
_bflush(&bb);
@@ -189,7 +189,7 @@
#else
va_start(args);
#endif
- format(_bput, (long)&bb, form, args);
+ format(_bput, (intptr_t)&bb, form, args);
va_end(args);
if (bb.cnt < BFSIZ)
_bflush(&bb);
Modified: trunk/reactos/sdk/tools/mkisofs/schilytools/libschily/jssnprintf.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/tools/mkisofs/schilyto…
==============================================================================
--- trunk/reactos/sdk/tools/mkisofs/schilytools/libschily/jssnprintf.c [iso-8859-1]
(original)
+++ trunk/reactos/sdk/tools/mkisofs/schilytools/libschily/jssnprintf.c [iso-8859-1] Mon
Jul 24 18:37:25 2017
@@ -33,12 +33,12 @@
#ifdef PROTOTYPES
static void
-_cput(char c, long l)
+_cput(char c, intptr_t l)
#else
static void
_cput(c, l)
char c;
- long l;
+ intptr_t l;
#endif
{
register BUF bp = (BUF)l;
@@ -78,7 +78,7 @@
#else
va_start(args);
#endif
- cnt = format(_cput, (long)&bb, form, args);
+ cnt = format(_cput, (intptr_t)&bb, form, args);
va_end(args);
if (maxcnt > 0)
*(bb.ptr) = '\0';