Fix 'value truncated' compiler warning in CORD_cat (MS VC)
authorIvan Maidanski <ivmai@mail.ru>
Fri, 18 Sep 2015 22:26:36 +0000 (01:26 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Fri, 18 Sep 2015 22:26:36 +0000 (01:26 +0300)
* cord/cordbscs.c (CORD_cat_char_star, CORD_cat): Cast "lenx" to
unsigned char (to workaround false compiler warning about value
truncation).

cord/cordbscs.c

index 5653672..e8246d2 100644 (file)
@@ -221,7 +221,8 @@ CORD CORD_cat_char_star(CORD x, const char * y, size_t leny)
         if (result == 0) OUT_OF_MEMORY;
         result->header = CONCAT_HDR;
         result->depth = depth;
-        if (lenx <= MAX_LEFT_LEN) result->left_len = lenx;
+        if (lenx <= MAX_LEFT_LEN)
+            result->left_len = (unsigned char)lenx;
         result->len = result_len;
         result->left = x;
         result->right = y;
@@ -262,7 +263,8 @@ CORD CORD_cat(CORD x, CORD y)
         if (result == 0) OUT_OF_MEMORY;
         result->header = CONCAT_HDR;
         result->depth = depth;
-        if (lenx <= MAX_LEFT_LEN) result->left_len = lenx;
+        if (lenx <= MAX_LEFT_LEN)
+            result->left_len = (unsigned char)lenx;
         result->len = result_len;
         result->left = x;
         result->right = y;