[linux-dvb] Problems with ca_zap
Manu Abraham
manu at kromtek.com
Fri Jun 24 19:09:54 CEST 2005
Johannes Stezenbach wrote:
> Manu Abraham wrote:
>>Allan Stirling wrote:
>>> p_program_descriptor->program_number =
>>> ((p_program_descriptor->program_number | buf[pos + 0]) << 8) | buf[pos + 1];
>>>
>>>Doesn't look quite right. Why do we care what the program_number is
>>>before it's been parsed?
>>Hmm, that is required because buf is 8 bits. All what i do is, get buf
>>into program_number and shift program_number to the left by 8.
>>
>>>If I change this to
>>>
>>> p_program_descriptor->program_number =
>>> ( buf[pos + 0] << 8) | buf[pos + 1];
>>>
>>This would be wrong however, since if you left shift an 8 bit buffer by
>>8 all you will get is 0.
>>
>>The problem would be solved, if program_number is initialized to 0 just
>>before reading in from the buffer.
>
> It still would be hard to read. How about:
>
> p_program_descriptor->program_number =
> ((uint16_t) buf[pos] << 8) | buf[pos + 1];
>
Ah, you mean in libdvbsi .. Okay .. I thought the reference was to
dst_ca.c .. I will change that one ..
Thanks,
Manu
More information about the linux-dvb
mailing list