Commit 82b1a343 authored by John Koleszar's avatar John Koleszar
Browse files

Merge other top-level C code

Change-Id: I0ff77f51595599cc3de5183c6c655fd261e3d925
parent 6ad3b74a
...@@ -52,7 +52,7 @@ int arg_match(struct arg *arg_, const struct arg_def *def, char **argv) { ...@@ -52,7 +52,7 @@ int arg_match(struct arg *arg_, const struct arg_def *def, char **argv) {
arg.val = def->has_val ? arg.argv[1] : NULL; arg.val = def->has_val ? arg.argv[1] : NULL;
arg.argv_step = def->has_val ? 2 : 1; arg.argv_step = def->has_val ? 2 : 1;
} else if (def->long_name) { } else if (def->long_name) {
int name_len = strlen(def->long_name); const size_t name_len = strlen(def->long_name);
if (strlen(arg.argv[0]) >= name_len + 2 if (strlen(arg.argv[0]) >= name_len + 2
&& arg.argv[0][1] == '-' && arg.argv[0][1] == '-'
......
...@@ -9,14 +9,20 @@ ...@@ -9,14 +9,20 @@
*/ */
#include <stdio.h> #include <stdio.h>
#include "tools_common.h" #include "tools_common.h"
#ifdef _WIN32 #if defined(_WIN32) || defined(__OS2__)
#include <io.h> #include <io.h>
#include <fcntl.h> #include <fcntl.h>
#ifdef __OS2__
#define _setmode setmode
#define _fileno fileno
#define _O_BINARY O_BINARY
#endif
#endif #endif
FILE *set_binary_mode(FILE *stream) { FILE *set_binary_mode(FILE *stream) {
(void)stream; (void)stream;
#ifdef _WIN32 #if defined(_WIN32) || defined(__OS2__)
_setmode(_fileno(stream), _O_BINARY); _setmode(_fileno(stream), _O_BINARY);
#endif #endif
return stream; return stream;
......
...@@ -669,7 +669,7 @@ int y4m_input_open(y4m_input *_y4m, FILE *_fin, char *_skip, int _nskip) { ...@@ -669,7 +669,7 @@ int y4m_input_open(y4m_input *_y4m, FILE *_fin, char *_skip, int _nskip) {
buffer[i] = *_skip++; buffer[i] = *_skip++;
_nskip--; _nskip--;
} else { } else {
ret = fread(buffer + i, 1, 1, _fin); ret = (int)fread(buffer + i, 1, 1, _fin);
if (ret < 1)return -1; if (ret < 1)return -1;
} }
if (buffer[i] == '\n')break; if (buffer[i] == '\n')break;
...@@ -815,7 +815,7 @@ int y4m_input_fetch_frame(y4m_input *_y4m, FILE *_fin, vpx_image_t *_img) { ...@@ -815,7 +815,7 @@ int y4m_input_fetch_frame(y4m_input *_y4m, FILE *_fin, vpx_image_t *_img) {
int c_sz; int c_sz;
int ret; int ret;
/*Read and skip the frame header.*/ /*Read and skip the frame header.*/
ret = fread(frame, 1, 6, _fin); ret = (int)fread(frame, 1, 6, _fin);
if (ret < 6)return 0; if (ret < 6)return 0;
if (memcmp(frame, "FRAME", 5)) { if (memcmp(frame, "FRAME", 5)) {
fprintf(stderr, "Loss of framing in Y4M input data\n"); fprintf(stderr, "Loss of framing in Y4M input data\n");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment