Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
Replaced some assert macros with SDL_assert.
  • Loading branch information
icculus committed Feb 7, 2012
1 parent e611f54 commit 04fc0f7
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 33 deletions.
13 changes: 5 additions & 8 deletions src/audio/SDL_audiocvt.c
Expand Up @@ -25,12 +25,9 @@
#include "SDL_audio.h"
#include "SDL_audio_c.h"

/* #define DEBUG_CONVERT */
#include "SDL_assert.h"

/* !!! FIXME */
#ifndef assert
#define assert(x)
#endif
/* #define DEBUG_CONVERT */

/* Effectively mix right and left channels into a single channel */
static void SDLCALL
Expand Down Expand Up @@ -881,9 +878,9 @@ SDL_FindFrequencyMultiple(const int src_rate, const int dst_rate)
int lo, hi;
int div;

assert(src_rate != 0);
assert(dst_rate != 0);
assert(src_rate != dst_rate);
SDL_assert(src_rate != 0);
SDL_assert(dst_rate != 0);
SDL_assert(src_rate != dst_rate);

if (src_rate < dst_rate) {
lo = src_rate;
Expand Down
5 changes: 3 additions & 2 deletions src/audio/coreaudio/SDL_coreaudio.c
Expand Up @@ -23,6 +23,7 @@
#include "../SDL_audio_c.h"
#include "../SDL_sysaudio.h"
#include "SDL_coreaudio.h"
#include "SDL_assert.h"

#define DEBUG_COREAUDIO 0

Expand Down Expand Up @@ -268,8 +269,8 @@ outputCallback(void *inRefCon,
any input format in OpenAudio, and leave the conversion to CoreAudio.
*/
/*
assert(!this->convert.needed);
assert(this->spec.channels == ioData->mNumberChannels);
SDL_assert(!this->convert.needed);
SDL_assert(this->spec.channels == ioData->mNumberChannels);
*/

for (i = 0; i < ioData->mNumberBuffers; i++) {
Expand Down
3 changes: 2 additions & 1 deletion src/stdlib/SDL_qsort.c
Expand Up @@ -49,11 +49,12 @@
#include <string.h>
*/
#include "SDL_stdinc.h"
#include "SDL_assert.h"

#ifdef assert
#undef assert
#endif
#define assert(X)
#define assert(X) SDL_assert(X)
#ifdef malloc
#undef malloc
#endif
Expand Down
1 change: 0 additions & 1 deletion src/video/SDL_blit_A.c
Expand Up @@ -424,7 +424,6 @@ BlitRGBtoRGBPixelAlphaMMX(SDL_BlitInfo * info)
#if HAVE_ALTIVEC_H
#include <altivec.h>
#endif
#include <assert.h>

#if (defined(__MACOSX__) && (__GNUC__ < 4))
#define VECUINT8_LITERAL(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p) \
Expand Down
35 changes: 17 additions & 18 deletions src/video/SDL_blit_N.c
Expand Up @@ -25,13 +25,14 @@
#include "SDL_cpuinfo.h"
#include "SDL_blit.h"

#include "SDL_assert.h"

/* Functions to blit from N-bit surfaces to other surfaces */

#if SDL_ALTIVEC_BLITTERS
#ifdef HAVE_ALTIVEC_H
#include <altivec.h>
#endif
#define assert(X)
#ifdef __MACOSX__
#include <sys/sysctl.h>
static size_t
Expand Down Expand Up @@ -243,7 +244,7 @@ Blit_RGB888_RGB565Altivec(SDL_BlitInfo * info)
vsrc = voverflow;
}

assert(width == 0);
SDL_assert(width == 0);

/* do scalar until we can align... */
ONE_PIXEL_BLEND((extrawidth), extrawidth);
Expand Down Expand Up @@ -312,9 +313,8 @@ Blit_RGB565_32Altivec(SDL_BlitInfo * info)
char) (vec_add((vector unsigned int) vgreen1, vec_sl(v8, v8))
);


assert(srcfmt->BytesPerPixel == 2);
assert(dstfmt->BytesPerPixel == 4);
SDL_assert(srcfmt->BytesPerPixel == 2);
SDL_assert(dstfmt->BytesPerPixel == 4);

vf800 = (vector unsigned short) vec_splat_u8(-7);
vf800 = vec_sl(vf800, vec_splat_u16(8));
Expand Down Expand Up @@ -390,7 +390,7 @@ Blit_RGB565_32Altivec(SDL_BlitInfo * info)
vsrc = voverflow;
}

assert(width == 0);
SDL_assert(width == 0);


/* do scalar until we can align... */
Expand Down Expand Up @@ -460,9 +460,8 @@ Blit_RGB555_32Altivec(SDL_BlitInfo * info)
char) (vec_add((vector unsigned int) vgreen1, vec_sl(v8, v8))
);


assert(srcfmt->BytesPerPixel == 2);
assert(dstfmt->BytesPerPixel == 4);
SDL_assert(srcfmt->BytesPerPixel == 2);
SDL_assert(dstfmt->BytesPerPixel == 4);

vf800 = (vector unsigned short) vec_splat_u8(-7);
vf800 = vec_sl(vf800, vec_splat_u16(8));
Expand Down Expand Up @@ -538,7 +537,7 @@ Blit_RGB555_32Altivec(SDL_BlitInfo * info)
vsrc = voverflow;
}

assert(width == 0);
SDL_assert(width == 0);


/* do scalar until we can align... */
Expand Down Expand Up @@ -630,13 +629,13 @@ Blit32to32KeyAltivec(SDL_BlitInfo * info)
}
int width = info->dst_w;
ONE_PIXEL_BLEND((UNALIGNED_PTR(dstp)) && (width), width);
assert(width > 0);
SDL_assert(width > 0);
if (width > 0) {
int extrawidth = (width % 4);
vector unsigned char valigner = VEC_ALIGNER(srcp);
vector unsigned int vs = vec_ld(0, srcp);
width -= extrawidth;
assert(width >= 4);
SDL_assert(width >= 4);
while (width) {
vector unsigned char vsel;
vector unsigned int vd;
Expand Down Expand Up @@ -691,8 +690,8 @@ ConvertAltivec32to32_noprefetch(SDL_BlitInfo * info)
}
}

assert(srcfmt->BytesPerPixel == 4);
assert(dstfmt->BytesPerPixel == 4);
SDL_assert(srcfmt->BytesPerPixel == 4);
SDL_assert(dstfmt->BytesPerPixel == 4);

while (height--) {
vector unsigned char valigner;
Expand Down Expand Up @@ -729,7 +728,7 @@ ConvertAltivec32to32_noprefetch(SDL_BlitInfo * info)
vbits = voverflow;
}

assert(width == 0);
SDL_assert(width == 0);

/* cover pixels at the end of the row that didn't fit in 16 bytes. */
while (extrawidth) {
Expand Down Expand Up @@ -770,8 +769,8 @@ ConvertAltivec32to32_prefetch(SDL_BlitInfo * info)
}
}

assert(srcfmt->BytesPerPixel == 4);
assert(dstfmt->BytesPerPixel == 4);
SDL_assert(srcfmt->BytesPerPixel == 4);
SDL_assert(dstfmt->BytesPerPixel == 4);

while (height--) {
vector unsigned char valigner;
Expand Down Expand Up @@ -816,7 +815,7 @@ ConvertAltivec32to32_prefetch(SDL_BlitInfo * info)
vbits = voverflow;
}

assert(width == 0);
SDL_assert(width == 0);

/* cover pixels at the end of the row that didn't fit in 16 bytes. */
while (extrawidth) {
Expand Down
5 changes: 3 additions & 2 deletions src/video/cocoa/SDL_cocoashape.m
Expand Up @@ -27,6 +27,7 @@
#include "SDL_shape.h"
#include "SDL_cocoashape.h"
#include "../SDL_sysvideo.h"
#include "SDL_assert.h"

SDL_WindowShaper*
Cocoa_CreateShaper(SDL_Window* window) {
Expand All @@ -49,7 +50,7 @@
data->shape = NULL;

int resized_properly = Cocoa_ResizeWindowShape(window);
assert(resized_properly == 0);
SDL_assert(resized_properly == 0);
return result;
}

Expand Down Expand Up @@ -100,7 +101,7 @@
int
Cocoa_ResizeWindowShape(SDL_Window *window) {
SDL_ShapeData* data = window->shaper->driverdata;
assert(data != NULL);
SDL_assert(data != NULL);
return 0;
}

Expand Down
2 changes: 1 addition & 1 deletion src/video/x11/SDL_x11opengl.c
Expand Up @@ -311,7 +311,7 @@ X11_GL_GetAttributes(_THIS, Display * display, int screen, int * attribs, int si
int i = 0;

/* assert buffer is large enough to hold all SDL attributes. */
/* assert(size >= 32);*/
SDL_assert(size >= 32);

/* Setup our GLX attributes according to the gl_config. */
attribs[i++] = GLX_RGBA;
Expand Down

0 comments on commit 04fc0f7

Please sign in to comment.