eliminating compile warnings in windows 10, vs2015, x86 and x64.

remotes/push_mirror/bug11858-pull-requests
Micah Snyder 8 years ago
parent 78a06dae12
commit 8efbf4a0cb
  1. 2
      libclamav/cltypes.h
  2. 6
      libclamav/fmap.c
  3. 2
      libclamav/fmap.h
  4. 4
      libclamav/matcher-ac.c
  5. 2
      libclamav/openioc.c
  6. 6
      libclamav/readdb.c
  7. 8
      libclamav/regex/regcomp.c
  8. 4
      libclamav/regex/regex2.h
  9. 2
      libclamav/regex/utils.h
  10. 4
      libclamav/regex_list.c
  11. 2
      libclamav/regex_suffix.c
  12. 4
      libclamav/www.c
  13. 2
      libclamav/yara_grammar.y
  14. 4
      libclamav/yara_lexer.c
  15. 2
      libclamunrar/unrarvm.c
  16. 1
      shared/misc.h
  17. 25
      win32/llvmbuild/include/llvm/System/DataTypes.h

@ -36,6 +36,8 @@
#include <inttypes.h>
#elif defined(HAVE_STDINT_H)
#include <stdint.h>
#elif defined(_MSC_VER)
#include <stdint.h>
#else
typedef signed char int8_t;
typedef unsigned char uint8_t;

@ -150,7 +150,7 @@ fmap_t *fmap_check_empty(int fd, off_t offset, size_t len, int *empty) { /* WIN3
CloseHandle(fh);
return NULL;
}
m->handle = (void*)(ssize_t)fd;
m->handle = (void*)(size_t)fd;
m->handle_is_fd = 1;
m->fh = fh;
m->mh = mh;
@ -401,7 +401,7 @@ static int fmap_readpage(fmap_t *m, unsigned int first_page, unsigned int count,
/* we have some pending reads to perform */
if (m->handle_is_fd) {
unsigned int j;
int _fd = (int)(ssize_t)m->handle;
int _fd = (int)(ptrdiff_t)m->handle;
for(j=first_page; j<page; j++) {
if(fmap_bitmap[j] & FM_MASK_SEEN) {
/* page we've seen before: check mtime */
@ -784,7 +784,7 @@ int fmap_fd(fmap_t *m)
int fd;
if (!m->handle_is_fd)
return -1;
fd = (int)(ssize_t)m->handle;
fd = (int)(ptrdiff_t)m->handle;
lseek(fd, 0, SEEK_SET);
return fd;
}

@ -165,7 +165,7 @@ static inline const void *fmap_need_off_once_len(fmap_t *m, size_t at, size_t le
const void *p;
if(at >= m->len) {
*lenout = 0;
return (void*)0xE0F00000;/* EOF, not read error */
return (void*)(size_t)0xE0F00000;/* EOF, not read error */
}
if(len > m->len - at)
len = m->len - at;

@ -2158,7 +2158,7 @@ inline static int ac_addspecial_add_alt_node(const char *subexpr, uint8_t sigopt
}
newnode->str = s;
newnode->len = strlen(subexpr)/2;
newnode->len = (uint16_t)strlen(subexpr)/2;
newnode->unique = 1;
/* setting nocase match */
@ -2700,7 +2700,7 @@ int cli_ac_addsig(struct cli_matcher *root, const char *virname, const char *hex
return CL_EMALFDB;
}
new->length[0] = strlen(hex ? hex : hexsig) / 2;
new->length[0] = (uint16_t)strlen(hex ? hex : hexsig) / 2;
for(i = 0, j = 0; i < new->length[0]; i++) {
if((new->pattern[i] & CLI_MATCH_METADATA) == CLI_MATCH_SPECIAL) {
new->length[1] += new->special_table[j]->len[0];

@ -229,7 +229,7 @@ int openioc_parse(const char * fname, int fd, struct cl_engine *engine, unsigned
else
iocp++;
ioclen = strlen(fname);
ioclen = (uint16_t)strlen(fname);
if (elems != NULL) {
if (NULL == engine->hm_hdb) {

@ -2148,7 +2148,7 @@ static int cli_loadftm(FILE *fs, struct cl_engine *engine, unsigned int options,
mpool_free(engine->mempool, new);
break;
}
new->length = strlen(tokens[2]) / 2;
new->length = (uint16_t)strlen(tokens[2]) / 2;
new->tname = cli_mpool_strdup(engine->mempool, tokens[3]);
if(!new->tname) {
mpool_free(engine->mempool, new->magic);
@ -4222,10 +4222,10 @@ static int cli_loadpwdb(FILE *fs, struct cl_engine *engine, unsigned int options
if(pwstype == 0) { /* cleartext */
new->passwd = cli_mpool_strdup(engine->mempool, tokens[3]);
new->length = strlen(tokens[3]);
new->length = (uint16_t)strlen(tokens[3]);
} else { /* 1 => hex-encoded */
new->passwd = cli_mpool_hex2str(engine->mempool, tokens[3]);
new->length = strlen(tokens[3]) / 2;
new->length = (uint16_t)strlen(tokens[3]) / 2;
}
if(!new->passwd) {
cli_errmsg("cli_loadpwdb: Can't decode or add new password entry\n");

@ -432,7 +432,7 @@ p_ere_exp(struct parse *p)
count2 = p_count(p);
REQUIRE(count <= count2, REG_BADBR);
} else /* single number with comma */
count2 = INFINITY;
count2 = REGEX_INFINITY;
} else /* just a single number */
count2 = count;
repeat(p, pos, count, count2);
@ -603,7 +603,7 @@ p_simp_re(struct parse *p,
count2 = p_count(p);
REQUIRE(count <= count2, REG_BADBR);
} else /* single number with comma */
count2 = INFINITY;
count2 = REGEX_INFINITY;
} else /* just a single number */
count2 = count;
repeat(p, pos, count, count2);
@ -961,13 +961,13 @@ static void
repeat(struct parse *p,
sopno start, /* operand from here to end of strip */
int from, /* repeated from this number */
int to) /* to this number of times (maybe INFINITY) */
int to) /* to this number of times (maybe REGEX_INFINITY) */
{
sopno finish = HERE();
# define N 2
# define INF 3
# define REP(f, t) ((f)*8 + (t))
# define MAP(n) (((n) <= 1) ? (n) : ((n) == INFINITY) ? INF : N)
# define MAP(n) (((n) <= 1) ? (n) : ((n) == REGEX_INFINITY) ? INF : N)
sopno copy;
if (p->error != 0) /* head off possible runaway recursion */

@ -110,8 +110,8 @@ typedef struct {
char *multis; /* -> char[smulti] ab\0cd\0ef\0\0 */
} cset;
/* note that CHadd and CHsub are unsafe, and CHIN doesn't yield 0/1 */
#define CHadd(cs, c) ((cs)->ptr[(uch)(c)] |= (cs)->mask, (cs)->hash += (c))
#define CHsub(cs, c) ((cs)->ptr[(uch)(c)] &= ~(cs)->mask, (cs)->hash -= (c))
#define CHadd(cs, c) ((cs)->ptr[(uch)(c)] |= (cs)->mask, (cs)->hash += (uch)(c))
#define CHsub(cs, c) ((cs)->ptr[(uch)(c)] &= ~(cs)->mask, (cs)->hash -= (uch)(c))
#define CHIN(cs, c) ((cs)->ptr[(uch)(c)] & (cs)->mask)
#define MCadd(p, cs, cp) mcadd(p, cs, cp) /* cli_regcomp() internal fns */
#define MCsub(p, cs, cp) mcsub(p, cs, cp)

@ -41,7 +41,7 @@
#else
#define DUPMAX 255
#endif
#define INFINITY (DUPMAX + 1)
#define REGEX_INFINITY (DUPMAX + 1)
#define NC (CHAR_MAX - CHAR_MIN + 1)
typedef unsigned char uch;

@ -77,7 +77,7 @@ static void fatal_error(struct regex_matcher* matcher)
}
static inline size_t get_char_at_pos_with_skip(const struct pre_fixup_info* info, const char* buffer, size_t pos)
static inline char get_char_at_pos_with_skip(const struct pre_fixup_info* info, const char* buffer, size_t pos)
{
const char* str;
size_t realpos = 0;
@ -586,7 +586,7 @@ static int add_newsuffix(struct regex_matcher *matcher, struct regex_list *info,
new->mindist = 0;
new->maxdist = 0;
new->offset_min = CLI_OFF_ANY;
new->length[0] = len;
new->length[0] = (uint16_t)len;
new->ch[0] = new->ch[1] |= CLI_MATCH_IGNORE;
if(new->length[0] > root->maxpatlen)

@ -358,7 +358,7 @@ static int build_suffixtree_ascend(struct node *n, struct text_buffer *buf, stru
if(BITMAP_HASSET(n->u.leaf_class_bitmap, i)) {
size_t pos;
pos = buf->pos;
textbuffer_putc(buf, i);
textbuffer_putc(buf, (char)i);
if(build_suffixtree_ascend(n->parent, buf, n, cb, cbdata, regex) < 0)
return CL_EMEM;
buf->pos = pos;

@ -226,11 +226,7 @@ void submit_post(const char *host, const char *port, const char *method, const c
encoded = encode_data(postdata);
if (!(encoded))
return;
#if defined(_WIN32)
snprintf(chunkedlen, sizeof(chunkedlen), "%u", strlen(encoded));
#else
snprintf(chunkedlen, sizeof(chunkedlen), "%zu", strlen(encoded));
#endif
bufsz += sizeof("Content-Type: application/x-www-form-urlencoded\r\n");
bufsz += sizeof("Content-Length: \r\n");
bufsz += strlen(chunkedlen);

@ -1566,7 +1566,7 @@ primary_expression
| _TEXT_STRING_
{
SIZED_STRING* sized_string = $1;
char* string;
char* string = NULL;
#if REAL_YARA
compiler->last_result = yr_arena_write_string(

@ -48,6 +48,10 @@ typedef uint16_t flex_uint16_t;
typedef int32_t flex_int32_t;
typedef uint32_t flex_uint32_t;
#else
#if _MSC_VER
#include <inttypes.h>
#endif
typedef signed char flex_int8_t;
typedef short int flex_int16_t;
typedef int flex_int32_t;

@ -166,7 +166,7 @@ uint32_t rar_crc(uint32_t start_crc, void *addr, uint32_t size)
data = addr;
#if WORDS_BIGENDIAN == 0
while (size > 0 && ((long)data & 7))
while (size > 0 && ((size_t)data & 7))
{
start_crc = crc_tab[(unsigned char)(start_crc^data[0])]^(start_crc>>8);
size--;

@ -26,6 +26,7 @@
#include <netdb.h>
#include <netinet/in.h>
#endif
#include "platform.h"
#include "optparser.h"
/* Maximum filenames under various systems - njh */
#ifndef NAME_MAX /* e.g. Linux */

@ -92,6 +92,7 @@ typedef u_int64_t uint64_t;
#else /* _MSC_VER */
/* Visual C++ doesn't provide standard integer headers, but it does provide
built-in data types. */
#include <stdint.h>
#include <stdlib.h>
#include <stddef.h>
#include <sys/types.h>
@ -109,18 +110,36 @@ typedef unsigned short uint16_t;
typedef signed char int8_t;
typedef unsigned char uint8_t;
typedef signed int ssize_t;
/* Certain compatibility updates to VC++ introduce the `cstdint'
* header, which defines the INT*_C macros. On default installs they
* are absent. */
#ifndef INT8_MAX
#define INT8_MAX 127
#endif
#ifndef INT8_MIN
#define INT8_MIN -128
#endif
#ifndef UINT8_MAX
#define UINT8_MAX 255
#endif
#ifndef INT16_MAX
#define INT16_MAX 32767
#endif
#ifndef INT16_MIN
#define INT16_MIN -32768
#endif
#ifndef UINT16_MAX
#define UINT16_MAX 65535
#endif
#ifndef INT32_MAX
#define INT32_MAX 2147483647
#endif
#ifndef INT32_MIN
#define INT32_MIN -2147483648
#endif
#ifndef UINT32_MAX
#define UINT32_MAX 4294967295U
/* Certain compatibility updates to VC++ introduce the `cstdint'
* header, which defines the INT*_C macros. On default installs they
* are absent. */
#endif
#ifndef INT8_C
# define INT8_C(C) C
#endif

Loading…
Cancel
Save