[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
for Unix stuff.
--
Vincent Penquerc'h
--- src/linux/fbcon.c.assert Thu Oct 17 14:19:59 2002
+++ src/linux/fbcon.c Thu Oct 17 14:21:21 2002
@@ -563,6 +563,8 @@
struct fb_cmap cmap;
int i;
+ ASSERT(p);
+
cmap.start = from;
cmap.len = to-from+1;
cmap.red = r;
@@ -898,6 +900,8 @@
static int update_timings(struct fb_var_screeninfo *mode)
{
struct timings *t;
+
+ ASSERT(mode);
set_default_timings();
t = _fb_get_timings (mode->xres, mode->yres);
--- src/linux/ljoy.c.assert Thu Oct 17 14:23:03 2002
+++ src/linux/ljoy.c Thu Oct 17 14:23:14 2002
@@ -144,6 +144,7 @@
static void set_axis (JOYSTICK_AXIS_INFO *axis, int value)
{
+ ASSERT(axis);
axis->pos = value * 127 / 32767;
axis->d1 = (value < -8192);
axis->d2 = (value > 8192);
--- src/linux/lkeybd.c.assert Thu Oct 17 14:23:31 2002
+++ src/linux/lkeybd.c Thu Oct 17 14:24:08 2002
@@ -158,6 +158,8 @@
int map;
struct kbentry kbe;
+ ASSERT(buf || bytes_read==0);
+
/* Process all keys read from left to right */
for (ch = 0; ch < bytes_read; ch++) {
/* Read kernel's fake scancode */
--- src/linux/lmemory.c.assert Thu Oct 17 14:24:22 2002
+++ src/linux/lmemory.c Thu Oct 17 14:24:36 2002
@@ -64,6 +64,7 @@
*/
int __al_linux_map_memory (struct MAPPED_MEMORY *info)
{
+ ASSERT(info);
info->data = mmap (0, info->size, info->perms, MAP_SHARED, mem_fd, info->base);
if (info->data == MAP_FAILED) {
info->data = NULL;
@@ -78,6 +79,7 @@
*/
int __al_linux_unmap_memory (struct MAPPED_MEMORY *info)
{
+ ASSERT(info);
if (!munmap (info->data, info->size)) {
info->data = NULL;
return 0;
--- src/linux/lmouse.c.assert Thu Oct 17 14:25:16 2002
+++ src/linux/lmouse.c Thu Oct 17 14:26:04 2002
@@ -116,6 +116,9 @@
int temp_x = mymickey_x;
int temp_y = mymickey_y;
+ ASSERT(mickeyx);
+ ASSERT(mickeyy);
+
mymickey_x -= temp_x;
mymickey_y -= temp_y;
@@ -188,6 +191,8 @@
int eaten;
struct mouse_info info;
+ ASSERT(buf || buf_size==0);
+
eaten = internal_driver->process (buf, buf_size, &info);
if (info.updated)
__al_linux_mouse_handler (info.x, info.y, info.z, info.l + (info.r << 1) + (info.m << 2));
@@ -271,6 +276,8 @@
*/
int __al_linux_mouse_init (INTERNAL_MOUSE_DRIVER *drv)
{
+ ASSERT(drv);
+
internal_driver = drv;
std_mouse.fd = drv->device;
--- src/linux/lmsegpmd.c.assert Thu Oct 17 14:26:37 2002
+++ src/linux/lmsegpmd.c Thu Oct 17 14:27:03 2002
@@ -46,6 +46,9 @@
*/
static int processor (unsigned char *buf, int buf_size, struct mouse_info *info)
{
+ ASSERT(buf || buf_size==0);
+ ASSERT(info);
+
info->updated = 0;
if (buf_size < 5) return 0; /* not enough data, spit it out for now */
--- src/linux/lmsems.c.assert Thu Oct 17 14:27:14 2002
+++ src/linux/lmsems.c Thu Oct 17 14:27:52 2002
@@ -44,6 +44,9 @@
*/
static int processor (unsigned char *buf, int buf_size, struct mouse_info *info)
{
+ ASSERT(buf || buf_size==0);
+ ASSERT(info);
+
/* if we don't have enough input, we don't want the caller to process
* the `info' struct */
info->updated = 0;
@@ -87,6 +90,8 @@
int packets = 0, errors = 0;
int step = 0;
+
+ ASSERT(buffer || size==0);
for (pos = 0; pos < size; pos++)
switch (step) {
--- src/linux/lmseps2.c.assert Thu Oct 17 14:28:06 2002
+++ src/linux/lmseps2.c Thu Oct 17 14:28:38 2002
@@ -53,6 +53,9 @@
*/
static int processor (unsigned char *buf, int buf_size, struct mouse_info *info)
{
+ ASSERT(buf || buf_size==0);
+ ASSERT(info);
+
info->updated = 0;
if (buf_size < packet_size) return 0; /* not enough data, spit it out for now */
@@ -94,6 +97,8 @@
int packets = 0, errors = 0;
int step = 0;
+
+ ASSERT(buffer || size==0);
for (pos = 0; pos < size; pos++)
switch (step) {
--- src/linux/lstddrv.c.assert Thu Oct 17 14:29:03 2002
+++ src/linux/lstddrv.c Thu Oct 17 14:36:39 2002
@@ -36,7 +36,9 @@
switch (mode) {
case ASYNC_BSD:
{
- int flags = fcntl(drv->fd, F_GETFL, 0);
+ int flags;
+ ASSERT(drv);
+ flags = fcntl(drv->fd, F_GETFL, 0);
fcntl(drv->fd, F_SETFL, flags & ~FASYNC);
break;
}
@@ -50,6 +52,8 @@
static void __async_enable_driver (STD_DRIVER *drv, int mode)
{
+ ASSERT(drv);
+
drv->resume();
drv->private[PRIV_ENABLED] = 1;
--- src/linux/lsystem.c.assert Thu Oct 17 14:30:16 2002
+++ src/linux/lsystem.c Thu Oct 17 14:31:18 2002
@@ -268,8 +268,12 @@
*/
static void sys_linux_message (AL_CONST char *msg)
{
- char *tmp = malloc(ALLEGRO_MESSAGE_SIZE);
+ char *tmp;
int ret;
+
+ ASSERT(msg);
+
+ tmp = malloc(ALLEGRO_MESSAGE_SIZE);
msg = uconvert(msg, U_CURRENT, tmp, U_ASCII, ALLEGRO_MESSAGE_SIZE);
do {
--- src/linux/lvgahelp.c.assert Thu Oct 17 14:31:49 2002
+++ src/linux/lvgahelp.c Thu Oct 17 14:33:09 2002
@@ -131,7 +131,9 @@
static void __al_linux_save_palette (MODE_REGISTERS *regs)
{
int c;
- unsigned char *ptr = regs->palette.vga;
+ unsigned char *ptr;
+ ASSERT(regs);
+ ptr = regs->palette.vga;
for (c = 0; c < 256; c++) {
outportb (0x3c7, c);
*ptr++ = inportb (0x3c9);
@@ -143,7 +145,9 @@
static void __al_linux_restore_palette (MODE_REGISTERS *regs)
{
int c;
- unsigned char *ptr = regs->palette.vga;
+ unsigned char *ptr;
+ ASSERT(regs);
+ ptr = regs->palette.vga;
for (c = 0; c < 256; c++) {
outportb (0x3c8, c);
outportb (0x3c9, *ptr++);
@@ -157,6 +161,7 @@
{
unsigned i;
+ ASSERT(from && to);
for (i = 0; i < count; i++) {
*to++ = *from++;
outportb(0x80, 0x00); /* 1ms delay */
@@ -170,6 +175,7 @@
*/
static void __al_linux_save_text_font (MODE_REGISTERS *regs)
{
+ ASSERT(regs);
if (!regs->text_font1)
regs->text_font1 = (unsigned char*) malloc (VGA_FONT_SIZE);
if (!regs->text_font2)
@@ -201,6 +207,7 @@
*/
static void __al_linux_restore_text_font(MODE_REGISTERS *regs)
{
+ ASSERT(regs);
/* Same as in the previous routing. We're restoring the font in a
* 4bpp mode to have access to separate memory planes. */
inportb(_is1);
--- src/linux/svgalib.c.assert Thu Oct 17 14:33:31 2002
+++ src/linux/svgalib.c Thu Oct 17 14:35:29 2002
@@ -97,6 +97,8 @@
*/
unsigned long _svgalib_read_line(BITMAP *bmp, int line)
{
+ ASSERT(bmp);
+ ASSERT(line>=0 && line<bmp->h);
return (unsigned long) (bmp->line[line]);
}
@@ -107,7 +109,10 @@
*/
unsigned long _svgalib_write_line(BITMAP *bmp, int line)
{
- int new_line = line + bmp->y_ofs;
+ int new_line;
+ ASSERT(bmp);
+ ASSERT(line>=0 && line<bmp->h);
+ new_line = line + bmp->y_ofs;
if ((new_line != last_line) && (last_line >= 0))
vga_drawscansegment(screen_buffer + last_line * bytes_per_line, 0, last_line, bytes_per_line);
last_line = new_line;
@@ -121,6 +126,7 @@
*/
void _svgalib_unwrite_line(BITMAP *bmp)
{
+ ASSERT(bmp);
if (last_line >= 0) {
vga_drawscanline(last_line, screen_buffer + last_line * bytes_per_line);
last_line = -1;
@@ -210,6 +216,7 @@
static int mode_ok(vga_modeinfo *info, int w, int h, int v_w, int v_h,
int color_depth)
{
+ ASSERT(info);
return ((color_depth == get_depth(info->colors, info->bytesperpixel))
&& (((info->width == w) && (info->height == h))
|| ((w == 0) && (h == 0)))
@@ -529,6 +536,11 @@
static void svga_set_palette(AL_CONST RGB *p, int from, int to, int vsync)
{
int i;
+
+ ASSERT(p);
+ ASSERT(from>=0 && from<=255);
+ ASSERT(to>=0 && to<=255);
+ ASSERT(from<=to);
if (vsync)
vga_waitretrace();
--- src/linux/vtswitch.c.assert Thu Oct 17 14:35:52 2002
+++ src/linux/vtswitch.c Thu Oct 17 14:36:08 2002
@@ -174,6 +174,7 @@
*/
void __al_linux_acquire_bitmap(BITMAP *bmp)
{
+ ASSERT(bmp);
__al_linux_switching_blocked++;
}
@@ -184,6 +185,7 @@
*/
void __al_linux_release_bitmap(BITMAP *bmp)
{
+ ASSERT(bmp);
__al_linux_switching_blocked--;
poll_console_switch();
}