Browse code

Fix warnings.

Török Edvin authored on 2010/10/18 18:22:38
Showing 3 changed files
... ...
@@ -1602,7 +1602,7 @@ static int register_events(cli_events_t *ev)
1602 1602
 
1603 1603
 int cli_bytecode_run(const struct cli_all_bc *bcs, const struct cli_bc *bc, struct cli_bc_ctx *ctx)
1604 1604
 {
1605
-    int ret;
1605
+    int ret = CL_SUCCESS;
1606 1606
     struct cli_bc_inst inst;
1607 1607
     struct cli_bc_func func;
1608 1608
     cli_events_t *jit_ev = NULL, *interp_ev = NULL;
... ...
@@ -1966,7 +1966,7 @@ static int cli_bytecode_prepare_interpreter(struct cli_bc *bc)
1966 1966
 	    uint16_t ty = bcfunc->types[j];
1967 1967
 	    unsigned align;
1968 1968
 	    align = typealign(bc, ty);
1969
-	    assert(typesize(bc, ty));
1969
+	    assert(!ty || typesize(bc, ty));
1970 1970
 	    assert(align);
1971 1971
 	    bcfunc->numBytes  = (bcfunc->numBytes + align-1)&(~(align-1));
1972 1972
 	    map[j] = bcfunc->numBytes;
... ...
@@ -126,7 +126,7 @@ int32_t cli_bcapi_seek(struct cli_bc_ctx* ctx, int32_t pos, uint32_t whence)
126 126
 
127 127
 uint32_t cli_bcapi_debug_print_str(struct cli_bc_ctx *ctx, const uint8_t *str, uint32_t len)
128 128
 {
129
-    cli_event_fastdata(EV, BCEV_DBG_STR, str, strlen(str));
129
+    cli_event_fastdata(EV, BCEV_DBG_STR, str, strlen((const char*)str));
130 130
     cli_dbgmsg("bytecode debug: %s\n", str);
131 131
     return 0;
132 132
 }
... ...
@@ -24,6 +24,9 @@
24 24
 #include "7z/7zCrc.h"
25 25
 #include "str.h"
26 26
 #include <string.h>
27
+#ifndef _WIN32
28
+#include <sys/time.h>
29
+#endif
27 30
 
28 31
 struct cli_event {
29 32
     const char *name;
... ...
@@ -69,6 +72,8 @@ void cli_events_free(cli_events_t *ev)
69 69
 
70 70
 void cli_event_error_oom(cli_events_t *ctx, uint32_t amount)
71 71
 {
72
+    if (!ctx)
73
+	return;
72 74
     ctx->oom_total += amount;
73 75
     ctx->oom_count++;
74 76
     /* amount == 0 means error already reported, just incremenet count */
... ...
@@ -253,7 +258,7 @@ void cli_event_data(cli_events_t *ctx, unsigned id, const void *data, uint32_t l
253 253
 		void *v_data = cli_realloc2(ev->u.v_data, ev->count + len);
254 254
 		if (v_data) {
255 255
 		    ev->u.v_data = v_data;
256
-		    memcpy(v_data + ev->count, data, len);
256
+		    memcpy((char*)v_data + ev->count, data, len);
257 257
 		    ev->count += len;
258 258
 		} else {
259 259
 		    cli_event_error_oom(ctx, ev->count + len);
... ...
@@ -294,10 +299,9 @@ void cli_event_get(cli_events_t* ctx, unsigned id, union ev_val *val, uint32_t *
294 294
 
295 295
 static inline void ev_debug(enum ev_type type, union ev_val *val, uint32_t count)
296 296
 {
297
-    unsigned i;
298 297
     switch (type) {
299 298
 	case ev_string:
300
-	    cli_dbgmsg("\t(%u): %s\n", count, val->v_string, count);
299
+	    cli_dbgmsg("\t(%u): %s\n", count, val->v_string);
301 300
 	    break;
302 301
 	case ev_data:
303 302
 	{
... ...
@@ -333,6 +337,8 @@ static inline const char *evtype(enum ev_type type)
333 333
 	    return "ev_data_int";
334 334
 	case ev_time:
335 335
 	    return "ev_time";
336
+	default:
337
+	    return "";
336 338
     }
337 339
 }
338 340
 
... ...
@@ -442,5 +448,7 @@ int cli_event_diff_all(cli_events_t *ctx1, cli_events_t *ctx2, compare_filter_t
442 442
 
443 443
 int cli_event_errors(cli_events_t *ctx)
444 444
 {
445
+    if (!ctx)
446
+	return 0;
445 447
     return ctx->errors.count + ctx->oom_count;
446 448
 }