[asterisk-dev] Silly bug in format_sln

Denis Smirnov ds at seiros.ru
Sun Feb 19 11:41:40 MST 2006


bug #6539 looks very strange.

If I can trust linux manpages, fseek don't return offset or position, this
function can return only success/not success (0/-1).

Looking at format_sln I see, that return of fseek divided by 2 (that
can be correct for return of ftell).

All other formats (e.g. format_gsm or format_wav) use code identical with
my.

I don't know why Cordyon76 needs to divide 0 by two. 

See _my_ patch, that was ignored by Corsyon76 (who closed my bug):

--- format_sln.c	(revision 10486)
+++ format_sln.c	(working copy)
@@ -190,12 +190,7 @@
 	}
 	/* always protect against seeking past begining. */
 	offset = (offset < min)?min:offset;
-	res = fseek(fs->f, offset, SEEK_SET);
-	/* Negative values indicate error */
-	if (res > -1)
-		return res / 2;
-	else
-		return res;
+	return fseek(fs->f, offset, SEEK_SET);
 }
 
 static int slinear_trunc(struct ast_filestream *fs)

-- 
JID: ds at im.seiros.ru
ICQ: 58417635 (please, use jabber, if you can)

http://freesource.info/




More information about the asterisk-dev mailing list