Experience with 0.15.2

Matthias Andree matthias.andree at gmx.de
Mon Sep 8 18:54:29 CEST 2003


David Relson <relson at osagesoftware.com> writes:

>> 1) In src/datastore.c two casts have been introduced in the loops in
>>    line 157 and line 213. I get the following errors:
>> 
>>       "c.datastore", line 157: Error: objects that have been cast are
>>       not l-values
>>       "c.datastore", line 213: Error: objects that have been cast are
>>       not l-values
>
> Attached is an alternate construct.  Let me know how well it works.
> -    for (dsh->index = 0; dsh->index < dsh->count; (int)dsh->index += 1) {
> +    for (dsh->index = 0; dsh->index < dsh->count; dsh->index++) {
>  	int ret = db_get_dbvalue(dsh, &ex_key, &ex_data);
>  
>  	switch (ret) {
> @@ -210,7 +210,7 @@
>      if (datestamp_tokens || today != 0)
>  	val->date = today;
>  
> -    for (dsh->index = 0; dsh->index < dsh->count; (int)dsh->index += 1) {
> +    for (dsh->index = 0; dsh->index < dsh->count; dsh->index++) {
>  
>  	/* With two wordlists, it's necessary to check index and
>  	** run_type to avoid writing all tokens to both lists. */

The problem is with the data type. We're happily increasing an enum that
is abused as an int, and I got entangled in the subtle differences in
the C ./. C++ cast semantics. We'd better make the dsh->index an int to
end this story.

-- 
Matthias Andree

Encrypt your mail: my GnuPG key ID is 0x052E7D95




More information about the bogofilter-dev mailing list