This is an automated email from the ASF dual-hosted git repository.

jinterrante pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/daffodil.git


The following commit(s) were added to refs/heads/main by this push:
     new 1e039d0  Fix C compilation error on CentOS 7
1e039d0 is described below

commit 1e039d0c0b267d5cef7c93abad2fc6881d297893
Author: John Interrante <[email protected]>
AuthorDate: Fri Oct 22 09:56:02 2021 -0400

    Fix C compilation error on CentOS 7
    
    xml_reader.c, xml_writer.c - Define loop variable i before, not
    inside, "for (" loop statement.
    
    DAFFODIL-2566
---
 .../main/resources/org/apache/daffodil/runtime2/c/libcli/xml_reader.c  | 3 ++-
 .../main/resources/org/apache/daffodil/runtime2/c/libcli/xml_writer.c  | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git 
a/daffodil-runtime2/src/main/resources/org/apache/daffodil/runtime2/c/libcli/xml_reader.c
 
b/daffodil-runtime2/src/main/resources/org/apache/daffodil/runtime2/c/libcli/xml_reader.c
index 5dc6e9a..a309552 100644
--- 
a/daffodil-runtime2/src/main/resources/org/apache/daffodil/runtime2/c/libcli/xml_reader.c
+++ 
b/daffodil-runtime2/src/main/resources/org/apache/daffodil/runtime2/c/libcli/xml_reader.c
@@ -268,7 +268,8 @@ strtohexbinary(const char *text, HexBinary *hexBinary)
 
     // Store hexadecimal characters into byte array
     if (hexBinary->array) memset(hexBinary->array, 0, 
hexBinary->lengthInBytes);
-    for (size_t i = 0; i < numNibbles; i++)
+    size_t i;
+    for (i = 0; i < numNibbles; i++)
     {
         char    c = text[i];
         uint8_t value = 0;
diff --git 
a/daffodil-runtime2/src/main/resources/org/apache/daffodil/runtime2/c/libcli/xml_writer.c
 
b/daffodil-runtime2/src/main/resources/org/apache/daffodil/runtime2/c/libcli/xml_writer.c
index a146a31..9c4dd2a 100644
--- 
a/daffodil-runtime2/src/main/resources/org/apache/daffodil/runtime2/c/libcli/xml_writer.c
+++ 
b/daffodil-runtime2/src/main/resources/org/apache/daffodil/runtime2/c/libcli/xml_writer.c
@@ -86,7 +86,8 @@ binaryToHex(HexBinary hexBinary, bool freeMemory)
 
     // Convert each binary byte to two hexadecimal characters
     char *nibble = text;
-    for (size_t i = 0; i < hexBinary.lengthInBytes; i++)
+    size_t i;
+    for (i = 0; i < hexBinary.lengthInBytes; i++)
     {
         static char hexDigit[] = "0123456789ABCDEF";
         *(nibble++) = hexDigit[hexBinary.array[i] / 16]; // high nibble

Reply via email to