Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(653)

Side by Side Diff: fusl/src/locale/iconv.c

Issue 1576423004: Remove -Wno-shift-op-parentheses for fusl build (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 #include <iconv.h> 1 #include <iconv.h>
2 #include <errno.h> 2 #include <errno.h>
3 #include <wchar.h> 3 #include <wchar.h>
4 #include <string.h> 4 #include <string.h>
5 #include <stdlib.h> 5 #include <stdlib.h>
6 #include <limits.h> 6 #include <limits.h>
7 #include <stdint.h> 7 #include <stdint.h>
8 #include "locale_impl.h" 8 #include "locale_impl.h"
9 9
10 #define UTF_32BE 0300 10 #define UTF_32BE 0300
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 static void put_16(unsigned char *s, unsigned c, int e) 128 static void put_16(unsigned char *s, unsigned c, int e)
129 { 129 {
130 e &= 1; 130 e &= 1;
131 s[e] = c>>8; 131 s[e] = c>>8;
132 s[1-e] = c; 132 s[1-e] = c;
133 } 133 }
134 134
135 static unsigned get_32(const unsigned char *s, int e) 135 static unsigned get_32(const unsigned char *s, int e)
136 { 136 {
137 e &= 3; 137 e &= 3;
138 » return s[e]+0U<<24 | s[e^1]<<16 | s[e^2]<<8 | s[e^3]; 138 » return ((unsigned)s[e])<<24 | s[e^1]<<16 | s[e^2]<<8 | s[e^3];
139 } 139 }
140 140
141 static void put_32(unsigned char *s, unsigned c, int e) 141 static void put_32(unsigned char *s, unsigned c, int e)
142 { 142 {
143 e &= 3; 143 e &= 3;
144 s[e^0] = c>>24; 144 s[e^0] = c>>24;
145 s[e^1] = c>>16; 145 s[e^1] = c>>16;
146 s[e^2] = c>>8; 146 s[e^2] = c>>8;
147 s[e^3] = c; 147 s[e^3] = c;
148 } 148 }
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 } 359 }
360 break; 360 break;
361 } 361 }
362 c = ksc[c][d]; 362 c = ksc[c][d];
363 if (!c) goto ilseq; 363 if (!c) goto ilseq;
364 break; 364 break;
365 default: 365 default:
366 if (c < 128+type) break; 366 if (c < 128+type) break;
367 c -= 128+type; 367 c -= 128+type;
368 c = legacy_chars[ map[c*5/4]>>2*c%8 | 368 c = legacy_chars[ map[c*5/4]>>2*c%8 |
369 » » » » map[c*5/4+1]<<8-2*c%8 & 1023 ]; 369 » » » » map[c*5/4+1]<<(8-2*c%8) & 1023 ];
370 if (!c) c = *(unsigned char *)*in; 370 if (!c) c = *(unsigned char *)*in;
371 if (c==1) goto ilseq; 371 if (c==1) goto ilseq;
372 } 372 }
373 373
374 switch (totype) { 374 switch (totype) {
375 case WCHAR_T: 375 case WCHAR_T:
376 if (*outb < sizeof(wchar_t)) goto toobig; 376 if (*outb < sizeof(wchar_t)) goto toobig;
377 *(wchar_t *)*out = c; 377 *(wchar_t *)*out = c;
378 *out += sizeof(wchar_t); 378 *out += sizeof(wchar_t);
379 *outb -= sizeof(wchar_t); 379 *outb -= sizeof(wchar_t);
(...skipping 14 matching lines...) Expand all
394 if (*outb < 1) goto toobig; 394 if (*outb < 1) goto toobig;
395 if (c < 128+totype) { 395 if (c < 128+totype) {
396 revout: 396 revout:
397 *(*out)++ = c; 397 *(*out)++ = c;
398 *outb -= 1; 398 *outb -= 1;
399 break; 399 break;
400 } 400 }
401 d = c; 401 d = c;
402 for (c=0; c<128-totype; c++) { 402 for (c=0; c<128-totype; c++) {
403 if (d == legacy_chars[ tomap[c*5/4]>>2*c%8 | 403 if (d == legacy_chars[ tomap[c*5/4]>>2*c%8 |
404 » » » » » tomap[c*5/4+1]<<8-2*c%8 & 1023 ]) { 404 » » » » » tomap[c*5/4+1]<<(8-2*c%8) & 1023 ]) {
405 c += 128; 405 c += 128;
406 goto revout; 406 goto revout;
407 } 407 }
408 } 408 }
409 goto subst; 409 goto subst;
410 case UCS2BE: 410 case UCS2BE:
411 case UCS2LE: 411 case UCS2LE:
412 case UTF_16BE: 412 case UTF_16BE:
413 case UTF_16LE: 413 case UTF_16LE:
414 if (c < 0x10000 || type-UCS2BE < 2U) { 414 if (c < 0x10000 || type-UCS2BE < 2U) {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 x = -1; 446 x = -1;
447 goto end; 447 goto end;
448 starved: 448 starved:
449 err = EINVAL; 449 err = EINVAL;
450 x = -1; 450 x = -1;
451 end: 451 end:
452 errno = err; 452 errno = err;
453 *ploc = loc; 453 *ploc = loc;
454 return x; 454 return x;
455 } 455 }
OLDNEW
« no previous file with comments | « fusl/include/endian.h ('k') | fusl/src/malloc/malloc.c » ('j') | fusl/src/malloc/malloc.c » ('J')

Powered by Google App Engine
This is Rietveld 408576698