mirror of https://git.ffmpeg.org/ffmpeg.git
qt-faststart: Simplify code by using a MIN() macro
qt-faststart doesn't use the normal libav headers at all since it's supposed to be a completely standalone tool, so we implement the macro locally in this file. Signed-off-by: Martin Storsjö <martin@martin.st>
This commit is contained in:
parent
3cbc7ef3d6
commit
ea15a9a5d8
|
@ -37,6 +37,8 @@
|
||||||
#define ftello(x) _ftelli64(x)
|
#define ftello(x) _ftelli64(x)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define MIN(a,b) ((a) > (b) ? (b) : (a))
|
||||||
|
|
||||||
#define BE_16(x) ((((uint8_t*)(x))[0] << 8) | ((uint8_t*)(x))[1])
|
#define BE_16(x) ((((uint8_t*)(x))[0] << 8) | ((uint8_t*)(x))[1])
|
||||||
|
|
||||||
#define BE_32(x) ((((uint8_t*)(x))[0] << 24) | \
|
#define BE_32(x) ((((uint8_t*)(x))[0] << 24) | \
|
||||||
|
@ -295,10 +297,7 @@ int main(int argc, char *argv[])
|
||||||
/* copy the remainder of the infile, from offset 0 -> last_offset - 1 */
|
/* copy the remainder of the infile, from offset 0 -> last_offset - 1 */
|
||||||
printf(" copying rest of file...\n");
|
printf(" copying rest of file...\n");
|
||||||
while (last_offset) {
|
while (last_offset) {
|
||||||
if (last_offset > COPY_BUFFER_SIZE)
|
bytes_to_copy = MIN(COPY_BUFFER_SIZE, last_offset);
|
||||||
bytes_to_copy = COPY_BUFFER_SIZE;
|
|
||||||
else
|
|
||||||
bytes_to_copy = last_offset;
|
|
||||||
|
|
||||||
if (fread(copy_buffer, bytes_to_copy, 1, infile) != 1) {
|
if (fread(copy_buffer, bytes_to_copy, 1, infile) != 1) {
|
||||||
perror(argv[1]);
|
perror(argv[1]);
|
||||||
|
|
Loading…
Reference in New Issue