Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

code cleanup and changed some croaks to warn() because we dont wanna …

…die here (Validate.h)
  • Loading branch information...
commit a45e9359cffbf4f815cc955b24073afd3c12ca43 1 parent 805903f
@FROGGS FROGGS authored
View
268 src/SDLx/Surface.xs
@@ -18,181 +18,149 @@
SV * get_pixel32 (SDL_Surface *surface, int x, int y)
{
-
- /*Convert the pixels to 32 bit */
- Uint32 *pixels = (Uint32 *)surface->pixels;
- /*Get the requested pixel */
-
- void* s = pixels + _calc_offset(surface, x, y);
+ /* Convert the pixels to 32 bit */
+ Uint32 *pixels = (Uint32 *)surface->pixels;
+ /* Get the requested pixel */
- /*printf( " Pixel = %d, Ptr = %p \n", *((int*) s), s ); */
+ void* s = pixels + _calc_offset(surface, x, y);
- SV* sv = newSV_type(SVt_PV);
- SvPV_set(sv, s);
- SvPOK_on(sv);
- SvLEN_set(sv, 0);
- SvCUR_set(sv, surface->format->BytesPerPixel);
- return newRV_noinc(sv); /*make a modifiable reference using u_ptr's place as the memory :) */
+ /* printf( " Pixel = %d, Ptr = %p \n", *((int*) s), s ); */
+ SV* sv = newSV_type(SVt_PV);
+ SvPV_set(sv, s);
+ SvPOK_on(sv);
+ SvLEN_set(sv, 0);
+ SvCUR_set(sv, surface->format->BytesPerPixel);
+ return newRV_noinc(sv); /* make a modifiable reference using u_ptr's place as the memory :) */
}
-
SV * construct_p_matrix ( SDL_Surface *surface )
{
- /*return get_pixel32( surface, 0, 0); */
+ /* return get_pixel32( surface, 0, 0); */
AV * matrix = newAV();
- int i, j;
- i = 0;
- for( i =0 ; i < surface->w; i++)
- {
- AV * matrix_row = newAV();
- for( j =0 ; j < surface->h; j++)
- {
- av_push(matrix_row, get_pixel32(surface, i,j) );
- }
- av_push(matrix, newRV_noinc((SV *)matrix_row) );
-
- }
-
- return newRV_noinc((SV *)matrix);
+ int i, j;
+ i = 0;
+ for( i =0 ; i < surface->w; i++ )
+ {
+ AV * matrix_row = newAV();
+ for( j =0 ; j < surface->h; j++ )
+ av_push( matrix_row, get_pixel32(surface, i,j) );
+
+ av_push( matrix, newRV_noinc((SV *)matrix_row) );
+ }
+
+ return newRV_noinc((SV *)matrix);
}
-
int _calc_offset ( SDL_Surface* surface, int x, int y )
-{
- int offset;
- offset = (surface->pitch * y)/surface->format->BytesPerPixel;
- offset += x;
- return offset;
+{
+ int offset;
+ offset = (surface->pitch * y) / surface->format->BytesPerPixel;
+ offset += x;
+ return offset;
}
-
unsigned int _get_pixel(SDL_Surface * surface, int offset)
{
-
- unsigned int value;
- switch(surface->format->BytesPerPixel)
- {
- case 1: value = ((Uint8 *)surface->pixels)[offset];
- break;
- case 2: value = ((Uint16 *)surface->pixels)[offset];
- break;
- case 3: value = ((Uint32)((Uint8 *)surface->pixels)[offset * surface->format->BytesPerPixel] << 0)
- + ((Uint32)((Uint8 *)surface->pixels)[offset * surface->format->BytesPerPixel + 1] << 8)
- + ((Uint32)((Uint8 *)surface->pixels)[offset * surface->format->BytesPerPixel + 2] << 16);
- break;
- case 4: value = ((Uint32 *)surface->pixels)[offset];
- break;
-
- }
- return value;
+ unsigned int value;
+ switch(surface->format->BytesPerPixel)
+ {
+ case 1: value = ((Uint8 *)surface->pixels)[offset];
+ break;
+ case 2: value = ((Uint16 *)surface->pixels)[offset];
+ break;
+ case 3: value = ((Uint32)((Uint8 *)surface->pixels)[offset * surface->format->BytesPerPixel] << 0)
+ + ((Uint32)((Uint8 *)surface->pixels)[offset * surface->format->BytesPerPixel + 1] << 8)
+ + ((Uint32)((Uint8 *)surface->pixels)[offset * surface->format->BytesPerPixel + 2] << 16);
+ break;
+ case 4: value = ((Uint32 *)surface->pixels)[offset];
+ break;
+ }
+ return value;
}
-
MODULE = SDLx::Surface PACKAGE = SDLx::Surface PREFIX = surfacex_
SV *
surfacex_pixel_array ( surface )
- SDL_Surface *surface
- CODE:
- switch(surface->format->BytesPerPixel)
- {
- case 1: croak("Not implemented yet for 8bpp surfaces\n");
- break;
- case 2: croak("Not implemented yet for 16bpp surfaces\n");
- break;
- case 3: croak("Not implemented yet for 24bpp surfaces\n");
- break;
- case 4:
- RETVAL = construct_p_matrix (surface);
- break;
-
- }
-
-
- OUTPUT:
- RETVAL
+ SDL_Surface *surface
+ CODE:
+ switch(surface->format->BytesPerPixel)
+ {
+ case 1: croak("Not implemented yet for 8bpp surfaces\n");
+ break;
+ case 2: croak("Not implemented yet for 16bpp surfaces\n");
+ break;
+ case 3: croak("Not implemented yet for 24bpp surfaces\n");
+ break;
+ case 4:
+ RETVAL = construct_p_matrix (surface);
+ break;
+ }
+ OUTPUT:
+ RETVAL
unsigned int
surfacex_get_pixel_xs ( surface, x, y )
- SDL_Surface *surface
- int x
- int y
- CODE:
- if( x < 0 )
- x = 0;
- else if ( x > surface->w)
- x = surface->w;
-
- if ( y < 0 )
- y = 0;
- else if ( y > surface->h)
- y = surface->h;
-
- int offset;
- offset = _calc_offset( surface, x, y);
- RETVAL = _get_pixel( surface, offset );
-
- OUTPUT:
- RETVAL
+ SDL_Surface *surface
+ int x
+ int y
+ CODE:
+ _int_range( &x, 0, surface->w );
+ _int_range( &y, 0, surface->h );
+ int offset;
+ offset = _calc_offset( surface, x, y);
+ RETVAL = _get_pixel( surface, offset );
+ OUTPUT:
+ RETVAL
void
surfacex_set_pixel_xs ( surface, x, y, value )
- SDL_Surface *surface
- int x
- int y
- unsigned int value
- CODE:
- if( x < 0 )
- x = 0;
- else if ( x > surface->w)
- x = surface->w;
-
- if ( y < 0 )
- y = 0;
- else if ( y > surface->h)
- y = surface->h;
-
- int offset;
- offset = _calc_offset( surface, x, y);
- if(SDL_MUSTLOCK(surface))
- if ( SDL_LockSurface(surface) < 0)
- croak( "Locking surface in set_pixels failed: %s", SDL_GetError() );
- switch(surface->format->BytesPerPixel)
- {
- case 1: ((Uint8 *)surface->pixels)[offset] = (Uint8)value;
- break;
- case 2: ((Uint16 *)surface->pixels)[offset] = (Uint16)value;
- break;
- case 3: ((Uint8 *)surface->pixels)[offset * surface->format->BytesPerPixel] = (Uint8)( value & 0xFF);
- ((Uint8 *)surface->pixels)[offset * surface->format->BytesPerPixel + 1] = (Uint8)((value << 8) & 0xFF);
- ((Uint8 *)surface->pixels)[offset * surface->format->BytesPerPixel + 2] = (Uint8)((value << 16) & 0xFF);
- break;
- case 4: ((Uint32 *)surface->pixels)[offset] = (Uint32)value;
- break;
- }
- if(SDL_MUSTLOCK(surface))
- SDL_UnlockSurface(surface);
-
+ SDL_Surface *surface
+ int x
+ int y
+ unsigned int value
+ CODE:
+ _int_range( &x, 0, surface->w );
+ _int_range( &y, 0, surface->h );
+ int offset;
+ offset = _calc_offset( surface, x, y);
+ if(SDL_MUSTLOCK(surface) && SDL_LockSurface(surface) < 0)
+ croak( "Locking surface in set_pixels failed: %s", SDL_GetError() );
+ switch(surface->format->BytesPerPixel)
+ {
+ case 1: ((Uint8 *)surface->pixels)[offset] = (Uint8)value;
+ break;
+ case 2: ((Uint16 *)surface->pixels)[offset] = (Uint16)value;
+ break;
+ case 3: ((Uint8 *)surface->pixels)[offset * surface->format->BytesPerPixel] = (Uint8)( value & 0xFF);
+ ((Uint8 *)surface->pixels)[offset * surface->format->BytesPerPixel + 1] = (Uint8)((value << 8) & 0xFF);
+ ((Uint8 *)surface->pixels)[offset * surface->format->BytesPerPixel + 2] = (Uint8)((value << 16) & 0xFF);
+ break;
+ case 4: ((Uint32 *)surface->pixels)[offset] = (Uint32)value;
+ break;
+ }
+ if(SDL_MUSTLOCK(surface))
+ SDL_UnlockSurface(surface);
void
surfacex_draw_rect ( surface, rt, color )
- SDL_Surface *surface
- SV* rt
- SV* color
- CODE:
- Uint32 m_color = __map_rgba( color, surface->format );
- SDL_Rect r_rect;
+ SDL_Surface *surface
+ SV* rt
+ SV* color
+ CODE:
+ Uint32 m_color = __map_rgba( color, surface->format );
+ SDL_Rect r_rect;
- if( SvOK(rt) )
- r_rect = *(SDL_Rect*)bag2obj( create_mortal_rect( rt ) );
- else
- {
- r_rect.x = 0; r_rect.y = 0; r_rect.w = surface->w; r_rect.h = surface->h;
- }
- SDL_FillRect(surface, &r_rect, m_color);
+ if( SvOK(rt) )
+ r_rect = *(SDL_Rect*)bag2obj( create_mortal_rect( rt ) );
+ else
+ {
+ r_rect.x = 0; r_rect.y = 0; r_rect.w = surface->w; r_rect.h = surface->h;
+ }
+ SDL_FillRect(surface, &r_rect, m_color);
#ifdef HAVE_SDL_GFX_PRIMITIVES
@@ -203,17 +171,16 @@ surfacex_draw_polygon ( surface, vectors, color, ... )
Uint32 color
CODE:
SDL_Surface * _surface = (SDL_Surface *)bag2obj(surface);
- AV* vx = newAV();
- AV* vy = newAV();
+ AV* vx = newAV();
+ AV* vy = newAV();
AV* vertex;
- while (vertex = (AV*)SvRV(av_shift(vectors)))
+ while(vertex = (AV*)SvRV(av_shift(vectors)))
{
av_push(vx, av_shift(vertex));
av_push(vy, av_shift(vertex));
}
- int n = av_len(vx) + 1;
-
+ int n = av_len(vx) + 1;
Sint16 * _vx = av_to_sint16(vx);
Sint16 * _vy = av_to_sint16(vy);
if ( items > 3 && SvTRUE( ST(3) ) )
@@ -222,7 +189,7 @@ surfacex_draw_polygon ( surface, vectors, color, ... )
polygonColor( _surface, _vx, _vy, n, color );
_svinta_free( _vx, av_len(vx) );
_svinta_free( _vy, av_len(vy) );
- RETVAL = SvREFCNT_inc(surface);
+ RETVAL = SvREFCNT_inc(surface); // why SvREFCNT_inc?
OUTPUT:
RETVAL
@@ -235,13 +202,12 @@ surfacex_blit( src, dest, ... )
CODE:
assert_surface(src);
assert_surface(dest);
- /* just return the pointer stored in the bag */
+ /* just return the pointer stored in the bag */
SDL_Surface *_src = (SDL_Surface *)bag2obj(src);
SDL_Surface *_dest = (SDL_Surface *)bag2obj(dest);
SDL_Rect _src_rect;
SDL_Rect _dest_rect;
- int newly_created_rect = 0;
if( items > 2 && SvOK(ST(2)) )
_src_rect = *(SDL_Rect *)bag2obj( create_mortal_rect( ST(2) ) );
@@ -264,5 +230,3 @@ surfacex_blit( src, dest, ... )
}
SDL_BlitSurface( _src, &_src_rect, _dest, &_dest_rect );
-
-
View
91 src/SDLx/Validate.h
@@ -6,62 +6,54 @@
SV *create_mortal_rect( SV *rect )
{
SV *retval = NULL;
- /*we hand this over to perl to handle */
if( !SvOK(rect) )
{
- /* create a new zero sized rectangle */
+ /* create a new zero sized rectangle */
SDL_Rect* r = safemalloc( sizeof(SDL_Rect) );
r->x = 0;
r->y = 0;
r->w = 0;
r->h = 0;
retval = obj2bag( sizeof( SDL_Rect *), (void *)(r), "SDL::Rect" );
- sv_2mortal(retval) ;
+ sv_2mortal(retval) ;
}
else if( sv_derived_from(rect, "ARRAY") )
{
- /* create a new rectangle from the array */
- SDL_Rect* r = safemalloc( sizeof(SDL_Rect) );
- int ra[4];
- int i = 0;
+ /* create a new rectangle from the array */
+ SDL_Rect* r = safemalloc( sizeof(SDL_Rect) );
AV* recta = (AV*)SvRV(rect);
int len = av_len(recta);
+ int i;
+ int ra[4];
for(i = 0; i < 4; i++)
{
SV* iv = i > len ? NULL : AvARRAY(recta)[i];
- if( iv == NULL || !SvOK( iv ) || iv == &PL_sv_undef )
- ra[i] = 0;
- else
- ra[i] = SvIV( iv );
+ ra[i] = ( iv == NULL || !SvOK( iv ) || iv == &PL_sv_undef )
+ ? 0
+ : SvIV( iv );
}
r->x = ra[0]; r->y = ra[1]; r->w = ra[2]; r->h= ra[3];
retval = obj2bag( sizeof( SDL_Rect *), (void *)(r), "SDL::Rect" );
- sv_2mortal(retval) ;
+ sv_2mortal(retval) ;
}
else if( sv_isobject(rect) && sv_derived_from(rect, "SDL::Rect") )
{
- /* we already had a good mortal rect . Just pass it along */
+ /* we already had a good mortal rect . Just pass it along */
retval = rect;
- // no need to inc REFCNT since we dont make the SV mortal twice
- //SvREFCNT_inc(rect);
}
else
croak("Rect must be number or arrayref or SDL::Rect or undef");
- //SvREFCNT_inc(rect);
return retval;
}
void assert_surface( SV *surface )
{
if( sv_isobject(surface) && sv_derived_from(surface, "SDL::Surface"))
- {
- /* memory leak detected by Test::LeakTrace */
- /* SvREFCNT_inc(surface); */
- return ;
- }
+ return;
+
croak("Surface must be SDL::Surface or SDLx::Surface");
/* does not return */
}
@@ -90,19 +82,21 @@ SV *_color_number( SV *color, SV *alpha )
if( !SvOK(color) || color < 0 )
{
if( color < 0 )
- croak("Color was a negative number");
- retval = a == 1 ? 0x000000FF : 0;
+ warn("Color was a negative number");
+ retval = a == 1
+ ? 0x000000FF
+ : 0;
}
else
{
if( a == 1 && (c > 0xFFFFFFFF) )
{
- croak("Color was number greater than maximum expected: 0xFFFFFFFF");
+ warn("Color was number greater than maximum expected: 0xFFFFFFFF");
retval = 0xFFFFFFFF;
}
else if ( a != 1 && ( c > 0xFFFFFF) )
{
- croak("Color was number greater than maximum expected: 0xFFFFFF");
+ warn("Color was number greater than maximum expected: 0xFFFFFF");
retval = 0xFFFFFF;
}
}
@@ -125,12 +119,12 @@ AV *_color_arrayref( AV *color, SV *alpha )
int c = SvIV(AvARRAY(color)[i]);
if( c > 0xFF )
{
- croak("Number in color arrayref was greater than maximum expected: 0xFF");
+ warn("Number in color arrayref was greater than maximum expected: 0xFF");
av_push(retval, newSVuv(0xFF));
}
else if( c < 0 )
{
- croak("Number in color arrayref was negative");
+ warn("Number in color arrayref was negative");
av_push(retval, newSVuv(0));
}
else
@@ -141,7 +135,6 @@ AV *_color_arrayref( AV *color, SV *alpha )
return retval;
}
-
/* returns a mortal AV* */
AV* __list_rgb( SV* color )
{
@@ -149,7 +142,7 @@ AV* __list_rgb( SV* color )
AV* RETVAL ;
if ( 0 == strcmp("number", format) )
{
- RETVAL = (AV*)sv_2mortal( (SV *) newAV() );
+ RETVAL = (AV*)sv_2mortal( (SV *) newAV() );
unsigned int _color = SvUV(sv_2mortal(_color_number(color, newSVuv(0))));
av_push(RETVAL, newSVuv(_color >> 16 & 0xFF));
av_push(RETVAL, newSVuv(_color >> 8 & 0xFF));
@@ -157,12 +150,12 @@ AV* __list_rgb( SV* color )
}
else if ( 0 == strcmp("arrayref", format) )
{
- /* _color_arrayref returns a mortal AV* */
+ /* _color_arrayref returns a mortal AV* */
RETVAL = _color_arrayref((AV *)SvRV(color), sv_2mortal(newSVuv(0)));
}
else if ( 0 == strcmp("SDL::Color", format) )
{
- RETVAL = (AV*)sv_2mortal((SV *) newAV() );
+ RETVAL = (AV*)sv_2mortal((SV *) newAV() );
SDL_Color *_color = (SDL_Color *)bag2obj(color);
av_push(RETVAL, newSVuv(_color->r));
av_push(RETVAL, newSVuv(_color->g));
@@ -170,7 +163,7 @@ AV* __list_rgb( SV* color )
}
else
{
- RETVAL = (AV*)sv_2mortal((SV *) newAV() );
+ RETVAL = (AV*)sv_2mortal((SV *) newAV() );
av_push(RETVAL, newSVuv(0));
av_push(RETVAL, newSVuv(0));
av_push(RETVAL, newSVuv(0));
@@ -179,14 +172,13 @@ AV* __list_rgb( SV* color )
return RETVAL;
}
-
AV* __list_rgba( SV* color )
{
char *format = _color_format(color);
AV* RETVAL ;
if ( 0 == strcmp("number", format) )
{
- RETVAL = (AV*)sv_2mortal((SV *) newAV() );
+ RETVAL = (AV*)sv_2mortal((SV *) newAV() );
unsigned int _color = SvUV(sv_2mortal(_color_number(color, sv_2mortal(newSVuv(1)))));
av_push(RETVAL, newSVuv(_color >> 24 & 0xFF));
av_push(RETVAL, newSVuv(_color >> 16 & 0xFF));
@@ -199,7 +191,7 @@ AV* __list_rgba( SV* color )
}
else if ( 0 == strcmp("SDL::Color", format) )
{
- RETVAL = (AV*)sv_2mortal((SV *) newAV() );
+ RETVAL = (AV*)sv_2mortal((SV *) newAV() );
SDL_Color *_color = (SDL_Color*)bag2obj(color);
av_push(RETVAL, newSVuv(_color->r));
av_push(RETVAL, newSVuv(_color->g));
@@ -221,24 +213,23 @@ AV* __list_rgba( SV* color )
unsigned int __map_rgb( SV* color, SDL_PixelFormat* format )
{
- Uint8 r,g,b;
- AV* a = __list_rgb( color );
- r = SvUV(*av_fetch(a, 0, 0));
- g = SvUV(*av_fetch(a, 1, 0));
- b = SvUV(*av_fetch(a, 2, 0));
-
- return SDL_MapRGB( format, r, g, b );
+ Uint8 r, g, b;
+ AV* a = __list_rgb( color );
+ r = SvUV(*av_fetch(a, 0, 0));
+ g = SvUV(*av_fetch(a, 1, 0));
+ b = SvUV(*av_fetch(a, 2, 0));
+ return SDL_MapRGB( format, r, g, b );
}
unsigned int __map_rgba( SV* color, SDL_PixelFormat* format )
{
- int r,g,b,a;
- AV* ar = __list_rgba( color );
- r = SvUV(*av_fetch(ar, 0, 0));
- g = SvUV(*av_fetch(ar, 1, 0));
- b = SvUV(*av_fetch(ar, 2, 0));
- a = SvUV(*av_fetch(ar, 3, 0));
-
- return SDL_MapRGBA( format, r, g, b, a );
+ int r, g, b, a;
+ AV* ar = __list_rgba( color );
+ r = SvUV(*av_fetch(ar, 0, 0));
+ g = SvUV(*av_fetch(ar, 1, 0));
+ b = SvUV(*av_fetch(ar, 2, 0));
+ a = SvUV(*av_fetch(ar, 3, 0));
+
+ return SDL_MapRGBA( format, r, g, b, a );
}
View
23 src/SDLx/Validate.xs
@@ -51,14 +51,14 @@ val_num_rgb( color )
RETVAL = _color_number( color, sv_2mortal(newSVuv(0)) );
else if( 0 == strcmp("arrayref", format) )
{
- AV *c = _color_arrayref( (AV *)SvRV(color), sv_2mortal(newSVuv(0)) );
- unsigned int v = (( SvUV(AvARRAY(c)[0]) << 16 ) + ( SvUV(AvARRAY(c)[1]) << 8 ) + SvUV(AvARRAY(c)[2]));
- RETVAL = newSVuv(v);
+ AV *c = _color_arrayref( (AV *)SvRV(color), sv_2mortal(newSVuv(0)) );
+ unsigned int v = (( SvUV(AvARRAY(c)[0]) << 16 ) + ( SvUV(AvARRAY(c)[1]) << 8 ) + SvUV(AvARRAY(c)[2]));
+ RETVAL = newSVuv(v);
}
else if( 0 == strcmp("SDL::Color", format) )
{
SDL_Color *_color = (SDL_Color*) bag2obj( color );
- unsigned int v = ( (_color->r) << 16 ) + ( (_color->g) << 8 ) + _color->b;
+ unsigned int v = ( (_color->r) << 16 ) + ( (_color->g) << 8 ) + _color->b;
RETVAL = newSVuv( v );
}
else
@@ -72,9 +72,7 @@ val_num_rgba( color )
CODE:
char *format = _color_format( color );
if( 0 == strcmp("number", format) )
- {
RETVAL = _color_number( color, sv_2mortal(newSVuv(1)) );
- }
else if( 0 == strcmp("arrayref", format) )
{
AV *c = _color_arrayref( (AV *)SvRV(color), sv_2mortal(newSVuv(1)) );
@@ -96,7 +94,7 @@ AV *
val_list_rgb( color )
SV *color
CODE:
- RETVAL = __list_rgb( color );
+ RETVAL = __list_rgb( color );
OUTPUT:
RETVAL
@@ -120,25 +118,24 @@ val_surface( s )
SV *s
PPCODE:
assert_surface(s); /* ok or dead */
- /* ret is already mortal */
+ /* ret is already mortal */
ST(0) = s;
XSRETURN(1);
-
SV *
val_map_rgb( color, format)
SV* color
SDL_PixelFormat * format
CODE:
- RETVAL = newSVuv( __map_rgb( color, format ) );
+ RETVAL = newSVuv( __map_rgb( color, format ) );
OUTPUT:
- RETVAL
+ RETVAL
SV *
val_map_rgba( color, format)
SV* color
SDL_PixelFormat * format
CODE:
- RETVAL = newSVuv( __map_rgba( color, format ) );
+ RETVAL = newSVuv( __map_rgba( color, format ) );
OUTPUT:
- RETVAL
+ RETVAL
View
13 src/helper.h
@@ -51,7 +51,6 @@ SV *cpy2bag( void *object, int p_size, int s_size, char *package )
void objDESTROY(SV *bag, void (* callback)(void *object))
{
-
if( sv_isobject(bag) && (SvTYPE(SvRV(bag)) == SVt_PVMG) )
{
void** pointers = (void**)(SvIV((SV*)SvRV( bag )));
@@ -88,10 +87,10 @@ SV *_sv_ref( void *object, int p_size, int s_size, char *package )
void _svinta_free(Sint16* av, int len_from_av_len)
{
- if( av == NULL)
+ if( av == NULL )
return;
safefree( av ); /* we only need to free the malloc'd array. It is one block. */
- av = NULL;
+ av = NULL;
}
Sint16* av_to_sint16 (AV* av)
@@ -115,4 +114,12 @@ Sint16* av_to_sint16 (AV* av)
return NULL;
}
+void _int_range( int *val, int min, int max )
+{
+ if( *val < min )
+ *val = min;
+ else if ( *val > max )
+ *val = max;
+}
+
#endif
Please sign in to comment.
Something went wrong with that request. Please try again.