Replaced some assert macros with SDL_assert.
authorRyan C. Gordon <icculus@icculus.org>
Tue, 07 Feb 2012 02:11:15 -0500
changeset 6281e46d6f4b469e
parent 6280 2c2ebbcb1980
child 6282 64ae376becce
Replaced some assert macros with SDL_assert.
src/audio/SDL_audiocvt.c
src/audio/coreaudio/SDL_coreaudio.c
src/stdlib/SDL_qsort.c
src/video/SDL_blit_A.c
src/video/SDL_blit_N.c
src/video/cocoa/SDL_cocoashape.m
src/video/x11/SDL_x11opengl.c
     1.1 --- a/src/audio/SDL_audiocvt.c	Tue Feb 07 01:26:00 2012 -0500
     1.2 +++ b/src/audio/SDL_audiocvt.c	Tue Feb 07 02:11:15 2012 -0500
     1.3 @@ -25,13 +25,10 @@
     1.4  #include "SDL_audio.h"
     1.5  #include "SDL_audio_c.h"
     1.6  
     1.7 +#include "SDL_assert.h"
     1.8 +
     1.9  /* #define DEBUG_CONVERT */
    1.10  
    1.11 -/* !!! FIXME */
    1.12 -#ifndef assert
    1.13 -#define assert(x)
    1.14 -#endif
    1.15 -
    1.16  /* Effectively mix right and left channels into a single channel */
    1.17  static void SDLCALL
    1.18  SDL_ConvertMono(SDL_AudioCVT * cvt, SDL_AudioFormat format)
    1.19 @@ -881,9 +878,9 @@
    1.20      int lo, hi;
    1.21      int div;
    1.22  
    1.23 -    assert(src_rate != 0);
    1.24 -    assert(dst_rate != 0);
    1.25 -    assert(src_rate != dst_rate);
    1.26 +    SDL_assert(src_rate != 0);
    1.27 +    SDL_assert(dst_rate != 0);
    1.28 +    SDL_assert(src_rate != dst_rate);
    1.29  
    1.30      if (src_rate < dst_rate) {
    1.31          lo = src_rate;
     2.1 --- a/src/audio/coreaudio/SDL_coreaudio.c	Tue Feb 07 01:26:00 2012 -0500
     2.2 +++ b/src/audio/coreaudio/SDL_coreaudio.c	Tue Feb 07 02:11:15 2012 -0500
     2.3 @@ -23,6 +23,7 @@
     2.4  #include "../SDL_audio_c.h"
     2.5  #include "../SDL_sysaudio.h"
     2.6  #include "SDL_coreaudio.h"
     2.7 +#include "SDL_assert.h"
     2.8  
     2.9  #define DEBUG_COREAUDIO 0
    2.10  
    2.11 @@ -268,8 +269,8 @@
    2.12         any input format in OpenAudio, and leave the conversion to CoreAudio.
    2.13       */
    2.14      /*
    2.15 -       assert(!this->convert.needed);
    2.16 -       assert(this->spec.channels == ioData->mNumberChannels);
    2.17 +       SDL_assert(!this->convert.needed);
    2.18 +       SDL_assert(this->spec.channels == ioData->mNumberChannels);
    2.19       */
    2.20  
    2.21      for (i = 0; i < ioData->mNumberBuffers; i++) {
     3.1 --- a/src/stdlib/SDL_qsort.c	Tue Feb 07 01:26:00 2012 -0500
     3.2 +++ b/src/stdlib/SDL_qsort.c	Tue Feb 07 02:11:15 2012 -0500
     3.3 @@ -49,11 +49,12 @@
     3.4  #include <string.h>
     3.5  */
     3.6  #include "SDL_stdinc.h"
     3.7 +#include "SDL_assert.h"
     3.8  
     3.9  #ifdef assert
    3.10  #undef assert
    3.11  #endif
    3.12 -#define assert(X)
    3.13 +#define assert(X) SDL_assert(X)
    3.14  #ifdef malloc
    3.15  #undef malloc
    3.16  #endif
     4.1 --- a/src/video/SDL_blit_A.c	Tue Feb 07 01:26:00 2012 -0500
     4.2 +++ b/src/video/SDL_blit_A.c	Tue Feb 07 02:11:15 2012 -0500
     4.3 @@ -424,7 +424,6 @@
     4.4  #if HAVE_ALTIVEC_H
     4.5  #include <altivec.h>
     4.6  #endif
     4.7 -#include <assert.h>
     4.8  
     4.9  #if (defined(__MACOSX__) && (__GNUC__ < 4))
    4.10  #define VECUINT8_LITERAL(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p) \
     5.1 --- a/src/video/SDL_blit_N.c	Tue Feb 07 01:26:00 2012 -0500
     5.2 +++ b/src/video/SDL_blit_N.c	Tue Feb 07 02:11:15 2012 -0500
     5.3 @@ -25,13 +25,14 @@
     5.4  #include "SDL_cpuinfo.h"
     5.5  #include "SDL_blit.h"
     5.6  
     5.7 +#include "SDL_assert.h"
     5.8 +
     5.9  /* Functions to blit from N-bit surfaces to other surfaces */
    5.10  
    5.11  #if SDL_ALTIVEC_BLITTERS
    5.12  #ifdef HAVE_ALTIVEC_H
    5.13  #include <altivec.h>
    5.14  #endif
    5.15 -#define assert(X)
    5.16  #ifdef __MACOSX__
    5.17  #include <sys/sysctl.h>
    5.18  static size_t
    5.19 @@ -243,7 +244,7 @@
    5.20              vsrc = voverflow;
    5.21          }
    5.22  
    5.23 -        assert(width == 0);
    5.24 +        SDL_assert(width == 0);
    5.25  
    5.26          /* do scalar until we can align... */
    5.27          ONE_PIXEL_BLEND((extrawidth), extrawidth);
    5.28 @@ -312,9 +313,8 @@
    5.29           char) (vec_add((vector unsigned int) vgreen1, vec_sl(v8, v8))
    5.30          );
    5.31  
    5.32 -
    5.33 -    assert(srcfmt->BytesPerPixel == 2);
    5.34 -    assert(dstfmt->BytesPerPixel == 4);
    5.35 +    SDL_assert(srcfmt->BytesPerPixel == 2);
    5.36 +    SDL_assert(dstfmt->BytesPerPixel == 4);
    5.37  
    5.38      vf800 = (vector unsigned short) vec_splat_u8(-7);
    5.39      vf800 = vec_sl(vf800, vec_splat_u16(8));
    5.40 @@ -390,7 +390,7 @@
    5.41              vsrc = voverflow;
    5.42          }
    5.43  
    5.44 -        assert(width == 0);
    5.45 +        SDL_assert(width == 0);
    5.46  
    5.47  
    5.48          /* do scalar until we can align... */
    5.49 @@ -460,9 +460,8 @@
    5.50           char) (vec_add((vector unsigned int) vgreen1, vec_sl(v8, v8))
    5.51          );
    5.52  
    5.53 -
    5.54 -    assert(srcfmt->BytesPerPixel == 2);
    5.55 -    assert(dstfmt->BytesPerPixel == 4);
    5.56 +    SDL_assert(srcfmt->BytesPerPixel == 2);
    5.57 +    SDL_assert(dstfmt->BytesPerPixel == 4);
    5.58  
    5.59      vf800 = (vector unsigned short) vec_splat_u8(-7);
    5.60      vf800 = vec_sl(vf800, vec_splat_u16(8));
    5.61 @@ -538,7 +537,7 @@
    5.62              vsrc = voverflow;
    5.63          }
    5.64  
    5.65 -        assert(width == 0);
    5.66 +        SDL_assert(width == 0);
    5.67  
    5.68  
    5.69          /* do scalar until we can align... */
    5.70 @@ -630,13 +629,13 @@
    5.71          }
    5.72          int width = info->dst_w;
    5.73          ONE_PIXEL_BLEND((UNALIGNED_PTR(dstp)) && (width), width);
    5.74 -        assert(width > 0);
    5.75 +        SDL_assert(width > 0);
    5.76          if (width > 0) {
    5.77              int extrawidth = (width % 4);
    5.78              vector unsigned char valigner = VEC_ALIGNER(srcp);
    5.79              vector unsigned int vs = vec_ld(0, srcp);
    5.80              width -= extrawidth;
    5.81 -            assert(width >= 4);
    5.82 +            SDL_assert(width >= 4);
    5.83              while (width) {
    5.84                  vector unsigned char vsel;
    5.85                  vector unsigned int vd;
    5.86 @@ -691,8 +690,8 @@
    5.87          }
    5.88      }
    5.89  
    5.90 -    assert(srcfmt->BytesPerPixel == 4);
    5.91 -    assert(dstfmt->BytesPerPixel == 4);
    5.92 +    SDL_assert(srcfmt->BytesPerPixel == 4);
    5.93 +    SDL_assert(dstfmt->BytesPerPixel == 4);
    5.94  
    5.95      while (height--) {
    5.96          vector unsigned char valigner;
    5.97 @@ -729,7 +728,7 @@
    5.98              vbits = voverflow;
    5.99          }
   5.100  
   5.101 -        assert(width == 0);
   5.102 +        SDL_assert(width == 0);
   5.103  
   5.104          /* cover pixels at the end of the row that didn't fit in 16 bytes. */
   5.105          while (extrawidth) {
   5.106 @@ -770,8 +769,8 @@
   5.107          }
   5.108      }
   5.109  
   5.110 -    assert(srcfmt->BytesPerPixel == 4);
   5.111 -    assert(dstfmt->BytesPerPixel == 4);
   5.112 +    SDL_assert(srcfmt->BytesPerPixel == 4);
   5.113 +    SDL_assert(dstfmt->BytesPerPixel == 4);
   5.114  
   5.115      while (height--) {
   5.116          vector unsigned char valigner;
   5.117 @@ -816,7 +815,7 @@
   5.118              vbits = voverflow;
   5.119          }
   5.120  
   5.121 -        assert(width == 0);
   5.122 +        SDL_assert(width == 0);
   5.123  
   5.124          /* cover pixels at the end of the row that didn't fit in 16 bytes. */
   5.125          while (extrawidth) {
     6.1 --- a/src/video/cocoa/SDL_cocoashape.m	Tue Feb 07 01:26:00 2012 -0500
     6.2 +++ b/src/video/cocoa/SDL_cocoashape.m	Tue Feb 07 02:11:15 2012 -0500
     6.3 @@ -27,6 +27,7 @@
     6.4  #include "SDL_shape.h"
     6.5  #include "SDL_cocoashape.h"
     6.6  #include "../SDL_sysvideo.h"
     6.7 +#include "SDL_assert.h"
     6.8  
     6.9  SDL_WindowShaper*
    6.10  Cocoa_CreateShaper(SDL_Window* window) {
    6.11 @@ -49,7 +50,7 @@
    6.12      data->shape = NULL;
    6.13      
    6.14      int resized_properly = Cocoa_ResizeWindowShape(window);
    6.15 -    assert(resized_properly == 0);
    6.16 +    SDL_assert(resized_properly == 0);
    6.17      return result;
    6.18  }
    6.19  
    6.20 @@ -100,7 +101,7 @@
    6.21  int
    6.22  Cocoa_ResizeWindowShape(SDL_Window *window) {
    6.23      SDL_ShapeData* data = window->shaper->driverdata;
    6.24 -    assert(data != NULL);
    6.25 +    SDL_assert(data != NULL);
    6.26      return 0;
    6.27  }
    6.28  
     7.1 --- a/src/video/x11/SDL_x11opengl.c	Tue Feb 07 01:26:00 2012 -0500
     7.2 +++ b/src/video/x11/SDL_x11opengl.c	Tue Feb 07 02:11:15 2012 -0500
     7.3 @@ -311,7 +311,7 @@
     7.4      int i = 0;
     7.5  
     7.6      /* assert buffer is large enough to hold all SDL attributes. */ 
     7.7 -    /* assert(size >= 32);*/
     7.8 +    SDL_assert(size >= 32);
     7.9  
    7.10      /* Setup our GLX attributes according to the gl_config. */
    7.11      attribs[i++] = GLX_RGBA;