Fix MinGW compile warnings.

This patch fixes a few compile warnings found with the latest
MinGW compiler.
This commit is contained in:
Cary R 2010-01-27 08:56:38 -08:00 committed by Stephen Williams
parent 7866e92761
commit fefc195540
3 changed files with 24 additions and 4 deletions

View File

@ -236,7 +236,9 @@ static int GetRegistryKey(char *key, char **value)
}
regKeyBuffer[regKeySize] = 0; /* makes sure there is a trailing NULL */
lrv = RegQueryValueEx(hkKey,key,NULL,&regKeyType,regKeyBuffer,&regKeySize);
/* This needs an unsigned char *, but for MinGW the char is signed. */
lrv = RegQueryValueEx(hkKey, key, NULL, &regKeyType,
(unsigned char *) regKeyBuffer, &regKeySize);
if ((lrv != ERROR_SUCCESS) || (regKeyType != REG_SZ) || (!regKeySize)) {
lrv = RegCloseKey(hkKey);
free(regKeyBuffer);
@ -269,7 +271,9 @@ static void SetRegistryKey(char *key, char *value)
&res) != ERROR_SUCCESS)
return;
RegSetValueEx(hkKey,key,0,REG_SZ,value,strlen(value)+1);
/* This needs an unsigned char *, but for MinGW the char is signed. */
RegSetValueEx(hkKey, key, 0, REG_SZ, (unsigned char *) value,
strlen(value)+1);
RegCloseKey(hkKey);
printf("info: storing %s in Windows' registry entry\n",value);

View File

@ -2283,7 +2283,7 @@ bool dll_target::net_const(const NetConst*net)
unsigned idx;
char*bits;
static char*bits_tmp = 0;
static size_t bits_cnt = 0;
static unsigned bits_cnt = 0;
struct ivl_net_const_s *obj = new struct ivl_net_const_s;
@ -2298,7 +2298,7 @@ bool dll_target::net_const(const NetConst*net)
bits = obj->b.bit_;
} else {
if (obj->width_+1 > bits_cnt) {
if (obj->width_ >= bits_cnt) {
bits_tmp = (char*)realloc(bits_tmp, obj->width_+1);
bits_cnt = obj->width_+1;
}

View File

@ -372,18 +372,34 @@ int main(int argc, char*argv[])
}
if (verbose_flag) {
#ifdef __MINGW32__ /* MinGW does not know about z. */
vpi_mcd_printf(1, " ... %8lu functors (net_fun pool=%u bytes)\n",
#else
vpi_mcd_printf(1, " ... %8lu functors (net_fun pool=%zu bytes)\n",
#endif
count_functors, vvp_net_fun_t::heap_total());
vpi_mcd_printf(1, " %8lu logic\n", count_functors_logic);
vpi_mcd_printf(1, " %8lu bufif\n", count_functors_bufif);
vpi_mcd_printf(1, " %8lu resolv\n",count_functors_resolv);
vpi_mcd_printf(1, " %8lu signals\n", count_functors_sig);
#ifdef __MINGW32__ /* MinGW does not know about z. */
vpi_mcd_printf(1, " ... %8lu filters (net_fil pool=%u bytes)\n",
#else
vpi_mcd_printf(1, " ... %8lu filters (net_fil pool=%zu bytes)\n",
#endif
count_filters, vvp_net_fil_t::heap_total());
#ifdef __MINGW32__ /* MinGW does not know about z. */
vpi_mcd_printf(1, " ... %8lu opcodes (%u bytes)\n",
#else
vpi_mcd_printf(1, " ... %8lu opcodes (%zu bytes)\n",
#endif
count_opcodes, size_opcodes);
vpi_mcd_printf(1, " ... %8lu nets\n", count_vpi_nets);
#ifdef __MINGW32__ /* MinGW does not know about z. */
vpi_mcd_printf(1, " ... %8lu vvp_nets (%u bytes)\n",
#else
vpi_mcd_printf(1, " ... %8lu vvp_nets (%zu bytes)\n",
#endif
count_vvp_nets, size_vvp_nets);
vpi_mcd_printf(1, " ... %8lu arrays (%lu words)\n",
count_net_arrays, count_net_array_words);