You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by yl...@apache.org on 2022/06/24 10:52:19 UTC

svn commit: r1902222 - in /apr/apr/branches/1.8.x: ./ test/testmmap.c

Author: ylavic
Date: Fri Jun 24 10:52:18 2022
New Revision: 1902222

URL: http://svn.apache.org/viewvc?rev=1902222&view=rev
Log:
tests: Fix numeric types warnings.

By using the right numeric comparison assertions and some explicit casts.
  

Merge r1902205 from trunk (only the testmmap parts, apr-util ones ignored).
Submitted by: ylavic

Modified:
    apr/apr/branches/1.8.x/   (props changed)
    apr/apr/branches/1.8.x/test/testmmap.c

Propchange: apr/apr/branches/1.8.x/
------------------------------------------------------------------------------
  Merged /apr/apr/trunk:r1902205

Modified: apr/apr/branches/1.8.x/test/testmmap.c
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.8.x/test/testmmap.c?rev=1902222&r1=1902221&r2=1902222&view=diff
==============================================================================
--- apr/apr/branches/1.8.x/test/testmmap.c (original)
+++ apr/apr/branches/1.8.x/test/testmmap.c Fri Jun 24 10:52:18 2022
@@ -98,8 +98,9 @@ static void test_get_filesize(abts_case
 
     rv = apr_file_info_get(&thisfinfo, APR_FINFO_NORM, thefile);
     ABTS_INT_EQUAL(tc, APR_SUCCESS, rv);
+    ABTS_TRUE(tc, thisfinfo.size == (apr_off_t)(apr_size_t)thisfinfo.size);
 
-    thisfsize = thisfinfo.size;
+    thisfsize = (apr_size_t)thisfinfo.size;
     thisfdata = apr_palloc(ptest, thisfsize + 1);
     ABTS_PTR_NOTNULL(tc, thisfdata);
 }
@@ -110,6 +111,8 @@ static void read_expected_contents(abts_
     apr_size_t nbytes = 0;
     apr_status_t rv;
 
+    ABTS_TRUE(tc, *offset == (apr_off_t)(apr_size_t)*offset);
+
     rv = apr_file_read_full(thefile, thisfdata, thisfsize, &nbytes);
     ABTS_INT_EQUAL(tc, APR_SUCCESS, rv);
     ABTS_ASSERT(tc, "File size mismatch", nbytes == thisfsize);
@@ -124,7 +127,7 @@ static void read_expected_contents(abts_
      * all over the place in the next tests.
      */
     thisfdata += *offset;
-    thisfsize -= *offset;
+    thisfsize -= (apr_size_t)*offset;
 }
 
 static void test_mmap_create(abts_case *tc, void *data)