In perl.git, the branch blead has been updated

<https://perl5.git.perl.org/perl.git/commitdiff/e0280e4921cf0b53edc3e4790ff6f201046adcbc?hp=0a9f8f95112ff40e13406b3e5aab49c01487f045>

- Log -----------------------------------------------------------------
commit e0280e4921cf0b53edc3e4790ff6f201046adcbc
Author: Karl Williamson <k...@cpan.org>
Date:   Fri Feb 9 10:10:47 2018 -0700

    APItest: Fix C++ compiles
    
    0a9f8f95112ff40e13406b3e5aab49c01487f045 introduced failures on C++
    compilations.  This is a better patch, suggested by ilmari.
    
    The issue was in cases where the pointer size is 32 bits and the word
    size was 64, a (STRLEN) -1 returned as an error was getting turned into
    0xFFFFFFFF instead of -1.

-----------------------------------------------------------------------

Summary of changes:
 ext/XS-APItest/APItest.xs | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/ext/XS-APItest/APItest.xs b/ext/XS-APItest/APItest.xs
index 842b6281f6..794ab403bb 100644
--- a/ext/XS-APItest/APItest.xs
+++ b/ext/XS-APItest/APItest.xs
@@ -1380,18 +1380,22 @@ bytes_cmp_utf8(bytes, utf8)
        RETVAL
 
 AV *
-test_utf8_to_bytes(bytes, lenp)
+test_utf8_to_bytes(bytes, len)
         unsigned char * bytes
-        ssize_t lenp
+        STRLEN len
     PREINIT:
         char * ret;
     CODE:
         RETVAL = newAV();
         sv_2mortal((SV*)RETVAL);
 
-        ret = (char *) utf8_to_bytes(bytes, &lenp);
+        ret = (char *) utf8_to_bytes(bytes, &len);
         av_push(RETVAL, newSVpv(ret, 0));
-        av_push(RETVAL, newSViv(lenp));
+
+        /* utf8_to_bytes uses (STRLEN)-1 to signal errors, and we want to
+         * return that as -1 to perl, so cast to SSize_t in case
+         * sizeof(IV) > sizeof(STRLEN) */
+        av_push(RETVAL, newSViv((SSize_t)len));
         av_push(RETVAL, newSVpv((const char *) bytes, 0));
 
     OUTPUT:

-- 
Perl5 Master Repository

Reply via email to