From 58573d69d94482ffd47c30aae1b1315bb5ae6fe8 Mon Sep 17 00:00:00 2001 From: Jiri Malak Date: Sat, 13 Jul 2024 23:38:35 +0200 Subject: [PATCH] tc2-build: correct various build breaks for Turbo C 2.0 build --- kernel/config.c | 2 +- kernel/inthndlr.c | 8 +++----- kernel/makefile | 2 +- kernel/newstuff.c | 18 +++++++++--------- 4 files changed, 14 insertions(+), 16 deletions(-) diff --git a/kernel/config.c b/kernel/config.c index 6ee2515..701ef09 100644 --- a/kernel/config.c +++ b/kernel/config.c @@ -2759,7 +2759,7 @@ STATIC void deletevar(BYTE far * pp) { if (NULL == pp) return; variablelength = fstrlen(pp) + 1; - fmemcpy(pp, pp + variablelength, envp + 3 - (pp + variablelength)); + fmemcpy(pp, pp + variablelength, (unsigned)(envp + 3 - (pp + variablelength))); /* our fmemcpy always copies forwards */ envp -= variablelength; return; diff --git a/kernel/inthndlr.c b/kernel/inthndlr.c index 5a8f7e9..a80e030 100644 --- a/kernel/inthndlr.c +++ b/kernel/inthndlr.c @@ -1640,7 +1640,7 @@ lfn_findclose: } } /* call to redirector */ - saved_r = *r; + fmemcpy(&saved_r, r, sizeof(saved_r)); r->ES = FP_SEG(s); r->DI = FP_OFF(s); r->flags |= FLG_CARRY; @@ -1652,9 +1652,8 @@ lfn_findclose: goto real_exit; } /* carry still set - unhandled */ - *r = saved_r; + fmemcpy(r, &saved_r, sizeof(saved_r)); goto unsupp; - break; } #ifdef WITHLFNAPI /* Win95 LFN - Win95 64 UTC file time to/from DOS date and time (local timezone) */ @@ -1682,7 +1681,6 @@ lfn_findclose: default: goto unsupp; } - break; #ifdef WITHLFNAPI /* Win95 beta LFN - find close */ case 0x72: goto lfn_findclose; @@ -1942,7 +1940,7 @@ VOID ASMCFUNC int2F_12_handler(struct int2f12regs FAR *pr) size = ~offs; /* BX for query HMA */ if (r.AL == 0x02) /* allocate HMA space */ { - tsize = (r.BX + 0xf) & 0xfffffff0; /* align to paragraph */ + tsize = (r.BX + 0xf) & 0xfffffff0UL; /* align to paragraph */ if (tsize < size) size = (UWORD)tsize; AllocateHMASpace(offs, offs+size); diff --git a/kernel/makefile b/kernel/makefile index 84ea822..7680141 100644 --- a/kernel/makefile +++ b/kernel/makefile @@ -155,7 +155,7 @@ initclk.obj: initclk.c $(INITHEADERS) $(TARGET).lnk #the string functions for INIT_TEXT iasmsupt.obj: asmsupt.asm $(TARGET).lnk - $(NASM) -D$(COMPILER) -D_INIT -f obj $(NASMFLAGS) -o $@ asmsupt.asm + $(NASM) -D$(COMPILER) -D_INIT -f obj $(NASMFLAGS) -o iasmsupt.obj asmsupt.asm #the printf for INIT_TEXT - yet another special case, this file includes prf.c iprf.obj: iprf.c prf.c $(HDR)portab.h $(TARGET).lnk diff --git a/kernel/newstuff.c b/kernel/newstuff.c index 9fe7347..481872e 100644 --- a/kernel/newstuff.c +++ b/kernel/newstuff.c @@ -321,10 +321,10 @@ COUNT truename(const char FAR * src, char * dest, COUNT mode) so we know src in the form of X:? fail if anything other than no path or path is \DEV\ */ - char drivesep[] = "\\/"; const char FAR *s = src+2; - const char *d = strchr(drivesep, *s); /* ?path starts with \ or / */ - + char c = *s; + + if( c != '\\' && c != '/' ) c = '\0'; /* could be 1 letter devicename, don't go scanning random memory */ if (*(src+3) != '\0') { @@ -336,7 +336,7 @@ COUNT truename(const char FAR * src, char * dest, COUNT mode) s = NULL; } - if (d == NULL) + if (c == '\0') { /* either X:devicename or X:path\devicename */ if (s != NULL) goto invalid_path; @@ -712,7 +712,7 @@ if exist report.out del report.out cmdspy stop cmdspy flush cmdspy restart -int ax=0x6000 -buf ds:si="abcöflkgsxkf\0" -buf es:di="%256s" -int 0x21 -d es:di:128 >spy_int.out +int ax=0x6000 -buf ds:si="abcöflkgsxkf\0" -buf es:di="%256s" -int 0x21 -d es:di:128 >spy_int.out cmdspy stop cmdspy report report.out more report.out @@ -732,11 +732,11 @@ more report.out 1123: IN: C:\TOOL\INT.COM [FAIL 0001] 1123: OUT: C:\INTRSPY\SPY_INT.OUT 1123: orig buffer: C:\TOOL\INT.COM -1123: IN: abcöflkgsxkf [FAIL 0001] +1123: IN: abcöflkgsxkf [FAIL 0001] 1123: OUT: C:\TOOL\INT.COM -1123: orig buffer: abcöflkgsxkf +1123: orig buffer: abcöflkgsxkf 1123: IN: C:\INTRSPY\SPY_INT.BAT [FAIL 0001] -1123: OUT: C:\INTRSPY\ABCÖFLKG +1123: OUT: C:\INTRSPY\ABCÖFLKG 1123: orig buffer: C:\INTRSPY\SPY_INT.BAT 1123: IN: cmdspy.??? [FAIL 0001] 1123: OUT: C:\INTRSPY @@ -758,7 +758,7 @@ DOSERR: 0000 (0) * { 43(C) 3A(:) 5C(\) 49(I) 4E(N) 54(T) 52(R) 53(S) 50(P) 59(Y) 5C(\) 41(A) -42(B) 43(C) 99(Ö) 46(F) 4C(L) 4B(K) 47(G) 00(.) 3D(=) 30(0) 30(0) 30(0) +42(B) 43(C) 99(Ö) 46(F) 4C(L) 4B(K) 47(G) 00(.) 3D(=) 30(0) 30(0) 30(0) 30(0) 20( ) 20( ) 20( ) 43(C) 58(X) 3D(=) 30(0) 30(0) 30(0) 30(0) 28(() 30(0) 29()) 20( ) 32(2) 38(8) 28(() 28(() 29()) 20( ) 33(3) 30(0) 28(() 30(0) 29()) 20( ) 32(2) 39(9) 28(() 29()) 29()) 20( ) 32(2) 30(0) 28(()