Fix Android warnings

This commit is contained in:
Vinnie Falco
2013-07-31 16:29:34 -07:00
parent 052aee8f97
commit 4c403643b5
4 changed files with 9 additions and 3 deletions

View File

@@ -227,6 +227,7 @@ bool Process::openDocument (const String& fileName, const String& parameters)
{ {
const LocalRef<jstring> t (javaString (fileName)); const LocalRef<jstring> t (javaString (fileName));
android.activity.callVoidMethod (BeastAppActivity.launchURL, t.get()); android.activity.callVoidMethod (BeastAppActivity.launchURL, t.get());
return true;
} }
void File::revealToUser() const void File::revealToUser() const

View File

@@ -23,5 +23,5 @@
void Logger::outputDebugString (const String& text) void Logger::outputDebugString (const String& text)
{ {
__android_log_print (ANDROID_LOG_INFO, "BEAST", text.toUTF8()); __android_log_print (ANDROID_LOG_INFO, "BEAST", "%", text.toUTF8().getAddress());
} }

View File

@@ -121,7 +121,7 @@ static void findIPAddresses (int sock, Array<IPAddress>& result)
cfg.ifc_buf += IFNAMSIZ + cfg.ifc_req->ifr_addr.sa_len; cfg.ifc_buf += IFNAMSIZ + cfg.ifc_req->ifr_addr.sa_len;
} }
#else #else
for (int i = 0; i < cfg.ifc_len / sizeof (struct ifreq); ++i) for (size_t i = 0; i < cfg.ifc_len / sizeof (struct ifreq); ++i)
{ {
const ifreq& item = cfg.ifc_req[i]; const ifreq& item = cfg.ifc_req[i];

View File

@@ -58,10 +58,15 @@ struct CurrentThreadHolder : public SharedObject
static char currentThreadHolderLock [sizeof (SpinLock)]; // (statically initialised to zeros). static char currentThreadHolderLock [sizeof (SpinLock)]; // (statically initialised to zeros).
static SpinLock* castToSpinLockWithoutAliasingWarning (void* s)
{
return static_cast<SpinLock*> (s);
}
static CurrentThreadHolder::Ptr getCurrentThreadHolder() static CurrentThreadHolder::Ptr getCurrentThreadHolder()
{ {
static CurrentThreadHolder::Ptr currentThreadHolder; static CurrentThreadHolder::Ptr currentThreadHolder;
SpinLock::ScopedLockType lock (*reinterpret_cast <SpinLock*> (currentThreadHolderLock)); SpinLock::ScopedLockType lock (*castToSpinLockWithoutAliasingWarning (currentThreadHolderLock));
if (currentThreadHolder == nullptr) if (currentThreadHolder == nullptr)
currentThreadHolder = new CurrentThreadHolder(); currentThreadHolder = new CurrentThreadHolder();