Portability fixes.

committer: mfx <mfx> 1037058393 +0000
This commit is contained in:
Markus F.X.J. Oberhumer 2002-11-11 23:46:33 +00:00
parent 60031bed47
commit 7802257700
8 changed files with 26 additions and 22 deletions

View File

@ -8,7 +8,7 @@
# `make target=mingw32' # win32 - mingw32
# `make target=no-cygwin' # win32 - mingw32 as included in cygwin 1.3.x
# `make target=bcc' # win32 - Borland C++ 5.5.1
# `make target=dmc' # win32 - Digital Mars C++ 8.28
# `make target=dmc' # win32 - Digital Mars C++ 8.30
# `make target=vc6' # win32 - Visual C++ 6.0
# `make target=wcc' # win32 - Watcom C++ 11.0c
# `make target=cross-m68k-linux' # m68k-linux cross compiler
@ -314,6 +314,7 @@ endif # djgpp2
ifeq ($(target),cygwin)
e = .exe
CC += -march=i386 -mcpu=i586
CXXLD = g++
##CFLAGS_M += -mno-schedule-prologue
endif
@ -321,6 +322,7 @@ ifeq ($(target),mingw32)
e = .exe
CC = gcc -mno-cygwin
CC += -march=i386 -mcpu=i586
CXXLD = g++ -mno-cygwin
##CFLAGS_M += -mno-schedule-prologue
endif
@ -329,6 +331,7 @@ ifeq ($(target),no-cygwin)
e = .exe
CC = gcc -mno-cygwin
CC += -march=i386 -mcpu=i586
CXXLD = g++ -mno-cygwin
##CFLAGS_M += -mno-schedule-prologue
endif
@ -356,7 +359,7 @@ CXXFLAGS1 = $(CFLAGS)
CXXFLAGS2 = $(CFLAGS) -x- -xd- -RT-
CFLAGS_OUTPUT = -o$@
LDFLAGS =
LDLIBS = $(DOS_LDLIBS)
LDLIBS = $(DOS_LDLIBS) zlib114.lib
ifneq ($(strip $(DOS_LIBDIRS)),)
LIB := $(DOS_LIBDIRS);$(LIB)
@ -375,14 +378,14 @@ endif # bcc
###
### Digital Mars C++ 8.28
### Digital Mars C++ 8.30
###
ifeq ($(target),dmc)
o = .obj
a = .lib
e = .exe
CC = sc -mn
CC = dmc -mn
CFLAGS = -w- -wx
CXXFLAGS1 = $(CFLAGS) -Aa -Ab -Ae -Ar
CXXFLAGS2 = $(CFLAGS) -Aa -Ab
@ -433,7 +436,7 @@ ifeq (1,2)
else
# link against msvcrt.dll
CC += -MD
LDLIBS = $(DOS_LDLIBS) setargv.obj
LDLIBS = $(DOS_LDLIBS) zlib114.lib setargv.obj
endif
ifeq ($(DEBUG),1)
CFLAGS += -Od -ZI

View File

@ -41,9 +41,9 @@
\
i = N - 1; \
do { \
T delta = get(b) - d[i]; \
T delta = (T) (get(b) - d[i]); \
set(b, delta); \
d[i] += delta; \
d[i] = (T) (d[i] + delta); \
b += sizeof(T); \
if (--i < 0) \
i = N - 1; \
@ -63,7 +63,7 @@
\
i = N - 1; \
do { \
d[i] += get(b); \
d[i] = (T) (d[i] + get(b)); \
set(b, d[i]); \
b += sizeof(T); \
if (--i < 0) \

View File

@ -657,7 +657,7 @@ void PackExe::unpack(OutputFile *fo)
set_le32(wrkmem+4*relocn++,0);
}
unsigned outputlen = sizeof(oh)+relocn*4+relocs-obuf;
unsigned outputlen = ptr_diff(relocs, obuf) + sizeof(oh) + relocn*4;
oh.m512 = outputlen & 511;
oh.p512 = (outputlen + 511) >> 9;
oh.headsize16 = 2+relocn/4;
@ -689,7 +689,7 @@ void PackExe::unpack(OutputFile *fo)
fo->write(&oh,sizeof(oh));
if (relocn)
fo->write(wrkmem,relocn*4);
fo->write(obuf,relocs-obuf);
fo->write(obuf, ptr_diff(relocs, obuf));
// copy the overlay
copyOverlay(fo, ih_overlay, &obuf);

View File

@ -217,9 +217,9 @@ void PackLinuxI386elf::packExtent(
set_native32(&tmp.sz_unc, ph.u_len);
set_native32(&tmp.sz_cpr, ph.c_len);
if (ph.c_len < ph.u_len) {
tmp.b_method = ph.method;
tmp.b_method = (unsigned char) ph.method;
if (ft) {
tmp.b_ftid = ft->id;
tmp.b_ftid = (unsigned char) ft->id;
tmp.b_cto8 = ft->cto;
}
}
@ -381,7 +381,7 @@ void PackLinuxI386elf::unpackExtent(unsigned wanted, OutputFile *fo,
else if (ph.filter) {
Filter ft(ph.level);
ft.init(ph.filter, 0);
ft.cto = ph.filter_cto;
ft.cto = (unsigned char) ph.filter_cto;
ft.unfilter(ibuf, sz_unc);
}
}

View File

@ -186,9 +186,9 @@ PackLinuxI386::buildLinuxLoader(
hf->ehdr.e_phentsize * hf->ehdr.e_phnum + sizeof(l_info) );
struct b_info h; memset(&h, 0, sizeof(h));
h.sz_unc = szfold - fold_hdrlen;
h.b_method = ph.method;
h.b_ftid = ph.filter;
h.b_cto8 = ph.filter_cto;
h.b_method = (unsigned char) ph.method;
h.b_ftid = (unsigned char) ph.filter;
h.b_cto8 = (unsigned char) ph.filter_cto;
unsigned char const *const uncLoader = fold_hdrlen + fold;
unsigned char *const cprLoader = new unsigned char[sizeof(h) + h.sz_unc];

View File

@ -211,7 +211,7 @@ void PackTmt::pack(OutputFile *fo)
{
for (unsigned ic=4; ic<=rsize; ic+=4)
set_le32(wrkmem+ic,get_le32(wrkmem+ic)-4);
relocsize = optimizeReloc32(wrkmem+4,rsize/4,wrkmem,ibuf,1,&big_relocs)- wrkmem;
relocsize = ptr_diff(optimizeReloc32(wrkmem+4,rsize/4,wrkmem,ibuf,1,&big_relocs), wrkmem);
}
wrkmem[relocsize++] = 0;
@ -311,7 +311,7 @@ void PackTmt::unpack(OutputFile *fo)
Filter ft(ph.level);
ft.init(ph.filter, 0);
ft.cto = (unsigned char) (ph.version < 11 ? (get_le32(obuf+ph.u_len-12) >> 24) : ph.filter_cto);
ft.unfilter(obuf, relocs-obuf);
ft.unfilter(obuf, ptr_diff(relocs, obuf));
}
// decode relocations

View File

@ -115,7 +115,7 @@ bool PackUnix::checkCompressionRatio(unsigned, unsigned) const
return true;
}
void PackUnix::pack1(OutputFile */*fo*/, Filter &/*ft*/)
void PackUnix::pack1(OutputFile * /*fo*/, Filter & /*ft*/)
{
// derived class usually provides this
}
@ -193,9 +193,9 @@ void PackUnix::pack2(OutputFile *fo, Filter &ft)
set_native32(&blk_info.sz_unc, ph.u_len);
set_native32(&blk_info.sz_cpr, ph.c_len);
if (ph.c_len < ph.u_len) {
blk_info.b_method = ph.method;
blk_info.b_ftid = ph.filter;
blk_info.b_cto8 = ph.filter_cto;
blk_info.b_method = (unsigned char) ph.method;
blk_info.b_ftid = (unsigned char) ph.filter;
blk_info.b_cto8 = (unsigned char) ph.filter_cto;
}
fo->write(&blk_info, sizeof(blk_info));
b_len += sizeof(b_info);

View File

@ -45,6 +45,7 @@
#include <typeinfo.h>
namespace std {
#undef type_info
typedef ::Type_info type_info;
class exception
{