[Forensics-changes] [yara] 377/407: Don't use stdbool.h as it doesn't exists in VC++

Hilko Bengen bengen at moszumanska.debian.org
Sat Jul 1 10:28:47 UTC 2017


This is an automated email from the git hooks/post-receive script.

bengen pushed a commit to annotated tag v3.3.0
in repository yara.

commit 5d9a69d2650b92b45d6f7b9dbc0f382e77acf4dc
Author: Victor M. Alvarez <plusvic at gmail.com>
Date:   Thu Feb 5 12:29:05 2015 +0100

    Don't use stdbool.h as it doesn't exists in VC++
---
 libyara/modules/hash.c | 17 ++++++++---------
 libyara/modules/math.c | 21 ++++++++++-----------
 2 files changed, 18 insertions(+), 20 deletions(-)

diff --git a/libyara/modules/hash.c b/libyara/modules/hash.c
index 05d211c..072401b 100644
--- a/libyara/modules/hash.c
+++ b/libyara/modules/hash.c
@@ -14,7 +14,6 @@ See the License for the specific language governing permissions and
 limitations under the License.
 */
 
-#include <stdbool.h>
 #include <openssl/md5.h>
 #include <openssl/sha.h>
 
@@ -120,7 +119,7 @@ define_function(data_md5)
 
   unsigned char digest[MD5_DIGEST_LENGTH];
   char digest_ascii[MD5_DIGEST_LENGTH * 2 + 1];
-  bool past_first_block = false;
+  int past_first_block = FALSE;
 
   MD5_Init(&md5_context);
 
@@ -144,7 +143,7 @@ define_function(data_md5)
 
       MD5_Update(&md5_context, block->data + data_offset, data_len);
 
-      past_first_block = true;
+      past_first_block = TRUE;
     }
     else if (past_first_block)
     {
@@ -184,7 +183,7 @@ define_function(data_sha1)
 
   unsigned char digest[SHA_DIGEST_LENGTH];
   char digest_ascii[SHA_DIGEST_LENGTH * 2 + 1];
-  bool past_first_block = false;
+  int past_first_block = FALSE;
 
   SHA1_Init(&sha_context);
 
@@ -207,7 +206,7 @@ define_function(data_sha1)
 
       SHA1_Update(&sha_context, block->data + data_offset, data_len);
 
-      past_first_block = true;
+      past_first_block = TRUE;
     }
     else if (past_first_block)
     {
@@ -247,7 +246,7 @@ define_function(data_sha256)
 
   unsigned char digest[SHA256_DIGEST_LENGTH];
   char digest_ascii[SHA256_DIGEST_LENGTH * 2 + 1];
-  bool past_first_block = false;
+  int past_first_block = FALSE;
 
   SHA256_Init(&sha256_context);
 
@@ -270,7 +269,7 @@ define_function(data_sha256)
 
       SHA256_Update(&sha256_context, block->data + data_offset, data_len);
 
-      past_first_block = true;
+      past_first_block = TRUE;
     }
     else if (past_first_block)
     {
@@ -307,7 +306,7 @@ define_function(data_checksum32)
   YR_MEMORY_BLOCK* block = NULL;
 
   uint32_t checksum = 0;
-  bool past_first_block = false;
+  int past_first_block = FALSE;
 
   if (offset < 0 || length < 0 || offset < context->mem_block->base)
   {
@@ -328,7 +327,7 @@ define_function(data_checksum32)
       for (int i = 0; i < data_len; i++)
         checksum += *(block->data + data_offset + i);
 
-      past_first_block = true;
+      past_first_block = TRUE;
     }
     else if (past_first_block)
     {
diff --git a/libyara/modules/math.c b/libyara/modules/math.c
index dc9c190..36f5278 100644
--- a/libyara/modules/math.c
+++ b/libyara/modules/math.c
@@ -14,7 +14,6 @@ See the License for the specific language governing permissions and
 limitations under the License.
 */
 
-#include <stdbool.h>
 #include <math.h>
 
 #include <yara/modules.h>
@@ -74,7 +73,7 @@ define_function(data_entropy)
   if (data == NULL)
     return_float(UNDEFINED);
 
-  bool past_first_block = false;
+  int past_first_block = FALSE;
   uint64_t total_len = 0;
 
   foreach_memory_block(context, block)
@@ -95,7 +94,7 @@ define_function(data_entropy)
         data[c] += 1;
       }
 
-      past_first_block = true;
+      past_first_block = TRUE;
     }
     else if (past_first_block)
     {
@@ -164,7 +163,7 @@ define_function(data_deviation)
     return ERROR_WRONG_ARGUMENTS;
   }
 
-  bool past_first_block = false;
+  int past_first_block = FALSE;
   uint64_t total_len = 0;
 
   foreach_memory_block(context, block)
@@ -182,7 +181,7 @@ define_function(data_deviation)
       for (int i = 0; i < data_len; i++)
         sum += fabs(((double) *(block->data + data_offset + i)) - mean);
 
-      past_first_block = true;
+      past_first_block = TRUE;
     }
     else if (past_first_block)
     {
@@ -231,7 +230,7 @@ define_function(data_mean)
     return ERROR_WRONG_ARGUMENTS;
   }
 
-  bool past_first_block = false;
+  int past_first_block = FALSE;
   uint64_t total_len = 0;
   double sum = 0.0;
 
@@ -250,7 +249,7 @@ define_function(data_mean)
       for (int i = 0; i < data_len; i++)
         sum += (double) *(block->data + data_offset + i);
 
-      past_first_block = true;
+      past_first_block = TRUE;
     }
     else if (past_first_block)
     {
@@ -275,7 +274,7 @@ define_function(data_mean)
 
 define_function(data_serial_correlation)
 {
-  bool past_first_block = false;
+  int past_first_block = FALSE;
   uint64_t total_len = 0;
 
   int64_t offset = integer_argument(1);
@@ -316,7 +315,7 @@ define_function(data_serial_correlation)
         scclast = sccun;
       }
 
-      past_first_block = true;
+      past_first_block = TRUE;
     }
     else if (past_first_block)
     {
@@ -400,7 +399,7 @@ define_function(data_monte_carlo_pi)
   int mcount = 0;
   int inmont = 0;
 
-  bool past_first_block = false;
+  int past_first_block = FALSE;
 
   foreach_memory_block(context, block)
   {
@@ -437,7 +436,7 @@ define_function(data_monte_carlo_pi)
         }
       }
 
-      past_first_block = true;
+      past_first_block = TRUE;
     }
     else if (past_first_block)
     {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/forensics/yara.git



More information about the forensics-changes mailing list