cast ptrdiff_t to int for ANSI

This commit is contained in:
eck 1990-04-25 15:10:13 +00:00
parent dc12b2fa3d
commit 7987a1fed8
5 changed files with 12 additions and 13 deletions

View file

@ -252,7 +252,7 @@ garbage:
ptok->tk_val = (arith)0; ptok->tk_val = (arith)0;
return ptok->tk_symb = INTEGER; return ptok->tk_symb = INTEGER;
} }
ptok->tk_str = Malloc(tg - buf); ptok->tk_str = Malloc((unsigned)(tg - buf));
strcpy(ptok->tk_str, buf); strcpy(ptok->tk_str, buf);
return IDENTIFIER; return IDENTIFIER;
} }

View file

@ -719,7 +719,7 @@ get_text(formals, length)
blank = 0; blank = 0;
} }
*length = repl->r_ptr - repl->r_text; *length = repl->r_ptr - repl->r_text;
return Realloc(repl->r_text, repl->r_ptr - repl->r_text + 1); return Realloc(repl->r_text, (unsigned)(repl->r_ptr - repl->r_text +1));
} }
/* macroeq() decides whether two macro replacement texts are /* macroeq() decides whether two macro replacement texts are

View file

@ -30,7 +30,7 @@ getwdir(fn)
return ""; return "";
if (p) { if (p) {
*p = '\0'; *p = '\0';
fn = Salloc(fn, p - &fn[0] + 1); fn = Salloc(fn, (unsigned)(p - &fn[0] + 1));
*p = '/'; *p = '/';
return fn; return fn;
} }

View file

@ -186,7 +186,7 @@ preprocess(fn)
if (c & 0200) { if (c & 0200) {
if (c == EOI) { if (c == EOI) {
newline(); newline();
flush(op-_obuf); flush((int)(op-_obuf));
return; return;
} }
fatal("non-ascii character read"); fatal("non-ascii character read");
@ -215,30 +215,29 @@ preprocess(fn)
case STCHAR: case STCHAR:
{ {
register int stopc = c; register int stopc = c;
int escaped; int escaped = 0;
do { do {
escaped = 0;
echo(c); echo(c);
c = GetChar(); c = GetChar();
if (c == '\n') { if (c == '\n') {
/* the compiler will complain */
break; break;
} }
else if (c == EOI) { else if (c == EOI) {
newline(); newline();
flush(op-_obuf); flush((int)(op-_obuf));
return; return;
} }
if (c == '\\') { if (!escaped && c == '\\') {
echo(c); echo(c);
c = GetChar(); c = GetChar();
if (c == '\n') { if (c == '\n') {
++LineNumber; ++LineNumber;
lineno++; lineno++;
} } else escaped = 1;
else if (c == '\'') escaped = 1; } else escaped = 0;
}
} while (escaped || c != stopc); } while (escaped || c != stopc);
echo(c); echo(c);
if (c == '\n') if (c == '\n')
@ -389,7 +388,7 @@ int *lineno;
for(;;) { for(;;) {
if (c == EOI) { if (c == EOI) {
newline(); newline();
flush(op - _obuf); flush((int)(op - _obuf));
op = 0; op = 0;
break; break;
} }

View file

@ -45,7 +45,7 @@ replace(idf)
if (!expand_macro(repl, idf)) if (!expand_macro(repl, idf))
return 0; return 0;
InputLevel++; InputLevel++;
InsertText(repl->r_text, repl->r_ptr - repl->r_text); InsertText(repl->r_text, (int)(repl->r_ptr - repl->r_text));
idf->id_macro->mc_flag |= NOREPLACE; idf->id_macro->mc_flag |= NOREPLACE;
repl->r_level = InputLevel; repl->r_level = InputLevel;
repl->next = ReplaceList; repl->next = ReplaceList;