Skip to content

Commit

Permalink
Set file mode to binary on Windows.
Browse files Browse the repository at this point in the history
  • Loading branch information
lecram committed Sep 20, 2020
1 parent 5209d07 commit 54ab6c8
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions gifdec.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#ifdef _WIN32
#include <io.h>
#else
#include <unistd.h>
#endif

#define MIN(A, B) ((A) < (B) ? (A) : (B))
#define MAX(A, B) ((A) > (B) ? (A) : (B))
Expand Down Expand Up @@ -47,6 +51,9 @@ gd_open_gif(const char *fname)

fd = open(fname, O_RDONLY);
if (fd == -1) return NULL;
#ifdef _WIN32
setmode(fd, O_BINARY);
#endif
/* Header */
read(fd, sigver, 3);
if (memcmp(sigver, "GIF", 3) != 0) {
Expand Down

0 comments on commit 54ab6c8

Please sign in to comment.