On 02/23/2012 02:24 PM, Alex Converse wrote:

> On Thu, Feb 23, 2012 at 11:12 AM, Justin Ruggles
> <[email protected]> wrote:
>> On 02/23/2012 01:56 PM, Alex Converse wrote:
>>
>>> TIFF v6.0 (unimplemented) adds signed equivalents.
>>> ---
>>>  libavcodec/tiff.c |   18 +++++++++---------
>>>  1 files changed, 9 insertions(+), 9 deletions(-)
>>>
>>> diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c
>>> index a88d0f9..51ebd69 100644
>>> --- a/libavcodec/tiff.c
>>> +++ b/libavcodec/tiff.c
>>> @@ -59,24 +59,24 @@ typedef struct TiffContext {
>>>      LZWState *lzw;
>>>  } TiffContext;
>>>
>>> -static int tget_short(const uint8_t **p, int le){
>>> -    int v = le ? AV_RL16(*p) : AV_RB16(*p);
>>> +static unsigned tget_short(const uint8_t **p, int le) {
>>> +    unsigned v = le ? AV_RL16(*p) : AV_RB16(*p);
>>>      *p += 2;
>>>      return v;
>>>  }
>>>
>>> -static int tget_long(const uint8_t **p, int le){
>>> -    int v = le ? AV_RL32(*p) : AV_RB32(*p);
>>> +static unsigned tget_long(const uint8_t **p, int le) {
>>> +    unsigned v = le ? AV_RL32(*p) : AV_RB32(*p);
>>>      *p += 4;
>>>      return v;
>>>  }
>>>
>>> -static int tget(const uint8_t **p, int type, int le){
>>> +static unsigned tget(const uint8_t **p, int type, int le) {
>>>      switch(type){
>>>      case TIFF_BYTE : return *(*p)++;
>>>      case TIFF_SHORT: return tget_short(p, le);
>>>      case TIFF_LONG : return tget_long (p, le);
>>> -    default        : return -1;
>>> +    default        : return UINT_MAX;
>>>      }
>>>  }
>>
>>
>> I know it's quite unlikely, but UINT_MAX is a valid value. Maybe we
>> should use int64_t as the return type and use INT64_MIN as the "unknown"
>> value just for spec-correctness sake.
>>
> 
> There is nor a single place where we check if tget() returns
> UINT_MAX/-1 as a proxy for checking if it failed.
> 
> I'm pretty sure that line is just there to make sure the function
> always returns a value.


true. patch looks ok then.

-Justin
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to