Skip to content

Instantly share code, notes, and snippets.

@alecmce
Created August 18, 2013 21:40
Show Gist options
  • Save alecmce/6264140 to your computer and use it in GitHub Desktop.
Save alecmce/6264140 to your computer and use it in GitHub Desktop.
I'm having problems running HXCPP (https://code.google.com/p/hxcpp/) dependent haxe IOS builds on Mac OS X "Mavericks" (XCode5-DP2 installed, running openfl-tools 1.0.8, so using G++). NULL references have to be removed. This diff removes all the build-breaking errors, though it's a big hacky guess.
Index: src/Math.cpp
===================================================================
--- src/Math.cpp (revision 748)
+++ src/Math.cpp (working copy)
@@ -133,7 +133,8 @@
#else
int pid = getpid();
struct timeval tv;
- gettimeofday(&tv,NULL);
+ struct timezone dummy;
+ gettimeofday(&tv,&dummy);
t = tv.tv_sec * 1000000 + tv.tv_usec;
#endif
Index: src/hx/Date.cpp
===================================================================
--- src/hx/Date.cpp (revision 748)
+++ src/hx/Date.cpp (working copy)
@@ -89,7 +89,7 @@
}
double __hxcpp_date_now()
{
- time_t t = time(NULL);
+ time_t t = time(0);
return t;
}
String __hxcpp_to_string(double inSeconds)
Index: src/hx/StdLibs.cpp
===================================================================
--- src/hx/StdLibs.cpp (revision 748)
+++ src/hx/StdLibs.cpp (working copy)
@@ -144,9 +144,9 @@
// }
// #endif
- setbuf(stdin, NULL);
- setbuf(stdout, NULL);
- setbuf(stderr, NULL);
+ setbuf(stdin, null());
+ setbuf(stdout, null());
+ setbuf(stderr, null());
}
void __trace(Dynamic inObj, Dynamic inData)
@@ -195,7 +195,8 @@
return (double)clock() / ( (double)CLOCKS_PER_SEC);
#else
struct timeval tv;
- if( gettimeofday(&tv,NULL) )
+ struct timezone dummy;
+ if( gettimeofday(&tv,&dummy) )
throw Dynamic("Could not get time");
double t = ( tv.tv_sec + ((double)tv.tv_usec) / 1000000.0 );
if (t0==0) t0 = t;
Index: src/hx/Thread.cpp
===================================================================
--- src/hx/Thread.cpp (revision 748)
+++ src/hx/Thread.cpp (working copy)
@@ -466,7 +466,8 @@
double Now()
{
struct timeval tv;
- gettimeofday(&tv,NULL);
+ struct timezone dummy;
+ gettimeofday(&tv,&dummy);
return tv.tv_sec + tv.tv_usec*0.000001;
}
#endif
@@ -551,7 +552,7 @@
// Can't allow GetCurrentInfo() to create the main thread's info
// because that can cause a call loop.
hxThreadInfo *threadInfo = GetCurrentInfo(false);
- if (threadInfo == NULL) {
+ if (!threadInfo) {
return 0;
}
return threadInfo->GetThreadNumber();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment