Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fix typemap to return undef if the return is null... this solves two …

…failing tests... only three left
  • Loading branch information...
commit 7f651c792468c479c8ece2dc99e7d929f4f2fdc7 1 parent 0169548
Daniel Ruoso ruoso authored
Showing with 10 additions and 7 deletions.
  1. +1 −1  src/Core/objects/PixelFormat.xs
  2. +1 −1  t/core_palette.t
  3. +8 −5 typemap
2  src/Core/objects/PixelFormat.xs
View
@@ -33,7 +33,7 @@ pixelformat_palette( pixelformat )
PREINIT:
char* CLASS = "SDL::Palette";
CODE:
- RETVAL = pixelformat->palette;
+ RETVAL = pixelformat->palette;
OUTPUT:
RETVAL
2  t/core_palette.t
View
@@ -27,7 +27,7 @@ my $display = SDL::Video::set_video_mode(640,480,32, SDL_SWSURFACE );
isa_ok($display->format, 'SDL::PixelFormat', 'Are we a SDL::PixelFormat?');
-is( !defined $display->format->palette , 1, 'Palette is not defined as BitPerPixels is greater then 8');
+ok( ! defined $display->format->palette , 'Palette is not defined as BitPerPixels is greater then 8');
my $disp = SDL::Video::set_video_mode(640,480,8, SDL_SWSURFACE );
13 typemap
View
@@ -102,11 +102,14 @@ OUTPUT
# The Perl object is blessed into 'CLASS', which should be a
# char* having the name of the package for the blessing.
O_OBJECT
- void** pointers = malloc(2 * sizeof(void*));
- pointers[0] = (void*)$var;
- pointers[1] = (void*)my_perl;
- sv_setref_pv( $arg, CLASS, (void*)pointers );
-
+ if ($var) {
+ void** pointers = malloc(2 * sizeof(void*));
+ pointers[0] = (void*)$var;
+ pointers[1] = (void*)my_perl;
+ sv_setref_pv( $arg, CLASS, (void*)pointers );
+ } else {
+ XSRETURN_UNDEF;
+ }
INPUT
Please sign in to comment.
Something went wrong with that request. Please try again.