[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Libcdio-devel] [PATCH] libcdio 0.79: cd-paranoia enum comparison bugs
From: |
Eric Shattow |
Subject: |
[Libcdio-devel] [PATCH] libcdio 0.79: cd-paranoia enum comparison bugs |
Date: |
Wed, 16 Jan 2008 23:21:17 -0600 |
In at least gcc 4.2.3 compiler, enums fail the cd-paranoia comparison to
integers.
src/cd-paranoia/cd-paranoia.c:
if(callscript)
fprintf(stderr,"##: %d [%s] @ %ld\n",
- function,(function>=-2&&function<=13?callback_strings[function+2]:
+ function,
+
((int)function>=-2&&(int)function<=13?callback_strings[function+2]:
""),inpos);
The observable problem is that "cd-paranoia -e" output lacks the 2nd data
parameter (read/wrote/verify...)
I suspect that the enum types are promoted to an unsigned integer in the
comparison, and yet signed in the printf use of "%d". Thus, it would always
be "##: 0 [] @ 871416" and never "##: 0 [read] @ 871416". Casting to int
does the trick, but this is potentially a problem throughout the cd-paranoia
code, as enum types are promoted differently than literal values (#define's
which work fine from enum-less xiph cd paranoia code).
I spotted that one above, are there more? How to find them?
Eric
- [Libcdio-devel] [PATCH] libcdio 0.79: cd-paranoia enum comparison bugs,
Eric Shattow <=