--- parser3/src/lib/punycode/pa_punycode.c 2015/04/14 21:42:53 1.1 +++ parser3/src/lib/punycode/pa_punycode.c 2015/10/12 20:56:35 1.3 @@ -86,8 +86,7 @@ enum /* point (for use in representing integers) in the range 0 to */ /* base-1, or base if cp does not represent a value. */ -static punycode_uint -decode_digit (punycode_uint cp) +static punycode_uint decode_digit (punycode_uint cp) { return cp - 48 < 10 ? cp - 22 : cp - 65 < 26 ? cp - 65 : cp - 97 < 26 ? cp - 97 : base; @@ -99,10 +98,9 @@ decode_digit (punycode_uint cp) /* nonzero, in which case the uppercase form is used. The behavior */ /* is undefined if flag is nonzero and digit d has no uppercase form. */ -static char -encode_digit (punycode_uint d, int flag) +static char encode_digit (punycode_uint d, int flag) { - return d + 22 + 75 * (d < 26) - ((flag != 0) << 5); + return (char)(d + 22 + 75 * (d < 26) - ((flag != 0) << 5)); /* 0..25 map to ASCII a..z or A..Z */ /* 26..35 map to ASCII 0..9 */ } @@ -119,23 +117,21 @@ encode_digit (punycode_uint d, int flag) /* is caseless. The behavior is undefined if bcp is not a basic */ /* code point. */ -static char -encode_basic (punycode_uint bcp, int flag) +static char encode_basic (punycode_uint bcp, int flag) { bcp -= (bcp - 97 < 26) << 5; - return bcp + ((!flag && (bcp - 65 < 26)) << 5); + return (char)(bcp + ((!flag && (bcp - 65 < 26)) << 5)); } /*** Platform-specific constants ***/ /* maxint is the maximum value of a punycode_uint variable: */ -static const punycode_uint maxint = -1; +static const punycode_uint maxint = 0xFFFFFFFF; /* Because maxint is unsigned, -1 becomes the maximum value. */ /*** Bias adaptation function ***/ -static punycode_uint -adapt (punycode_uint delta, punycode_uint numpoints, int firsttime) +static punycode_uint adapt (punycode_uint delta, punycode_uint numpoints, int firsttime) { punycode_uint k; @@ -190,8 +186,7 @@ adapt (punycode_uint delta, punycode_uin * %PUNYCODE_SUCCESS, then @output_size and @output might contain * garbage. **/ -int -punycode_encode (size_t input_length, +int punycode_encode (size_t input_length, const punycode_uint input[], const unsigned char case_flags[], size_t * output_length, char output[]) @@ -339,8 +334,7 @@ punycode_encode (size_t input_length, * @output_length, @output, and @case_flags might contain garbage. * **/ -int -punycode_decode (size_t input_length, +int punycode_decode (size_t input_length, const char input[], size_t * output_length, punycode_uint output[], unsigned char case_flags[]) @@ -429,7 +423,7 @@ punycode_decode (size_t input_length, { memmove (case_flags + i + 1, case_flags + i, out - i); /* Case of last ASCII code point determines case flag: */ - case_flags[i] = flagged (input[in - 1]); + case_flags[i] = (unsigned char)(flagged (input[in - 1])); } memmove (output + i + 1, output + i, (out - i) * sizeof *output);