Mercurial > cpython-lru_cache-weakref
diff Objects/unicodeobject.c @ 13633:e1469b7a2e68 legacy-trunk
gcc is being stupid with if/else constructs
clean out some other warnings
| author | Greg Stein <gstein@lyra.org> |
|---|---|
| date | Mon, 17 Jul 2000 09:04:43 +0000 |
| parents | d6d23d5e296d |
| children | dfb7ecfffe3d |
line wrap: on
line diff
--- a/Objects/unicodeobject.c Mon Jul 17 03:06:58 2000 +0000 +++ b/Objects/unicodeobject.c Mon Jul 17 09:04:43 2000 +0000 @@ -421,13 +421,15 @@ else v = PyUnicode_Decode(s, len, encoding, errors); done: - if (owned) + if (owned) { Py_DECREF(obj); + } return v; onError: - if (owned) + if (owned) { Py_DECREF(obj); + } return NULL; } @@ -632,11 +634,11 @@ } #define UTF8_ERROR(details) \ - if (1) { \ + do { \ if (utf8_decoding_error(&s, &p, errors, (details))) \ goto onError; \ - continue; \ - } else + goto nextchar; \ + } while (0) PyObject *PyUnicode_DecodeUTF8(const char *s, int size, @@ -732,6 +734,9 @@ UTF8_ERROR("unsupported Unicode code range"); } s += n; + + nextchar: + ; } /* Adjust length */ @@ -747,6 +752,8 @@ #undef UTF8_ERROR +/* NOT USED */ +#if 0 static int utf8_encoding_error(const Py_UNICODE **source, char **dest, @@ -776,6 +783,7 @@ return -1; } } +#endif /* NOT USED */ PyObject *PyUnicode_EncodeUTF8(const Py_UNICODE *s, int size, @@ -826,7 +834,7 @@ ch = ((ch - 0xD800)<<10 | (ch2-0xDC00))+0x10000; *p++ = (char)((ch >> 18) | 0xf0); - *p++ = (char)(0x80 | (ch >> 12) & 0x3f); + *p++ = (char)(0x80 | ((ch >> 12) & 0x3f)); i++; cbWritten += 4; }
