diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-09-30 21:53:26 +0200 |
---|---|---|
committer | Reinhard Tartler <siretart@tauware.de> | 2014-03-02 11:42:36 -0500 |
commit | c9f015f1c6887ffcbfef119ea1e4846b800fdfff (patch) | |
tree | 724141336fa79a020e40633d8a695111c8b861bf /tools/qt-faststart.c | |
parent | db6b2ca0b3afe898e8c15176f57b85fdf27cede1 (diff) | |
download | ffmpeg-c9f015f1c6887ffcbfef119ea1e4846b800fdfff.tar.gz |
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>
(cherry picked from commit ea15a9a5d8fa6a71af3101b2af18c4dcac07987f)
Diffstat (limited to 'tools/qt-faststart.c')
-rw-r--r-- | tools/qt-faststart.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/tools/qt-faststart.c b/tools/qt-faststart.c index 88f5b48785..69818be2da 100644 --- a/tools/qt-faststart.c +++ b/tools/qt-faststart.c @@ -37,6 +37,8 @@ #define ftello(x) _ftelli64(x) #endif +#define MIN(a,b) ((a) > (b) ? (b) : (a)) + #define BE_16(x) ((((uint8_t*)(x))[0] << 8) | ((uint8_t*)(x))[1]) #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 */ printf(" copying rest of file...\n"); while (last_offset) { - if (last_offset > COPY_BUFFER_SIZE) - bytes_to_copy = COPY_BUFFER_SIZE; - else - bytes_to_copy = last_offset; + bytes_to_copy = MIN(COPY_BUFFER_SIZE, last_offset); if (fread(copy_buffer, bytes_to_copy, 1, infile) != 1) { perror(argv[1]); |