diff --git a/project/jni/application/android_debug.h b/project/jni/application/android_debug.h new file mode 100644 index 000000000..575da41fb --- /dev/null +++ b/project/jni/application/android_debug.h @@ -0,0 +1,48 @@ +#ifndef __ANDROID_DEBUG_H__ +#define __ANDROID_DEBUG_H__ + +#include + +#ifdef __cplusplus +// Include everything beforehand, so we wont' get compiler eerors because of our #define +#include +#include +#include +#include +#include +#include + +namespace std +{ + class android_cout: public ostringstream + { + public: + android_cout() {} + template + android_cout &operator<<(const T &v) + { + *((ostringstream*)this) << v; + if( this->str().find('\n') != ::std::string::npos ) + { + __android_log_print(ANDROID_LOG_INFO, "SDL-app", "%s", this->str().c_str()); + this->str().clear(); + } + return *this; + } + ~android_cout() + { + __android_log_print(ANDROID_LOG_INFO, "SDL-app", "%s", this->str().c_str()); + this->str().clear(); + } + }; + static const char * android_endl = "\n"; +} +#define cout android_cout() +#define cerr android_cout() +#define endl android_endl + +#endif + +#define printf(...) __android_log_print(ANDROID_LOG_INFO, "SDL-app", __VA_ARGS__) + +#endif diff --git a/project/jni/application/frogatto b/project/jni/application/frogatto index d453a6798..03540e804 160000 --- a/project/jni/application/frogatto +++ b/project/jni/application/frogatto @@ -1 +1 @@ -Subproject commit d453a67986d454ca37dc7990134c08ff58561648 +Subproject commit 03540e8047f2f51fe6192c44af9dd57fb26991c5 diff --git a/readme.txt b/readme.txt index 99f455747..f0ddf09a0 100644 --- a/readme.txt +++ b/readme.txt @@ -193,7 +193,8 @@ int i = (int *) p; // We have garbage inside i now memcpy( &i, p, sizeof(int) ); // The correct way to dereference a non-aligned pointer This compiler flags will catch most obvious errors, you may add them to AppCflags var in settings: --Werror=strict-aliasing -Werror=cast-align -Werror=pointer-arith -Werror=address +-Wstrict-aliasing -Wcast-align -Wpointer-arith -Waddress +Also beware of the NDK - some system headers contain the code that triggers that warnings. The application will automatically get moved to SD-card on Android 2.2 or newer, (or you can install app2sd for older, but rooted phones),