diff options
author | IOhannes m zmölnig <zmoelnig@users.sourceforge.net> | 2011-12-21 09:25:31 +0000 |
---|---|---|
committer | IOhannes m zmölnig <zmoelnig@users.sourceforge.net> | 2011-12-21 09:25:31 +0000 |
commit | b57c5df54b482ac26ae1f07bb5f253a6ca34cb1d (patch) | |
tree | 8856364925ead4ae4156dd2feca05cef0e7bc146 /src | |
parent | a1528fc83e8930d056a521031c044f93e5c21969 (diff) |
fixed errors detected by cppcheck
svn path=/trunk/externals/zexy/; revision=15829
Diffstat (limited to 'src')
-rw-r--r-- | src/msgfile.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/msgfile.c b/src/msgfile.c index 06488f0..cf91178 100644 --- a/src/msgfile.c +++ b/src/msgfile.c @@ -106,7 +106,9 @@ static int node_wherearewe(t_msgfile *x) cur = cur->next; } - return (cur->thislist)?counter:-1; + if(cur&&cur->thislist) + return counter; + return -1; } static void write_currentnode(t_msgfile *x, int ac, t_atom *av) @@ -660,16 +662,17 @@ static void msgfile_read2(t_msgfile *x, t_symbol *filename, t_symbol *format) } fil=fopen(filnam, "rb"); - fseek(fil, 0, SEEK_END); if(fil==NULL) { pd_error(x, "could not open '%s'", filnam); return; } + fseek(fil, 0, SEEK_END); length=ftell(fil); fseek(fil, 0, SEEK_SET); if (!(readbuf = t_getbytes(length))) { pd_error(x, "msgfile_read: could not reserve %ld bytes to read into", length); + flose(fil); close(fd); return; } |