Skip to content

Instantly share code, notes, and snippets.

@brooss
Created May 29, 2013 22:13
Show Gist options
  • Select an option

  • Save brooss/5674258 to your computer and use it in GitHub Desktop.

Select an option

Save brooss/5674258 to your computer and use it in GitHub Desktop.
mingw32 fixes
---
src/tests/logging_test.c | 10 ++++++++++
tools/png2y4m.c | 4 ++--
tools/y4m2png.c | 2 +-
3 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/src/tests/logging_test.c b/src/tests/logging_test.c
index 40ee116..cbe74eb 100644
--- a/src/tests/logging_test.c
+++ b/src/tests/logging_test.c
@@ -3,6 +3,16 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#ifdef _WIN32
+static void setenv(const char *name, const char *value, int overwrite) {
+ int len = strlen(value)+1+strlen(value)+1;
+ char *str = malloc(len);
+ sprintf(str, "%s=%s", name, value);
+ putenv(str);
+ free(str);
+}
+#endif
+
int emitted = 0;
char tmp_buf[5000];
diff --git a/tools/png2y4m.c b/tools/png2y4m.c
index c8d4213..4967307 100644
--- a/tools/png2y4m.c
+++ b/tools/png2y4m.c
@@ -48,7 +48,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.*/
# include <getopt.h>
# include <unistd.h>
#else
-# include <fnctl.h>
+# include <fcntl.h>
# include <io.h>
# include "getopt.h"
#endif
@@ -139,7 +139,7 @@ int scandir(const char *_dirp,struct dirent ***_namelist,
struct dirent **names;
int nnames;
int cnames;
- d=opendir(dir);
+ d=opendir(_dirp);
if(d==NULL)return -1;
names=NULL;
nnames=cnames=0;
diff --git a/tools/y4m2png.c b/tools/y4m2png.c
index 460ce3b..85562ce 100644
--- a/tools/y4m2png.c
+++ b/tools/y4m2png.c
@@ -43,7 +43,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.*/
#if !defined(_WIN32)
# include <getopt.h>
#else
-# include <fnctl.h>
+# include <fcntl.h>
# include <io.h>
# include "getopt.h"
#endif
--
1.7.3.1.msysgit.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment