Mercurial > cpython-lru_cache-weakref
comparison Python/pythonrun.c @ 15740:0a77013c50ac legacy-trunk
Fix signed/unsigned wng. Unfortunately, (unsigned char) << int
has type int in C.
| author | Tim Peters <tim.peters@gmail.com> |
|---|---|
| date | Fri, 05 Jan 2001 00:54:29 +0000 |
| parents | 76caf0855d1f |
| children | cf17a3ce5387 |
comparison
equal
deleted
inserted
replaced
| 15739:97821a46e000 | 15740:0a77013c50ac |
|---|---|
| 568 /* Read only two bytes of the magic. If the file was opened in | 568 /* Read only two bytes of the magic. If the file was opened in |
| 569 text mode, the bytes 3 and 4 of the magic (\r\n) might not | 569 text mode, the bytes 3 and 4 of the magic (\r\n) might not |
| 570 be read as they are on disk. */ | 570 be read as they are on disk. */ |
| 571 unsigned int halfmagic = PyImport_GetMagicNumber() & 0xFFFF; | 571 unsigned int halfmagic = PyImport_GetMagicNumber() & 0xFFFF; |
| 572 unsigned char buf[2]; | 572 unsigned char buf[2]; |
| 573 if (fread(buf, 1, 2, fp) == 2 | 573 if (fread(buf, 1, 2, fp) == 2 |
| 574 && (buf[1]<<8 | buf[0]) == halfmagic) | 574 && ((unsigned int)buf[1]<<8 | buf[0]) == halfmagic) |
| 575 return 1; | 575 return 1; |
| 576 fseek(fp, 0, SEEK_SET); | 576 fseek(fp, 0, SEEK_SET); |
| 577 } | 577 } |
| 578 return 0; | 578 return 0; |
| 579 } | 579 } |
