OSDN Git Service

qt-faststart: Avoid unintentionally sign extending BE_32
authorMartin Storsjö <martin@martin.st>
Fri, 28 Feb 2014 10:19:49 +0000 (12:19 +0200)
committerMartin Storsjö <martin@martin.st>
Fri, 28 Feb 2014 22:25:08 +0000 (00:25 +0200)
commitea7f79f93796d68559a495be824b6bbd94dfe5f6
tree4d821337c64fa8e79a3887383e24fa420287a225
parentbb95334c34d0d9abccea370ae25c4765d7764ab8
qt-faststart: Avoid unintentionally sign extending BE_32

Without this cast, the BE_32() expression is sign extended when
assigned to an uint64_t, since the uint8_t|uint8_t expression
is promoted to an int.

Also avoid undefined behaviour when left shifting an uint8_t
by 24 by casting it to an uint32_t explicitly before shifting.

Based on a patch by Michael Niedermayer.

Signed-off-by: Martin Storsjö <martin@martin.st>
tools/qt-faststart.c