[FFmpeg-devel] [PATCH] Fix warnings in decode_significance_x86 and decode_significance_8x8_x86 (in h264_i386.h)
Eli Friedman
eli.friedman
Sun Jun 27 22:33:01 CEST 2010
2010/6/27 M?ns Rullg?rd <mans at mansr.com>:
> Eli Friedman <eli.friedman at gmail.com> writes:
>
>> Patch attached; adds extra casts so gcc doesn't warn about truncating
>> pointers.
>
> Do you mean "implicit conversion of pointer to integer of different size"?
Yes.
>> Someone else should double-check that this is the intent, though;
>> truncating pointers is an unusual operation, although it looks like
>> it's okay in this case.
>>
>> -Eli
>>
>> Index: libavcodec/x86/h264_i386.h
>> ===================================================================
>> --- libavcodec/x86/h264_i386.h ? ? ? ?(revision 23832)
>> +++ libavcodec/x86/h264_i386.h ? ? ? ?(working copy)
>> @@ -38,8 +38,8 @@
>> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? uint8_t *significant_coeff_ctx_base,
>> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? int *index){
>> ? ? ?void *end= significant_coeff_ctx_base + max_coeff - 1;
>> - ? ?int minusstart= -(int)significant_coeff_ctx_base;
>> - ? ?int minusindex= 4-(int)index;
>> + ? ?int minusstart= -(int)(x86_reg)significant_coeff_ctx_base;
>> + ? ?int minusindex= 4-(int)(x86_reg)index;
>> ? ? ?int coeff_count;
>> ? ? ?__asm__ volatile(
>> ? ? ? ? ?"movl "RANGE ? ?"(%3), %%esi ? ? ? ? ? ?\n\t"
>> @@ -91,7 +91,7 @@
>> ?static int decode_significance_8x8_x86(CABACContext *c,
>> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? uint8_t *significant_coeff_ctx_base,
>> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? int *index, const uint8_t *sig_off){
>> - ? ?int minusindex= 4-(int)index;
>> + ? ?int minusindex= 4-(int)(x86_reg)index;
>> ? ? ?int coeff_count;
>> ? ? ?x86_reg last=0;
>> ? ? ?__asm__ volatile(
>
> Double casts are almost always the wrong solution. ?It seems to me
> that casting to intptr_t is the correct solution here.
Okay, second try attached.
-Eli
-------------- next part --------------
Index: libavcodec/x86/h264_i386.h
===================================================================
--- libavcodec/x86/h264_i386.h (revision 23832)
+++ libavcodec/x86/h264_i386.h (working copy)
@@ -38,8 +38,8 @@
uint8_t *significant_coeff_ctx_base,
int *index){
void *end= significant_coeff_ctx_base + max_coeff - 1;
- int minusstart= -(int)significant_coeff_ctx_base;
- int minusindex= 4-(int)index;
+ int minusstart= -(intptr_t)significant_coeff_ctx_base;
+ int minusindex= 4-(intptr_t)index;
int coeff_count;
__asm__ volatile(
"movl "RANGE "(%3), %%esi \n\t"
@@ -91,7 +91,7 @@
static int decode_significance_8x8_x86(CABACContext *c,
uint8_t *significant_coeff_ctx_base,
int *index, const uint8_t *sig_off){
- int minusindex= 4-(int)index;
+ int minusindex= 4-(intptr_t)index;
int coeff_count;
x86_reg last=0;
__asm__ volatile(
More information about the ffmpeg-devel
mailing list