changeset 806:1f50c8edd739

Fix some assert() clauses.
author Matti Hamalainen <ccr@tnsp.org>
date Fri, 17 Jul 2009 22:11:32 +0000
parents b924d9c9d58f
children 6f29704156db
files maputils.c
diffstat 1 files changed, 18 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/maputils.c	Fri Jul 17 22:11:21 2009 +0000
+++ b/maputils.c	Fri Jul 17 22:11:32 2009 +0000
@@ -233,8 +233,8 @@
 
 void mcXHTMLhead(FILE *outFile, char *title)
 {
-    const char *strCharSet = "iso-8859-1";
-    assert(outFile);
+    static const char *strCharSet = "iso-8859-1";
+    assert(outFile != NULL);
     
     /* Output XHTML header */
     fprintf(outFile,
@@ -257,7 +257,7 @@
 void mcXHTMLcolors(FILE *outFile, char *tagName, char *propName, char *extra)
 {
     int n;
-    assert(outFile);
+    assert(outFile != NULL);
     
     for (n = 0; n < nmapColors; n++) {
         fprintf(outFile,
@@ -276,7 +276,7 @@
     mapblock_t *blockRes;
     
     /* Check arguments */
-    if ((blockW <= 0) || (blockH <= 0))
+    if (blockW <= 0 || blockH <= 0)
         return NULL;
     
     /* Allocate struct and data */
@@ -316,7 +316,7 @@
     long pos = 0L;
     BOOL flag;
     int x, y, resW, resH, c;
-    assert(mapFilename);
+    assert(mapFilename != NULL);
     
     /* Open file */
     if ((inFile = fopen(mapFilename, "rb")) == NULL) {
@@ -420,8 +420,8 @@
 {
     unsigned char *c;
     int x, y;
-    assert(f);
-    assert(map);
+    assert(f != NULL);
+    assert(map != NULL);
 
     c = map->d;
         
@@ -445,16 +445,16 @@
 int putBlockDo(mapblock_t *map, mapblock_t *b, int ox, int oy)
 {
     int x, y;
-    assert(map);
-    assert(b);
+    assert(map != NULL);
+    assert(b != NULL);
     
     for (y = 0; y < b->h; y++)
     for (x = 0; x < b->w; x++) {
         int dx = (ox + x);
         int dy = (oy + y);
         
-        if ((dx >= 0) && (dx < map->w) &&
-            (dy >= 0) && (dy < map->h)) {
+        if (dx >= 0 && dx < map->w &&
+            dy >= 0 && dy < map->h) {
             char c = b->d[(y * b->w) + x];
 
             if (c != 0)
@@ -474,8 +474,9 @@
     mapblock_t *tmp;
     int x0, y0, x1, y1, mx, my;
 
-    assert(map);
-    assert(b);
+    assert(map != NULL);
+    assert(*map != NULL);
+    assert(b != NULL);
     
     /* Determine new block size */
     x0 = mx = y0 = my = 0;
@@ -520,8 +521,8 @@
 {
     int x, y;
     unsigned char *c;
-    assert(map);
-    assert(symbols);
+    assert(map != NULL);
+    assert(symbols != NULL);
     
     c = map->d;
     for (y = 0; y < map->h; y++)
@@ -537,6 +538,8 @@
 {
     unsigned char *c = map->d;
     int x, y;
+    assert(f != NULL);
+    assert(map != NULL);
     
     for (y = 0; y < map->h; y++) {
         for (x = 0; x < map->w; x++) {