Fix a few cppcheck warnings.

This commit is contained in:
Cary R 2014-06-27 18:39:06 -07:00
parent e82bafcb84
commit 0728690df2
2 changed files with 8 additions and 8 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999-2013 Stephen Williams (steve@icarus.com)
* Copyright (c) 1999-2014 Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
@ -690,7 +690,7 @@ static unsigned int get_format_char(char **rtn, int ljust, int plus,
vpi_printf("WARNING: %s:%d: incompatible value for %s%s.\n",
info->filename, info->lineno, info->name, fmtb);
} else {
PLI_INT32 veclen, word, byte, bits;
PLI_INT32 veclen, word, byte;
char *cp;
veclen = (vpi_get(vpiSize, info->items[*idx])+31)/32;
@ -699,7 +699,7 @@ static unsigned int get_format_char(char **rtn, int ljust, int plus,
if (size > ini_size) result = realloc(result, size*sizeof(char));
cp = result;
for (word = 0; word < veclen; word += 1) {
bits = value.value.vector[word].aval &
PLI_INT32 bits = value.value.vector[word].aval &
~value.value.vector[word].bval;
#ifdef WORDS_BIGENDIAN
for (byte = 3; byte >= 0; byte -= 1) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2011-2012 Cary R. (cygcary@yahoo.com)
* Copyright (C) 2011-2014 Cary R. (cygcary@yahoo.com)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -433,7 +433,7 @@ static uint64_t get_average_wait_time(int64_t idx)
uint64_t high = base[idx].wait_time_high;
uint64_t low = base[idx].wait_time_low;
s_vpi_time cur_time;
uint64_t c_time, add_time;
uint64_t c_time;
/* Get the current simulation time. */
cur_time.type = vpiSimTime;
@ -445,7 +445,7 @@ static uint64_t get_average_wait_time(int64_t idx)
/* For each element still in the queue, add its wait time to the
* total wait time. */
for (count = 0; count < elems; count += 1) {
add_time = base[idx].queue[loc].time;
uint64_t add_time = base[idx].queue[loc].time;
assert(c_time >= add_time);
add_to_wait_time(&high, &low, c_time-add_time);
@ -720,7 +720,7 @@ static PLI_INT32 fill_variable_with_scaled_time(vpiHandle var, uint64_t c_time)
uint64_t max_val = 0;
uint64_t scale = 1;
uint64_t frac;
PLI_INT32 rtn, idx, units, prec;
PLI_INT32 rtn, units, prec;
p_vpi_vecval val_ptr = (p_vpi_vecval) malloc(words*sizeof(s_vpi_vecval));
assert(val_ptr);
@ -773,7 +773,7 @@ static PLI_INT32 fill_variable_with_scaled_time(vpiHandle var, uint64_t c_time)
rtn = IVL_QUEUE_VALUE_OVERFLOWED;
} else {
/* Fill the vector with 0. */
for (idx = 0; idx < words; idx += 1) {
for (PLI_INT32 idx = 0; idx < words; idx += 1) {
val_ptr[idx].aval = 0x00000000;
val_ptr[idx].bval = 0x00000000;
}