]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
dnp3-gen: rename index variable to point_index
authorJason Ish <ish@unx.ca>
Mon, 28 Nov 2016 16:06:14 +0000 (10:06 -0600)
committerVictor Julien <victor@inliniac.net>
Tue, 29 Nov 2016 08:03:41 +0000 (09:03 +0100)
Gcc 4.6 will warning with -Wshadow for a local variable
named "index" as <strings.h> has a function named "index".

Newer versions of gcc handle this case.

scripts/dnp3-gen/dnp3-gen.py

index 29d7ae2e5983f57097f18a8ab049dcc5af8441e5..67cee0e2bcaa3de6c062f607ebcfec129c300c58 100755 (executable)
@@ -363,7 +363,7 @@ static int DNP3DecodeObjectG{{object.group}}V{{object.variation}}(const uint8_t
     DNP3ObjectG{{object.group}}V{{object.variation}} *object = NULL;
     int bytes = (count / 8) + 1;
     uint32_t prefix = 0;
-    int index = start;
+    int point_index = start;
 
     if (!DNP3ReadPrefix(buf, len, prefix_code, &prefix)) {
         goto error;
@@ -392,13 +392,13 @@ static int DNP3DecodeObjectG{{object.group}}V{{object.variation}}(const uint8_t
 #error "Unhandled field width: {{object.fields[0].width}}"
 {% endif %}
 
-            if (!DNP3AddPoint(points, object, index, prefix_code, prefix)) {
+            if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
                 goto error;
             }
 
             object = NULL;
             count--;
-            index++;
+            point_index++;
         }
 
     }
@@ -418,7 +418,7 @@ static int DNP3DecodeObjectG{{object.group}}V{{object.variation}}(const uint8_t
 {
     DNP3ObjectG{{object.group}}V{{object.variation}} *object = NULL;
     uint32_t prefix = 0;
-    uint32_t index = start;
+    uint32_t point_index = start;
 {% if object._track_offset %}
     uint32_t offset;
 {% endif %}
@@ -558,12 +558,12 @@ static int DNP3DecodeObjectG{{object.group}}V{{object.variation}}(const uint8_t
 {% endif %}
 {% endfor %}
 
-        if (!DNP3AddPoint(points, object, index, prefix_code, prefix)) {
+        if (!DNP3AddPoint(points, object, point_index, prefix_code, prefix)) {
             goto error;
         }
 
         object = NULL;
-        index++;
+        point_index++;
     }
 
     return 1;