trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jplev...@apache.org
Subject svn commit: r1088433 - in /trafficserver/traffic/trunk: iocore/cluster/ClusterHandlerBase.cc iocore/cluster/ClusterProcessor.cc lib/ts/ParseRules.h mgmt/cluster/ClusterCom.cc mgmt/preparse/IPRange.cc
Date Sun, 03 Apr 2011 23:05:41 GMT
Author: jplevyak
Date: Sun Apr  3 23:05:41 2011
New Revision: 1088433

URL: http://svn.apache.org/viewvc?rev=1088433&view=rev
Log:
TS-629: fix some non-portable char == unsigned char assumptions (ARM). Credit to: Nick Kew

Modified:
    trafficserver/traffic/trunk/iocore/cluster/ClusterHandlerBase.cc
    trafficserver/traffic/trunk/iocore/cluster/ClusterProcessor.cc
    trafficserver/traffic/trunk/lib/ts/ParseRules.h
    trafficserver/traffic/trunk/mgmt/cluster/ClusterCom.cc
    trafficserver/traffic/trunk/mgmt/preparse/IPRange.cc

Modified: trafficserver/traffic/trunk/iocore/cluster/ClusterHandlerBase.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/iocore/cluster/ClusterHandlerBase.cc?rev=1088433&r1=1088432&r2=1088433&view=diff
==============================================================================
--- trafficserver/traffic/trunk/iocore/cluster/ClusterHandlerBase.cc (original)
+++ trafficserver/traffic/trunk/iocore/cluster/ClusterHandlerBase.cc Sun Apr  3 23:05:41 2011
@@ -145,11 +145,7 @@ ClusterControl::free_data()
       ink_release_assert(*(((uint8_t *) data) - DATA_HDR + 1) == (uint8_t) ALLOC_DATA_MAGIC);
       *(((uint8_t *) data) - DATA_HDR + 1) = (uint8_t) ~ ALLOC_DATA_MAGIC;
 
-      if (size_index >= 0) {
-        ink_release_assert(*(((char *) data) - DATA_HDR) == size_index);
-      } else {
-        ink_release_assert(*(((char *) data) - DATA_HDR) == -1);
-      }
+      ink_release_assert(*(((char *) data) - DATA_HDR) == size_index);         
     } else {
       // malloc'ed memory, not alloced via real_alloc_data().
       // Data will be xfree()'ed when IOBufferBlock is freed

Modified: trafficserver/traffic/trunk/iocore/cluster/ClusterProcessor.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/iocore/cluster/ClusterProcessor.cc?rev=1088433&r1=1088432&r2=1088433&view=diff
==============================================================================
--- trafficserver/traffic/trunk/iocore/cluster/ClusterProcessor.cc (original)
+++ trafficserver/traffic/trunk/iocore/cluster/ClusterProcessor.cc Sun Apr  3 23:05:41 2011
@@ -206,10 +206,10 @@ ClusterProcessor::free_remote_data(char 
 
   ink_release_assert(*((uint8_t *) (d - data_hdr + 1)) == (uint8_t) ALLOC_DATA_MAGIC);
   char size_index = *(d - data_hdr);
-  if (size_index >= 0) {
-    ink_release_assert((0 <= size_index) && (size_index <= (DEFAULT_BUFFER_SIZES
- 1)));
+  if (!(size_index & 0x80)) {
+    ink_release_assert(size_index <= (DEFAULT_BUFFER_SIZES - 1));
   } else {
-    ink_release_assert(size_index == -1);
+    ink_release_assert(size_index == 0xff);
   }
 
   // Extract 'this' pointer

Modified: trafficserver/traffic/trunk/lib/ts/ParseRules.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/lib/ts/ParseRules.h?rev=1088433&r1=1088432&r2=1088433&view=diff
==============================================================================
--- trafficserver/traffic/trunk/lib/ts/ParseRules.h (original)
+++ trafficserver/traffic/trunk/lib/ts/ParseRules.h Sun Apr  3 23:05:41 2011
@@ -189,8 +189,7 @@ ParseRules::is_char(char c)
 #ifndef COMPILE_PARSE_RULES
   return (parseRulesCType[(unsigned char) c] & is_char_BIT);
 #else
-  /* if I don't cast, gnu gives a warning: condition is always true */
-  return (c >= 0 && (unsigned char) c <= (unsigned char) 127);
+  return ((c & 0x80) == 0);
 #endif
 }
 
@@ -250,7 +249,7 @@ ParseRules::is_ctl(char c)
 #ifndef COMPILE_PARSE_RULES
   return (parseRulesCType[(unsigned char) c] & is_ctl_BIT);
 #else
-  return ((c >= 0 && c <= 31) || c == 127);
+  return ((!(c & 0x80) && c <= 31) || c == 127);
 #endif
 }
 

Modified: trafficserver/traffic/trunk/mgmt/cluster/ClusterCom.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/mgmt/cluster/ClusterCom.cc?rev=1088433&r1=1088432&r2=1088433&view=diff
==============================================================================
--- trafficserver/traffic/trunk/mgmt/cluster/ClusterCom.cc (original)
+++ trafficserver/traffic/trunk/mgmt/cluster/ClusterCom.cc Sun Apr  3 23:05:41 2011
@@ -2100,7 +2100,7 @@ ClusterCom::sendReliableMessageReadTillC
 
   memset(tmp_reply, 0, 1024);
   while ((res = read_socket(fd, tmp_reply, 1022) > 0)) {
-    if (tmp_reply[0] == EOF) {
+    if (tmp_reply[0] == (char)EOF) {
       break;
     }
     reply->copyFrom(tmp_reply, strlen(tmp_reply));

Modified: trafficserver/traffic/trunk/mgmt/preparse/IPRange.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/mgmt/preparse/IPRange.cc?rev=1088433&r1=1088432&r2=1088433&view=diff
==============================================================================
--- trafficserver/traffic/trunk/mgmt/preparse/IPRange.cc (original)
+++ trafficserver/traffic/trunk/mgmt/preparse/IPRange.cc Sun Apr  3 23:05:41 2011
@@ -109,7 +109,7 @@ IPRange::read_table_from_file(int fd, co
       c = EOF;                  // mimic behavior of getc on EOF
     // append null
     line[n] = '\0';
-    if (c == EOF)
+    if (c == (char)EOF)
       end_of_file = true;
     // first_string has the same length as line, so here we disable coverity check
     // coverity[secure_coding]



Mime
View raw message