| File: | lex.c |
| Location: | line 36, column 8 |
| Description: | The left operand of '==' is a garbage value |
| 1 | ||||
| 2 | #include <X11/Xos.h> | |||
| 3 | #include <X11/IntrinsicP.h> | |||
| 4 | #include <X11/StringDefs.h> | |||
| 5 | #include <stdio.h> | |||
| 6 | #include <ctype.h> | |||
| 7 | #include "DviP.h" | |||
| 8 | ||||
| 9 | int | |||
| 10 | DviGetAndPut(DviWidget dw, int *cp) | |||
| 11 | { | |||
| 12 | if (dw->dvi.ungot) | |||
| 13 | { | |||
| 14 | dw->dvi.ungot = 0; | |||
| 15 | *cp = getc (dw->dvi.file); | |||
| 16 | } | |||
| 17 | else | |||
| 18 | { | |||
| 19 | *cp = getc (dw->dvi.file); | |||
| 20 | putc (*cp, dw->dvi.tmpFile); | |||
| 21 | } | |||
| 22 | return *cp; | |||
| 23 | } | |||
| 24 | ||||
| 25 | char * | |||
| 26 | GetLine(DviWidget dw, char *Buffer, int Length) | |||
| 27 | { | |||
| 28 | int i = 0, c; | |||
| ||||
| 29 | char *p = Buffer; | |||
| 30 | ||||
| 31 | Length--; /* Save room for final NULL */ | |||
| 32 | ||||
| 33 | while ((!p || i < Length) && DviGetC (dw, &c)(dw->dvi.readingTmp ? ( ((*&c = getc (dw->dvi.tmpFile )) == (-1)) ? ( fseek (dw->dvi.tmpFile, 0l, 2), (dw->dvi .readingTmp = 0), (dw->dvi.tmpFile ? ( DviGetAndPut (dw, & c) ) : (*&c = getc (dw->dvi.file))) ) : ( *&c ) ) : ( (dw->dvi.tmpFile ? ( DviGetAndPut (dw, &c) ) : (*& c = getc (dw->dvi.file))) )) != EOF(-1) && c != '\n') | |||
| 34 | if (p) | |||
| 35 | *p++ = c; | |||
| 36 | if (c == '\n') | |||
| ||||
| 37 | DviUngetC(dw, c)(dw->dvi.readingTmp ? ( ungetc (c, dw->dvi.tmpFile) ) : ( (dw->dvi.ungot = 1), ungetc (c, dw->dvi.file))); | |||
| 38 | if (p) | |||
| 39 | *p = '\0'; | |||
| 40 | return (Buffer); | |||
| 41 | } | |||
| 42 | ||||
| 43 | char * | |||
| 44 | GetWord(DviWidget dw, char *Buffer, int Length) | |||
| 45 | { | |||
| 46 | int i = 0, c; | |||
| 47 | char *p = Buffer; | |||
| 48 | ||||
| 49 | Length--; /* Save room for final NULL */ | |||
| 50 | while (DviGetC(dw, &c)(dw->dvi.readingTmp ? ( ((*&c = getc (dw->dvi.tmpFile )) == (-1)) ? ( fseek (dw->dvi.tmpFile, 0l, 2), (dw->dvi .readingTmp = 0), (dw->dvi.tmpFile ? ( DviGetAndPut (dw, & c) ) : (*&c = getc (dw->dvi.file))) ) : ( *&c ) ) : ( (dw->dvi.tmpFile ? ( DviGetAndPut (dw, &c) ) : (*& c = getc (dw->dvi.file))) )) != EOF(-1) && isspace(c)) | |||
| 51 | ; | |||
| 52 | if (c != EOF(-1)) | |||
| 53 | DviUngetC(dw, c)(dw->dvi.readingTmp ? ( ungetc (c, dw->dvi.tmpFile) ) : ( (dw->dvi.ungot = 1), ungetc (c, dw->dvi.file))); | |||
| 54 | while (i < Length && DviGetC(dw, &c)(dw->dvi.readingTmp ? ( ((*&c = getc (dw->dvi.tmpFile )) == (-1)) ? ( fseek (dw->dvi.tmpFile, 0l, 2), (dw->dvi .readingTmp = 0), (dw->dvi.tmpFile ? ( DviGetAndPut (dw, & c) ) : (*&c = getc (dw->dvi.file))) ) : ( *&c ) ) : ( (dw->dvi.tmpFile ? ( DviGetAndPut (dw, &c) ) : (*& c = getc (dw->dvi.file))) )) != EOF(-1) && !isspace(c)) | |||
| 55 | if (p) | |||
| 56 | *p++ = c; | |||
| 57 | if (c != EOF(-1)) | |||
| 58 | DviUngetC(dw, c)(dw->dvi.readingTmp ? ( ungetc (c, dw->dvi.tmpFile) ) : ( (dw->dvi.ungot = 1), ungetc (c, dw->dvi.file))); | |||
| 59 | if (p) | |||
| 60 | *p = '\0'; | |||
| 61 | return (Buffer); | |||
| 62 | } | |||
| 63 | ||||
| 64 | int | |||
| 65 | GetNumber(DviWidget dw) | |||
| 66 | { | |||
| 67 | int i = 0, c; | |||
| 68 | ||||
| 69 | while (DviGetC(dw, &c)(dw->dvi.readingTmp ? ( ((*&c = getc (dw->dvi.tmpFile )) == (-1)) ? ( fseek (dw->dvi.tmpFile, 0l, 2), (dw->dvi .readingTmp = 0), (dw->dvi.tmpFile ? ( DviGetAndPut (dw, & c) ) : (*&c = getc (dw->dvi.file))) ) : ( *&c ) ) : ( (dw->dvi.tmpFile ? ( DviGetAndPut (dw, &c) ) : (*& c = getc (dw->dvi.file))) )) != EOF(-1) && isspace(c)) | |||
| 70 | ; | |||
| 71 | if (c != EOF(-1)) | |||
| 72 | DviUngetC(dw, c)(dw->dvi.readingTmp ? ( ungetc (c, dw->dvi.tmpFile) ) : ( (dw->dvi.ungot = 1), ungetc (c, dw->dvi.file))); | |||
| 73 | while (DviGetC(dw, &c)(dw->dvi.readingTmp ? ( ((*&c = getc (dw->dvi.tmpFile )) == (-1)) ? ( fseek (dw->dvi.tmpFile, 0l, 2), (dw->dvi .readingTmp = 0), (dw->dvi.tmpFile ? ( DviGetAndPut (dw, & c) ) : (*&c = getc (dw->dvi.file))) ) : ( *&c ) ) : ( (dw->dvi.tmpFile ? ( DviGetAndPut (dw, &c) ) : (*& c = getc (dw->dvi.file))) )) != EOF(-1) && isdigit(c)) | |||
| 74 | i = i*10 + c - '0'; | |||
| 75 | if (c != EOF(-1)) | |||
| 76 | DviUngetC(dw, c)(dw->dvi.readingTmp ? ( ungetc (c, dw->dvi.tmpFile) ) : ( (dw->dvi.ungot = 1), ungetc (c, dw->dvi.file))); | |||
| 77 | return (i); | |||
| 78 | } |