[Forensics-changes] [yara] 151/407: Fix some warnings and errors while compiling on Windows
Hilko Bengen
bengen at moszumanska.debian.org
Sat Jul 1 10:28:19 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 62d8318e3d5c4433b7e1fc888aea7e3fa62e92b4
Author: Victor M. Alvarez <plusvic at gmail.com>
Date: Tue Oct 28 18:37:54 2014 +0100
Fix some warnings and errors while compiling on Windows
---
libyara/grammar.c | 2 +-
libyara/grammar.y | 2 +-
libyara/include/yara/pe.h | 41 +++++++++++++++++++++--------------------
libyara/mem.c | 9 ++++-----
4 files changed, 27 insertions(+), 27 deletions(-)
diff --git a/libyara/grammar.c b/libyara/grammar.c
index 0689b8b..15ac31c 100644
--- a/libyara/grammar.c
+++ b/libyara/grammar.c
@@ -3312,7 +3312,7 @@ yyreduce:
compiler->sz_arena,
(yyvsp[(1) - (1)].sized_string),
(yyvsp[(1) - (1)].sized_string)->length + sizeof(SIZED_STRING),
- (void*) &sized_string);
+ (void**) &sized_string);
yr_free((yyvsp[(1) - (1)].sized_string));
diff --git a/libyara/grammar.y b/libyara/grammar.y
index 715af05..8d0d689 100644
--- a/libyara/grammar.y
+++ b/libyara/grammar.y
@@ -1560,7 +1560,7 @@ primary_expression
compiler->sz_arena,
$1,
$1->length + sizeof(SIZED_STRING),
- (void*) &sized_string);
+ (void**) &sized_string);
yr_free($1);
diff --git a/libyara/include/yara/pe.h b/libyara/include/yara/pe.h
index 911316c..0e4e5a6 100644
--- a/libyara/include/yara/pe.h
+++ b/libyara/include/yara/pe.h
@@ -77,26 +77,6 @@ typedef struct _IMAGE_DOS_HEADER { // DOS .EXE header
#pragma pack(pop)
//
-// Rich signature.
-// http://www.ntcore.com/files/richsign.htm
-//
-typedef struct _RICH_SIGNATURE {
- DWORD dans;
- DWORD key1;
- DWORD key2;
- DWORD key3;
- } RICH_SIGNATURE, *PRICH_SIGNATURE;
-
-#define RICH_DANS 0x536e6144 // "DanS"
-#define RICH_RICH 0x68636952 // "Rich"
-
-typedef struct _RICH_DATA {
- size_t len;
- BYTE* raw_data;
- BYTE* clear_data;
- } RICH_DATA, *PRICH_DATA;
-
-//
// File header format.
//
@@ -400,4 +380,25 @@ typedef struct _VERSION_INFO {
char Key[0];
} VERSION_INFO, *PVERSION_INFO;
+//
+// Rich signature.
+// http://www.ntcore.com/files/richsign.htm
+//
+
+typedef struct _RICH_SIGNATURE {
+ DWORD dans;
+ DWORD key1;
+ DWORD key2;
+ DWORD key3;
+} RICH_SIGNATURE, *PRICH_SIGNATURE;
+
+#define RICH_DANS 0x536e6144 // "DanS"
+#define RICH_RICH 0x68636952 // "Rich"
+
+typedef struct _RICH_DATA {
+ size_t len;
+ BYTE* raw_data;
+ BYTE* clear_data;
+} RICH_DATA, *PRICH_DATA;
+
#pragma pack(pop)
diff --git a/libyara/mem.c b/libyara/mem.c
index a9b7565..5a71cd5 100644
--- a/libyara/mem.c
+++ b/libyara/mem.c
@@ -45,10 +45,9 @@ int yr_heap_free()
}
-// Call yr_malloc(), which does HEAP_ZERO_MEMORY.
void* yr_calloc(size_t count, size_t size)
{
- return yr_malloc(count * size);
+ return (void*) HeapAlloc(hHeap, HEAP_ZERO_MEMORY, count * size);
}
@@ -73,7 +72,7 @@ void yr_free(void* ptr)
char* yr_strdup(const char *str)
{
size_t len = strlen(str);
- void *dup = yr_malloc(len + 1);
+ char *dup = (char*) yr_malloc(len + 1);
if (dup == NULL)
return NULL;
@@ -88,12 +87,12 @@ char* yr_strdup(const char *str)
char* yr_strndup(const char *str, size_t n)
{
size_t len = strnlen(str, n);
- void *dup = yr_malloc(len + 1);
+ char *dup = (char*) yr_malloc(len + 1);
if (dup == NULL)
return NULL;
- memcpy(dup, s, len);
+ memcpy(dup, str, len);
dup[len] = '\0';
return (char *) dup;
--
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