use SvPVbyte() where appropriate for i_io_*write()
authorTony Cook <tony@develop-help.com>
Mon, 8 Apr 2013 12:50:26 +0000 (22:50 +1000)
committerTony Cook <tony@develop-help.com>
Mon, 8 Apr 2013 12:50:26 +0000 (22:50 +1000)
Imager.xs
t/t07iolayer.t

index e5c44a2..f0b6c4d 100644 (file)
--- a/Imager.xs
+++ b/Imager.xs
@@ -1198,14 +1198,7 @@ i_io_raw_write(ig, data_sv)
         void *data;
        STRLEN size;
       CODE:
-#ifdef SvUTF8
-        if (SvUTF8(data_sv)) {
-         data_sv = sv_2mortal(newSVsv(data_sv));
-          /* yes, we want this to croak() if the SV can't be downgraded */
-         sv_utf8_downgrade(data_sv, FALSE);
-       }
-#endif        
-       data = SvPV(data_sv, size);
+       data = SvPVbyte(data_sv, size);
         RETVAL = i_io_raw_write(ig, data, size);
       OUTPUT:
        RETVAL
@@ -1430,14 +1423,7 @@ i_io_write(ig, data_sv)
         void *data;
        STRLEN size;
       CODE:
-#ifdef SvUTF8
-        if (SvUTF8(data_sv)) {
-         data_sv = sv_2mortal(newSVsv(data_sv));
-          /* yes, we want this to croak() if the SV can't be downgraded */
-         sv_utf8_downgrade(data_sv, FALSE);
-       }
-#endif        
-       data = SvPV(data_sv, size);
+       data = SvPVbyte(data_sv, size);
         RETVAL = i_io_write(ig, data, size);
       OUTPUT:
        RETVAL
index f80ed89..76388a9 100644 (file)
@@ -229,8 +229,9 @@ SKIP:
   my $result = 
     eval {
       $io->raw_write($data);
+      1;
     };
-  ok($@, "should have croaked")
+  ok(!$result, "should have croaked")
     and print "# $@\n";
 }