Author: petdance
Date: Sun Jun 10 20:08:03 2007
New Revision: 18915

Modified:
   trunk/docs/dev/nanoparrot.c
   trunk/src/charset.c
   trunk/src/encoding.c
   trunk/src/exec.c
   trunk/src/interpreter.c
   trunk/src/io/io_mmap.c
   trunk/src/objects.c
   trunk/src/pmc/parrotio.pmc
   trunk/src/utils.c

Log:
memcmp and strcmp are not boolean functions

Modified: trunk/docs/dev/nanoparrot.c
==============================================================================
--- trunk/docs/dev/nanoparrot.c (original)
+++ trunk/docs/dev/nanoparrot.c Sun Jun 10 20:08:03 2007
@@ -282,7 +282,7 @@
 
     prog = usage;
     if (argc > 1) {
-        if (!strcmp(argv[1], "mops"))
+        if (strcmp(argv[1], "mops") == 0)
             prog = mops;
     }
     init(interpreter, prog);

Modified: trunk/src/charset.c
==============================================================================
--- trunk/src/charset.c (original)
+++ trunk/src/charset.c Sun Jun 10 20:08:03 2007
@@ -223,19 +223,19 @@
         all_charsets->n_charsets = 0;
         all_charsets->set = NULL;
     }
-    if (!strcmp("binary", charsetname)) {
+    if (strcmp("binary", charsetname) == 0) {
         Parrot_binary_charset_ptr = charset;
         return register_charset(interp, charsetname, charset);
     }
-    if (!strcmp("iso-8859-1", charsetname)) {
+    if (strcmp("iso-8859-1", charsetname) == 0) {
         Parrot_iso_8859_1_charset_ptr = charset;
         return register_charset(interp, charsetname, charset);
     }
-    if (!strcmp("unicode", charsetname)) {
+    if (strcmp("unicode", charsetname) == 0) {
         Parrot_unicode_charset_ptr = charset;
         return register_charset(interp, charsetname, charset);
     }
-    if (!strcmp("ascii", charsetname)) {
+    if (strcmp("ascii", charsetname) == 0) {
         if (!Parrot_default_charset_ptr) {
             Parrot_default_charset_ptr = charset;
         }

Modified: trunk/src/encoding.c
==============================================================================
--- trunk/src/encoding.c        (original)
+++ trunk/src/encoding.c        Sun Jun 10 20:08:03 2007
@@ -75,7 +75,7 @@
 
     n = all_encodings->n_encodings;
     for (i = 0; i < n; ++i) {
-        if (!strcmp(all_encodings->enc[i].encoding->name, encodingname)) {
+        if (strcmp(all_encodings->enc[i].encoding->name, encodingname) == 0) {
             return all_encodings->enc[i].encoding;
         }
     }
@@ -166,7 +166,7 @@
 
     n = all_encodings->n_encodings;
     for (i = 0; i < n; ++i) {
-        if (!strcmp(all_encodings->enc[i].encoding->name, encodingname))
+        if (strcmp(all_encodings->enc[i].encoding->name, encodingname) == 0)
             return 0;
     }
     /*
@@ -195,7 +195,7 @@
         all_encodings->n_encodings = 0;
         all_encodings->enc = NULL;
     }
-    if (!strcmp("fixed_8", encodingname)) {
+    if (strcmp("fixed_8", encodingname) == 0) {
         Parrot_fixed_8_encoding_ptr = encoding;
         if (!Parrot_default_encoding_ptr) {
             Parrot_default_encoding_ptr = encoding;
@@ -203,15 +203,15 @@
         }
         return register_encoding(interp, encodingname, encoding);
     }
-    if (!strcmp("utf8", encodingname)) {
+    if (strcmp("utf8", encodingname) == 0) {
         Parrot_utf8_encoding_ptr = encoding;
         return register_encoding(interp, encodingname, encoding);
     }
-    if (!strcmp("utf16", encodingname)) {
+    if (strcmp("utf16", encodingname) == 0) {
         Parrot_utf16_encoding_ptr = encoding;
         return register_encoding(interp, encodingname, encoding);
     }
-    if (!strcmp("ucs2", encodingname)) {
+    if (strcmp("ucs2", encodingname) == 0) {
         Parrot_ucs2_encoding_ptr = encoding;
         return register_encoding(interp, encodingname, encoding);
     }

Modified: trunk/src/exec.c
==============================================================================
--- trunk/src/exec.c    (original)
+++ trunk/src/exec.c    Sun Jun 10 20:08:03 2007
@@ -311,7 +311,7 @@
     int i;
 
     for (i = 0; i < obj->symbol_count; i++)
-        if (!strcmp(symbol, obj->symbol_table[i].symbol))
+        if (strcmp(symbol, obj->symbol_table[i].symbol) == 0)
             return i;
     return -1;
 }

Modified: trunk/src/interpreter.c
==============================================================================
--- trunk/src/interpreter.c     (original)
+++ trunk/src/interpreter.c     Sun Jun 10 20:08:03 2007
@@ -894,8 +894,8 @@
      * the base names of this lib and the previous one are the same
      */
     if (interp->n_libs >= 2 &&
-            !strcmp(interp->all_op_libs[interp->n_libs-2]->name,
-                lib->name)) {
+            (strcmp(interp->all_op_libs[interp->n_libs-2]->name,
+                lib->name) == 0) ) {
         /* registering is handled below */
         return;
     }

Modified: trunk/src/io/io_mmap.c
==============================================================================
--- trunk/src/io/io_mmap.c      (original)
+++ trunk/src/io/io_mmap.c      Sun Jun 10 20:08:03 2007
@@ -104,7 +104,7 @@
 
     if (!l) {
         l = interp->piodata->default_stack;
-        if (!strcmp(l->name, "buf"))
+        if (strcmp(l->name, "buf") == 0)
             l = PIO_DOWNLAYER(l);
     }
     io = PIO_open_down(interp, l, path, flags);

Modified: trunk/src/objects.c
==============================================================================
--- trunk/src/objects.c (original)
+++ trunk/src/objects.c Sun Jun 10 20:08:03 2007
@@ -398,7 +398,7 @@
     INTVAL i;
 
     for (i = 0; i < MMD_USER_FIRST; ++i) {
-        if (!strcmp(Parrot_mmd_func_names[i], name))
+        if (strcmp(Parrot_mmd_func_names[i], name) == 0)
             return i;
     }
 

Modified: trunk/src/pmc/parrotio.pmc
==============================================================================
--- trunk/src/pmc/parrotio.pmc  (original)
+++ trunk/src/pmc/parrotio.pmc  Sun Jun 10 20:08:03 2007
@@ -77,14 +77,14 @@
         if (!pio || !PMC_struct_val(pio))
             return pmc_new(INTERP, enum_class_Undef);
         if (l) {
-            ParrotIO *io = (ParrotIO *)PMC_data(pio);
-            int is_mmap = strcmp(c_layer, "mmap") == 0;
+            ParrotIO * const io = (ParrotIO *)PMC_data(pio);
+            const int is_mmap = strcmp(c_layer, "mmap") == 0;
             /*
              * XXX move this into the layer
              */
             if ((is_mmap && (io->b.flags & PIO_BF_MMAP)) || !is_mmap) {
                 l = interp->piodata->default_stack;
-                if (!strcmp(l->name, "buf"))
+                if (strcmp(l->name, "buf") == 0)
                     l = l->down;
                 /* XXX layer is stored twice - which is used when */
                 io->stack           = l;

Modified: trunk/src/utils.c
==============================================================================
--- trunk/src/utils.c   (original)
+++ trunk/src/utils.c   Sun Jun 10 20:08:03 2007
@@ -580,6 +580,7 @@
 INTVAL
 Parrot_byte_rindex(Interp *interp, const STRING *base /*NN*/,
         const STRING *search /*NN*/, UINTVAL start_offset)
+    /* WARN_UNUSED */
 {
     const INTVAL searchlen = search->strlen;
     const char * const search_start = search->strstart;
@@ -592,7 +593,7 @@
     for (current_offset = max_possible_offset; current_offset >= 0;
             current_offset--) {
         const char * const base_start = (char *)base->strstart + 
current_offset;
-        if (!memcmp(base_start, search_start, searchlen)) {
+        if (memcmp(base_start, search_start, searchlen) == 0) {
             return current_offset;
         }
     }

Reply via email to