You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2013/11/20 00:09:52 UTC
svn commit: r1543630 - in /subversion/trunk/subversion/libsvn_subr:
utf8proc.c utf8proc/utf8proc.c
Author: stefan2
Date: Tue Nov 19 23:09:51 2013
New Revision: 1543630
URL: http://svn.apache.org/r1543630
Log:
Fix VisualC integer compiler warnings in UTF8 code.
* subversion/libsvn_subr/utf8proc/utf8proc.c
(utf8proc_encode_char): explicitly cast to the target type. The range
has been ensured by previous checks
* subversion/libsvn_subr/utf8proc.c
(svn_utf__fuzzy_escape): fix a mixed signedness comparison
Modified:
subversion/trunk/subversion/libsvn_subr/utf8proc.c
subversion/trunk/subversion/libsvn_subr/utf8proc/utf8proc.c
Modified: subversion/trunk/subversion/libsvn_subr/utf8proc.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/utf8proc.c?rev=1543630&r1=1543629&r2=1543630&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/utf8proc.c (original)
+++ subversion/trunk/subversion/libsvn_subr/utf8proc.c Tue Nov 19 23:09:51 2013
@@ -424,7 +424,7 @@ svn_utf__fuzzy_escape(const char *src, a
len = utf8proc_utf8class[(uint8_t)*p];
/* Check if the multi-byte sequence is valid UTF-8. */
- if (len > 1 && len <= length - done)
+ if (len > 1 && len <= (apr_ssize_t)(length - done))
last = svn_utf__last_valid(p, len);
else
last = NULL;
Modified: subversion/trunk/subversion/libsvn_subr/utf8proc/utf8proc.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/utf8proc/utf8proc.c?rev=1543630&r1=1543629&r2=1543630&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/utf8proc/utf8proc.c (original)
+++ subversion/trunk/subversion/libsvn_subr/utf8proc/utf8proc.c Tue Nov 19 23:09:51 2013
@@ -182,10 +182,10 @@ ssize_t utf8proc_encode_char(int32_t uc,
if (uc < 0x00) {
return 0;
} else if (uc < 0x80) {
- dst[0] = uc;
+ dst[0] = (uint8_t)uc;
return 1;
} else if (uc < 0x800) {
- dst[0] = 0xC0 + (uc >> 6);
+ dst[0] = 0xC0 + (uint8_t)(uc >> 6);
dst[1] = 0x80 + (uc & 0x3F);
return 2;
} else if (uc == 0xFFFF) {
@@ -195,12 +195,12 @@ ssize_t utf8proc_encode_char(int32_t uc,
dst[0] = 0xFE;
return 1;
} else if (uc < 0x10000) {
- dst[0] = 0xE0 + (uc >> 12);
+ dst[0] = 0xE0 + (uint8_t)(uc >> 12);
dst[1] = 0x80 + ((uc >> 6) & 0x3F);
dst[2] = 0x80 + (uc & 0x3F);
return 3;
} else if (uc < 0x110000) {
- dst[0] = 0xF0 + (uc >> 18);
+ dst[0] = 0xF0 + (uint8_t)(uc >> 18);
dst[1] = 0x80 + ((uc >> 12) & 0x3F);
dst[2] = 0x80 + ((uc >> 6) & 0x3F);
dst[3] = 0x80 + (uc & 0x3F);