[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bug-recutils] Your git repository for recutils
From: |
Michał Masłowski |
Subject: |
Re: [bug-recutils] Your git repository for recutils |
Date: |
Fri, 25 May 2012 19:10:08 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) |
> @@ -120,6 +121,7 @@ rec_parser_new (FILE *in,
> {
> parser->in_file = in;
> parser->in_buffer = NULL;
> + parser->in_size = -1;
>
> size_t is guaranteed to be an unsigned value, and you are assigning -1
> to it. In my opinion a good default value for that field is 0: that is
> actually the size of a not allocated buffer :)
Changed to 0, it's also a good unused value.
> +size_t
> +rec_parser_tell (rec_parser_t parser)
> +{
> + if (parser->in_file)
> + {
> + return ftell (parser->in_file);
> + }
>
> That won't work. ftell returns a signed value. If it is -1 it means
> there was an error. rec_parser_tell returns size_t, which is unsigned.
Changed to use long like ftell does. Fixed similar problems in other
places. The new changes are in the seekable-parsers branch of the
git://elderthing.mtjm.eu/mtjm-recutils.git repo.
pgp2lSGyyA1Li.pgp
Description: PGP signature