Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
Replaced some assert macros with SDL_assert.
  • Loading branch information
icculus committed Feb 7, 2012
1 parent e611f54 commit 04fc0f720ee45f68b58b1e12b7cd08cdc4b508f7
@@ -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
@@ -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;
@@ -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

@@ -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++) {
@@ -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
@@ -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) \
@@ -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
@@ -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);
@@ -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));
@@ -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... */
@@ -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));
@@ -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... */
@@ -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;
@@ -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;
@@ -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) {
@@ -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;
@@ -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) {
@@ -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) {
@@ -49,7 +50,7 @@
data->shape = NULL;

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

@@ -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;
}

@@ -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;

0 comments on commit 04fc0f7

Please sign in to comment.