cast ptrdiff_t to int for ANSI
authoreck <none@none>
Wed, 25 Apr 1990 15:10:13 +0000 (15:10 +0000)
committereck <none@none>
Wed, 25 Apr 1990 15:10:13 +0000 (15:10 +0000)
lang/cem/cpp.ansi/LLlex.c
lang/cem/cpp.ansi/domacro.c
lang/cem/cpp.ansi/input.c
lang/cem/cpp.ansi/preprocess.c
lang/cem/cpp.ansi/replace.c

index 6c0b124..64108e1 100644 (file)
@@ -252,7 +252,7 @@ garbage:
                        ptok->tk_val = (arith)0;
                        return ptok->tk_symb = INTEGER;
                }
-               ptok->tk_str = Malloc(tg - buf);
+               ptok->tk_str = Malloc((unsigned)(tg - buf));
                strcpy(ptok->tk_str, buf);
                return IDENTIFIER;
        }
index 86d17b0..9e6aef8 100644 (file)
@@ -719,7 +719,7 @@ get_text(formals, length)
                blank = 0;
        }
        *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
index 62fad63..a38d67f 100644 (file)
@@ -30,7 +30,7 @@ getwdir(fn)
                return "";
        if (p) {
                *p = '\0';
-               fn = Salloc(fn, p - &fn[0] + 1);
+               fn = Salloc(fn, (unsigned)(p - &fn[0] + 1));
                *p = '/';
                return fn;
        }
index 025af03..f80ec00 100644 (file)
@@ -186,7 +186,7 @@ preprocess(fn)
                        if (c & 0200)  {
                                if (c == EOI) {
                                        newline();
-                                       flush(op-_obuf);
+                                       flush((int)(op-_obuf));
                                        return;
                                }
                                fatal("non-ascii character read");
@@ -215,30 +215,29 @@ preprocess(fn)
                        case STCHAR:
                                {
                                register int stopc = c;
-                               int escaped;
+                               int escaped = 0;
 
                                do {
 
-                                       escaped = 0;
                                        echo(c);
                                        c = GetChar();
                                        if (c == '\n') {
+                                       /* the compiler will complain */
                                                break;
                                        }
                                        else if (c == EOI) {
                                                newline();
-                                               flush(op-_obuf);
+                                               flush((int)(op-_obuf));
                                                return;
                                        }
-                                       if (c == '\\') {
+                                       if (!escaped && c == '\\') {
                                                echo(c);
                                                c = GetChar();
                                                if (c == '\n') {
                                                        ++LineNumber;
                                                        lineno++;
-                                               }
-                                               else if (c == '\'') escaped = 1;
-                                       }
+                                               } else escaped = 1;
+                                       } else escaped = 0;
                                } while (escaped || c != stopc);
                                echo(c);
                                if (c == '\n')
@@ -389,7 +388,7 @@ int *lineno;
        for(;;) {
                if (c == EOI) {
                        newline();
-                       flush(op - _obuf);
+                       flush((int)(op - _obuf));
                        op = 0;
                        break;
                }
index 487d86d..7585d26 100644 (file)
@@ -45,7 +45,7 @@ replace(idf)
        if (!expand_macro(repl, idf))
                return 0;
        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;
        repl->r_level = InputLevel;
        repl->next = ReplaceList;