]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Fix compile warning due to -Wcast-qual.
authorAndres Mejia <amejia004@gmail.com>
Sat, 23 Feb 2013 01:01:42 +0000 (20:01 -0500)
committerAndres Mejia <amejia004@gmail.com>
Sat, 23 Feb 2013 01:01:42 +0000 (20:01 -0500)
libarchive/test/test_archive_string.c

index 20e03d6e37571465771655c80ee77fb7fe4f96d9..7303be84deba9177ed1c6d018e4a168cfc35548a 100644 (file)
@@ -383,8 +383,8 @@ DEFINE_TEST(test_archive_string_sort)
   srand(time(NULL));
   size = sizeof(strings) / sizeof(char *);
   assert((test_strings = (char **)calloc(1, sizeof(strings))) != NULL);
-  for (i = 0; i < size; i++)
-    test_strings[i] = (char*)strings[i];
+  for (i = 0; i < (size - 1); i++)
+    assert((test_strings[i] = strdup(strings[i])) != NULL);
 
   /* Shuffle the test strings */
   for (i = 0; i < (size - 1); i++)
@@ -401,5 +401,7 @@ DEFINE_TEST(test_archive_string_sort)
   for (i = 0; i < (size - 1); i++)
     assertEqualString(test_strings[i], strings[i]);
 
+  for (i = 0; i < (size - 1); i++)
+    free(test_strings[i]);
   free(test_strings);
 }