Skip to content

Commit 1a87c44

Browse files
committed
Avoid two static analysis warnings
Neither of these issues was of any concern, but they have been fixed to avoid the static analysis warnings. Closes: #445
1 parent 300375e commit 1a87c44

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

src/common.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
** Copyright (C) 1999-2018 Erik de Castro Lopo <erikd@mega-nerd.com>
2+
** Copyright (C) 1999-2019 Erik de Castro Lopo <erikd@mega-nerd.com>
33
**
44
** This program is free software; you can redistribute it and/or modify
55
** it under the terms of the GNU Lesser General Public License as published by
@@ -385,6 +385,9 @@ psf_asciiheader_printf (SF_PRIVATE *psf, const char *format, ...)
385385
int maxlen ;
386386
char *start ;
387387

388+
if (! format)
389+
return ;
390+
388391
maxlen = strlen ((char*) psf->header.ptr) ;
389392
start = ((char*) psf->header.ptr) + maxlen ;
390393
maxlen = psf->header.len - maxlen ;
@@ -558,9 +561,10 @@ psf_binheader_writef (SF_PRIVATE *psf, const char *format, ...)
558561
void *bindata ;
559562
size_t size ;
560563
char c, *strptr ;
561-
int count = 0, trunc_8to4 ;
564+
int count = 0, trunc_8to4 = SF_FALSE ;
562565

563-
trunc_8to4 = SF_FALSE ;
566+
if (! format)
567+
return psf_ftell (psf) ;
564568

565569
va_start (argptr, format) ;
566570

src/gsm610.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
** Copyright (C) 1999-2016 Erik de Castro Lopo <erikd@mega-nerd.com>
2+
** Copyright (C) 1999-2019 Erik de Castro Lopo <erikd@mega-nerd.com>
33
**
44
** This program is free software; you can redistribute it and/or modify
55
** it under the terms of the GNU Lesser General Public License as published by
@@ -568,6 +568,8 @@ gsm610_write_f (SF_PRIVATE *psf, const float *ptr, sf_count_t len)
568568

569569
total += count ;
570570
len -= writecount ;
571+
if (count != writecount)
572+
break ;
571573
} ;
572574
return total ;
573575
} /* gsm610_write_f */

0 commit comments

Comments
 (0)