1
0
mirror of https://github.com/moparisthebest/hexchat synced 2024-11-28 20:22:15 -05:00

Fix a few cppcheck warnings.

Use the proper data type in format functions and fix a resource leak.
This commit is contained in:
XhmikosR 2013-10-10 00:05:22 -04:00 committed by TingPing
parent e244001cee
commit c226f4089a
5 changed files with 9 additions and 8 deletions

View File

@ -244,6 +244,7 @@ struct tagInfo readID3V2(char *file){
for (i=0;i<10;i++){
c=fgetc(f);
if (c==EOF){
fclose(f);
//putlog("found eof while reading id3v2");
return ret;
}

View File

@ -77,7 +77,7 @@ struct tagInfo getOggHeader(char *file){
info.bitrate=nomBr;
if (((maxBr==nomBr)&&(nomBr=minBr))||((minBr==0)&&(maxBr==0))||((minBr=-1)&&(maxBr=-1)) )info.cbr=1;else info.cbr=0;
printf("bitrates: %i|%i|%i\n",maxBr,nomBr,minBr);
printf("freq: %i\n",info.freq);
printf("freq: %u\n",info.freq);
pos=h3pos+7;
pos+=getOggInt(header,pos,4)+4;
count=getOggInt(header,pos,4);

View File

@ -140,11 +140,11 @@ print_summary (int announce, char* format)
if (giga)
{
snprintf (buffer, bsize, "%d x %s (%s) @ %.2fGHz", count, cpu_model, cpu_vendor, cpu_freq);
snprintf (buffer, bsize, "%u x %s (%s) @ %.2fGHz", count, cpu_model, cpu_vendor, cpu_freq);
}
else
{
snprintf (buffer, bsize, "%d x %s (%s) @ %.0fMHz", count, cpu_model, cpu_vendor, cpu_freq);
snprintf (buffer, bsize, "%u x %s (%s) @ %.0fMHz", count, cpu_model, cpu_vendor, cpu_freq);
}
format_output ("CPU", buffer, format);
@ -332,11 +332,11 @@ print_cpu (int announce, char* format)
if (giga)
{
snprintf (buffer, bsize, "%d x %s (%s) @ %.2fGHz w/ %s L2 Cache", count, model, vendor, freq, cache);
snprintf (buffer, bsize, "%u x %s (%s) @ %.2fGHz w/ %s L2 Cache", count, model, vendor, freq, cache);
}
else
{
snprintf (buffer, bsize, "%d x %s (%s) @ %.0fMHz w/ %s L2 Cache", count, model, vendor, freq, cache);
snprintf (buffer, bsize, "%u x %s (%s) @ %.0fMHz w/ %s L2 Cache", count, model, vendor, freq, cache);
}
format_output ("CPU", buffer, format);

View File

@ -322,7 +322,7 @@ ignore_save ()
ig = (struct ignore *) temp->data;
if (!(ig->type & IG_NOSAVE))
{
snprintf (buf, sizeof (buf), "mask = %s\ntype = %d\n\n",
snprintf (buf, sizeof (buf), "mask = %s\ntype = %u\n\n",
ig->mask, ig->type);
write (fh, buf, strlen (buf));
}

View File

@ -72,7 +72,7 @@ send_msprequest(s, state, request, end)
if ((w = send(s, request, l, 0)) != l) {
#ifdef DEBUG_MSPROXY
printf ("send_msprequest(): send() failed (%d bytes sent instead of %d\n", w, l);
printf ("send_msprequest(): send() failed (%ld bytes sent instead of %Iu\n", w, l);
perror ("Error is");
#endif
return -1;
@ -93,7 +93,7 @@ recv_mspresponse(s, state, response)
do {
if ((r = recv (s, response, sizeof (*response), 0)) < MSPROXY_MINLENGTH) {
#ifdef DEBUG_MSPROXY
printf ("recv_mspresponse(): expected to read atleast %d, read %d\n", MSPROXY_MINLENGTH, r);
printf ("recv_mspresponse(): expected to read atleast %d, read %ld\n", MSPROXY_MINLENGTH, r);
#endif
return -1;
}