diff --git a/IFUnicodeURL/IDNSDK/nameprep.c b/IFUnicodeURL/IDNSDK/nameprep.c index 95e2fc9..b69834e 100644 --- a/IFUnicodeURL/IDNSDK/nameprep.c +++ b/IFUnicodeURL/IDNSDK/nameprep.c @@ -73,9 +73,9 @@ static const int SCount = 11172; /* LCount * NCount */ static void insert( DWORD * target, size_t * length, size_t offset, DWORD ch ) { int i; - if (offset < 0 || offset > *length) {return;} + if (offset > *length) {return;} - for (i=(*length); i>offset; i--) {target[i] = target[i-1];} + for (i=(int)(*length); i>offset; i--) {target[i] = target[i-1];} target[offset] = ch; @@ -160,11 +160,11 @@ static int composeHangul( DWORD dwLastCh, DWORD ch, DWORD * pdwOut ) /* 1. check to see if two current characters are L and V */ - LIndex = dwLastCh - LBase; + LIndex = (int)(dwLastCh - LBase); if ( 0 <= LIndex && LIndex < LCount ) { - int VIndex = ch - VBase; + int VIndex = (int)(ch - VBase); if ( 0 <= VIndex && VIndex < VCount ) { @@ -177,11 +177,11 @@ static int composeHangul( DWORD dwLastCh, DWORD ch, DWORD * pdwOut ) /* 2. check to see if two current characters are LV and T */ - SIndex = dwLastCh - SBase; + SIndex = (int)(dwLastCh - SBase); if ( 0 <= SIndex && SIndex < SCount && (SIndex % TCount) == 0 ) { - int TIndex = ch - TBase; + int TIndex = (int)(ch - TBase); if (0 <= TIndex && TIndex <= TCount) { @@ -212,7 +212,7 @@ static int composeHangul( DWORD dwLastCh, DWORD ch, DWORD * pdwOut ) static int decomposeHangul( DWORD ch, DWORD * pdwOut ) { - int SIndex = ch - SBase; + int SIndex = (int)(ch - SBase); int L; int V; int T; @@ -345,7 +345,7 @@ static int doKCDecompose( const DWORD * input, int input_size, { ch = buf[j]; - cClass = lookup_canonical(ch); + cClass = (int)lookup_canonical(ch); cursor = output_offset; @@ -353,7 +353,7 @@ static int doKCDecompose( const DWORD * input, int input_size, { for (; cursor > 0; --cursor) { - nCanonicalItem = lookup_canonical(output[cursor-1]); + nCanonicalItem = (int)lookup_canonical(output[cursor-1]); if (nCanonicalItem <= cClass) {break;} } } @@ -363,7 +363,7 @@ static int doKCDecompose( const DWORD * input, int input_size, if (output_offset > *output_size) {return XCODE_NAMEPREP_BUFFER_OVERFLOW_ERROR;} - *output_size = output_offset; + *output_size = (int)output_offset; return XCODE_SUCCESS; } @@ -392,7 +392,7 @@ static int doKCCompose( DWORD * output, int * output_size ) startCh = output[0]; - lastClass = lookup_canonical(startCh); + lastClass = (int)lookup_canonical(startCh); if ( lastClass != 0 ) { @@ -408,7 +408,7 @@ static int doKCCompose( DWORD * output, int * output_size ) DWORD ch = output[decompPos]; - chClass = lookup_canonical(ch); + chClass = (int)lookup_canonical(ch); nComposeResult = composeHangul( startCh, ch, &nComposeItem ); @@ -426,7 +426,7 @@ static int doKCCompose( DWORD * output, int * output_size ) composite = 0xffff; /* 65535 */ } else { - composite = nComposeItem; + composite = (int)nComposeItem; } if (composite != 0xffff && (lastClass < chClass || lastClass == 0)) diff --git a/IFUnicodeURL/IDNSDK/puny.c b/IFUnicodeURL/IDNSDK/puny.c index 57035d6..3414aaa 100644 --- a/IFUnicodeURL/IDNSDK/puny.c +++ b/IFUnicodeURL/IDNSDK/puny.c @@ -187,7 +187,7 @@ int punycode_encode( unsigned int input_length, ++delta, ++n; } - *output_length = out; + *output_length = (int)out; return XCODE_SUCCESS; } @@ -270,7 +270,7 @@ int punycode_decode( unsigned int input_length, output[i++] = n; } - *output_length = out; + *output_length = (int)out; return XCODE_SUCCESS; } diff --git a/IFUnicodeURL/IDNSDK/toxxx.c b/IFUnicodeURL/IDNSDK/toxxx.c index 6fbb48f..406815e 100644 --- a/IFUnicodeURL/IDNSDK/toxxx.c +++ b/IFUnicodeURL/IDNSDK/toxxx.c @@ -189,7 +189,7 @@ int Xcode_ToASCII( const UTF16CHAR * puzInputString, en = 0; for ( i = 0; i < iOutputSize; i++ ) { - if ( *(dwzOutputString+i) < 0 || *(dwzOutputString+i) > 0x7F ) + if ( *(dwzOutputString+i) > 0x7F ) { int res; /* 5. Verify that the sequence does NOT begin with the ACE prefix. */ diff --git a/IFUnicodeURL/IDNSDK/util.c b/IFUnicodeURL/IDNSDK/util.c index af2fd69..addce46 100644 --- a/IFUnicodeURL/IDNSDK/util.c +++ b/IFUnicodeURL/IDNSDK/util.c @@ -61,7 +61,7 @@ absence of 0..2C, 2E..2F, 3A..40, 5B..60, and 7B..7F. int is_ldh_character32(const DWORD c) { - if ( ( c >= 0x0000 && c <= 0x002C ) || + if ( c <= 0x002C || ( c == 0x002E || c == 0x002F ) || ( c >= 0x003A && c <= 0x0040 ) || ( c >= 0x005B && c <= 0x0060 ) || @@ -479,7 +479,7 @@ UCHAR8 * pszResult, int * piResultLength ) if (high) {return XCODE_UTIL_LONELY_HIGH_SURROGATE;} - *piResultLength = output_offset; + *piResultLength = (int)output_offset; return XCODE_SUCCESS; } @@ -604,7 +604,7 @@ int * piResultLength ) return XCODE_UTIL_INVALID_8BIT_INPUT; } - *piResultLength = output_offset; + *piResultLength = (int)output_offset; return XCODE_SUCCESS; } diff --git a/IFUnicodeURL/NSURL+IFUnicodeURL.m b/IFUnicodeURL/NSURL+IFUnicodeURL.m index a0dab3a..517d9af 100644 --- a/IFUnicodeURL/NSURL+IFUnicodeURL.m +++ b/IFUnicodeURL/NSURL+IFUnicodeURL.m @@ -43,7 +43,7 @@ - (NSArray *)IFUnicodeURL_splitBeforeCharactersInSet:(NSCharacterSet *)chars static NSString *ConvertUnicodeDomainString(NSString *hostname, BOOL toAscii) { const UTF16CHAR *inputString = (const UTF16CHAR *)[hostname cStringUsingEncoding:NSUTF16StringEncoding]; - int inputLength = [hostname lengthOfBytesUsingEncoding:NSUTF16StringEncoding] / sizeof(UTF16CHAR); + int inputLength = (int)([hostname lengthOfBytesUsingEncoding:NSUTF16StringEncoding] / sizeof(UTF16CHAR)); if (toAscii) { int outputLength = MAX_DOMAIN_SIZE_8;