]> granicus.if.org Git - vim/commitdiff
patch 8.1.0978: blob not tested with Perl v8.1.0978
authorBram Moolenaar <Bram@vim.org>
Sat, 23 Feb 2019 14:04:17 +0000 (15:04 +0100)
committerBram Moolenaar <Bram@vim.org>
Sat, 23 Feb 2019 14:04:17 +0000 (15:04 +0100)
Problem:    Blob not tested with Perl.
Solution:   Add more test coverage.  Fixes a crash. (Dominique Pelle,
            closes #4037)

src/if_perl.xs
src/testdir/test_perl.vim
src/version.c

index 2655640755ab9267d5a020a767555d2e3957a37c..099d38677628745f741d6cd96b301878fb402211 100644 (file)
@@ -1570,7 +1570,7 @@ Blob(SV* sv)
     newsv = newSVpv("0z", 2);
     for (i = 0; i < len; i++)
     {
-       sprintf(buf, "%02X", s[i]);
+       sprintf(buf, "%02X", (unsigned char)(s[i]));
        sv_catpvn(newsv, buf, 2);
     }
     RETVAL = newsv;
index 03c5fa0d108b1331e865583e507a775ff9f2dd19..e24c04f7cef0409a4ae18e28f23e3c12136bc899 100644 (file)
@@ -29,6 +29,13 @@ EOF
   call assert_equal('abc/def/', getline('$'))
 endfunc
 
+funct Test_VIM_Blob()
+  call assert_equal('0z',         perleval('VIM::Blob("")'))
+  call assert_equal('0z31326162', perleval('VIM::Blob("12ab")'))
+  call assert_equal('0z00010203', perleval('VIM::Blob("\x00\x01\x02\x03")'))
+  call assert_equal('0z8081FEFF', perleval('VIM::Blob("\x80\x81\xfe\xff")'))
+endfunc
+
 func Test_buffer_Delete()
   new
   call setline(1, ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'])
index 8d22ca90e692caf977c311d43ae741519a8c4c4f..850c27dcd4b31bf32e40ecec8bd22a7fb3446733 100644 (file)
@@ -779,6 +779,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    978,
 /**/
     977,
 /**/