ref: e3578af32c506b209c3ca460e999d6ce6249a551
parent: 96a381c25541dceed788b5b62245bab8e74f4ae9
author: James Zern <[email protected]>
date: Thu Apr 17 06:47:08 EDT 2014
examples: remove off_t overrides this is error prone, int64 will suffice for all cases Change-Id: I94883f93518cfc356ed57b14dc39d79aebccf47d
--- a/tools_common.h
+++ b/tools_common.h
@@ -25,15 +25,10 @@
/* MSVS uses _f{seek,tell}i64. */
#define fseeko _fseeki64
#define ftello _ftelli64
-typedef long _off_t; // NOLINT - MSVS compatible type
-typedef __int64 off_t; // fseeki64 compatible type
-#define _OFF_T_DEFINED
#elif defined(_WIN32)
-/* MinGW defines off_t as long and uses f{seek,tell}o64/off64_t for large
- * files. */
+/* MinGW uses f{seek,tell}o64 for large files. */
#define fseeko fseeko64
#define ftello ftello64
-#define off_t off64_t
#endif /* _WIN32 */
#if CONFIG_OS_SUPPORT
@@ -50,7 +45,6 @@
/* Use 32-bit file operations in WebM file format when building ARM
* executables (.axf) with RVCT. */
#if !CONFIG_OS_SUPPORT
-typedef long off_t; /* NOLINT */
#define fseeko fseek
#define ftello ftell
#endif /* CONFIG_OS_SUPPORT */
@@ -90,7 +84,7 @@
struct VpxInputContext {
const char *filename;
FILE *file;
- off_t length;
+ int64_t length;
struct FileTypeDetectionBuffer detect;
enum VideoFileType file_type;
uint32_t width;
--- a/vpxenc.c
+++ b/vpxenc.c
@@ -1281,7 +1281,7 @@
*got_data = 0;
while ((pkt = vpx_codec_get_cx_data(&stream->encoder, &iter))) {
static size_t fsize = 0;
- static off_t ivf_header_pos = 0;
+ static int64_t ivf_header_pos = 0;
switch (pkt->kind) {
case VPX_CODEC_CX_FRAME_PKT:
@@ -1307,7 +1307,7 @@
fsize += pkt->data.frame.sz;
if (!(pkt->data.frame.flags & VPX_FRAME_IS_FRAGMENT)) {
- off_t currpos = ftello(stream->file);
+ const int64_t currpos = ftello(stream->file);
fseeko(stream->file, ivf_header_pos, SEEK_SET);
ivf_write_frame_size(stream->file, fsize);
fseeko(stream->file, currpos, SEEK_SET);
@@ -1534,7 +1534,7 @@
int frames_in = 0, seen_frames = 0;
int64_t estimated_time_left = -1;
int64_t average_rate = -1;
- off_t lagged_count = 0;
+ int64_t lagged_count = 0;
open_input_file(&input);
@@ -1667,15 +1667,15 @@
int64_t rate;
if (global.limit) {
- off_t frame_in_lagged = (seen_frames - lagged_count) * 1000;
+ const int64_t frame_in_lagged = (seen_frames - lagged_count) * 1000;
rate = cx_time ? frame_in_lagged * (int64_t)1000000 / cx_time : 0;
remaining = 1000 * (global.limit - global.skip_frames
- seen_frames + lagged_count);
} else {
- off_t input_pos = ftello(input.file);
- off_t input_pos_lagged = input_pos - lagged_count;
- int64_t limit = input.length;
+ const int64_t input_pos = ftello(input.file);
+ const int64_t input_pos_lagged = input_pos - lagged_count;
+ const int64_t limit = input.length;
rate = cx_time ? input_pos_lagged * (int64_t)1000000 / cx_time : 0;
remaining = limit - input_pos + lagged_count;