* Fix some issues reported by cppcheck.

This commit is contained in:
Justin Maggard
2011-05-02 23:50:52 +00:00
parent e0e0fa254d
commit 9a9270cecf
18 changed files with 298 additions and 282 deletions

View File

@ -310,9 +310,7 @@ _asf_load_picture(FILE *fp, int size, void *bm, int *bm_size)
{
int i;
char buf[256];
char pic_type;
long pic_size;
#if 0
//
// Picture type $xx
// Data length $xx $xx $xx $xx
@ -320,9 +318,15 @@ _asf_load_picture(FILE *fp, int size, void *bm, int *bm_size)
// Description <text string> $00
// Picture data <binary data>
char pic_type;
long pic_size;
pic_type = fget_byte(fp); size -= 1;
pic_size = fget_le32(fp); size -= 4;
#else
fseek(fp, 5, SEEK_CUR);
size -= 5;
#endif
for(i = 0; i < sizeof(buf) - 1; i++)
{
buf[i] = fget_le16(fp); size -= 2;
@ -388,7 +392,6 @@ _get_asffileinfo(char *file, struct song_metadata *psong)
asf_object_t hdr;
asf_object_t tmp;
unsigned long NumObjects;
unsigned short Reserved;
unsigned short TitleLength;
unsigned short AuthorLength;
unsigned short CopyrightLength;
@ -400,7 +403,6 @@ _get_asffileinfo(char *file, struct song_metadata *psong)
unsigned short ValueLength;
off_t pos;
char buf[2048];
int mask;
asf_file_properties_t FileProperties;
psong->vbr_scale = -1;
@ -426,10 +428,9 @@ _get_asffileinfo(char *file, struct song_metadata *psong)
return -1;
}
NumObjects = fget_le32(fp);
Reserved = fget_le16(fp);
fseek(fp, 2, SEEK_CUR); // Reserved le16
pos = ftell(fp);
mask = 0;
while(NumObjects > 0)
{
if(sizeof(tmp) != fread(&tmp, 1, sizeof(tmp), fp))

View File

@ -25,7 +25,6 @@ _get_flctags(char *filename, struct song_metadata *psong)
{
FLAC__Metadata_SimpleIterator *iterator = 0;
FLAC__StreamMetadata *block;
int block_number;
unsigned int sec, ms;
int i;
int err = 0;
@ -36,7 +35,6 @@ _get_flctags(char *filename, struct song_metadata *psong)
return -1;
}
block_number = 0;
if(!FLAC__metadata_simple_iterator_init(iterator, filename, true, true))
{
DPRINTF(E_ERROR, L_SCANNER, "Cannot extract tag from %s\n", filename);

View File

@ -196,7 +196,6 @@ static void
_ogg_vorbis_end(ogg_stream_processor *stream, struct song_metadata *psong)
{
ogg_misc_vorbis_info *inf = stream->data;
long minutes, seconds;
double bitrate, time;
time = (double)inf->lastgranulepos / inf->vi.rate;
@ -211,9 +210,6 @@ _ogg_vorbis_end(ogg_stream_processor *stream, struct song_metadata *psong)
psong->song_length = time * 1000;
}
minutes = (long)time / 60;
seconds = (long)time - minutes * 60;
vorbis_comment_clear(&inf->vc);
vorbis_info_clear(&inf->vi);
@ -307,7 +303,7 @@ static ogg_stream_processor *
_ogg_find_stream_processor(ogg_stream_set *set, ogg_page *page)
{
ogg_uint32_t serial = ogg_page_serialno(page);
int i, found = 0;
int i;
int invalid = 0;
int constraint = 0;
ogg_stream_processor *stream;
@ -316,7 +312,6 @@ _ogg_find_stream_processor(ogg_stream_set *set, ogg_page *page)
{
if(serial == set->streams[i].serial)
{
found = 1;
stream = &(set->streams[i]);
set->in_headers = 0;

View File

@ -289,6 +289,7 @@ fetch_string_txt(char *fname, char *lang, int n, ...)
if (!*strs[i])
*strs[i] = defstr[i];
}
fclose(fp);
_exit:
free(keys);