Browse Source

Fix Android Studio compiler warnings

Changed string termination to '\0' (NUL) char constant.
Changed assigning non-pointer variables from NULL to 0.
Commented out assign a Vector non-pointer object to NULL.
Changed returning NULL to 0 for integer typed script binded functions.
Removed unknown '\p' escape sequence.
Workaround applied to strange initialization of U32 variables with multi-char constants.
dottools 9 years ago
parent
commit
1b2714ffd6

+ 1 - 1
engine/source/audio/audio.cc

@@ -733,7 +733,7 @@ AUDIOHANDLE alxCreateSource(const Audio::Description& desc,
          if (streamSource)
          {
             streamSource->mHandle = getNewHandle() | AUDIOHANDLE_STREAMING_BIT | AUDIOHANDLE_INACTIVE_BIT;
-            streamSource->mSource = NULL;
+            streamSource->mSource = 0;
             streamSource->mDescription = desc;
             streamSource->mScore = volume;
             streamSource->mEnvironment = sampleEnvironment;

+ 1 - 1
engine/source/audio/vorbisStreamSource.cc

@@ -81,7 +81,7 @@ void VorbisStreamSource::clear()
       freeStream();
 
    mHandle           = NULL_AUDIOHANDLE;
-   mSource           = NULL;
+   mSource           = 0;
 
    if(mBufferList[0] != 0)
       alDeleteBuffers(NUMBUFFERS, mBufferList);

+ 1 - 1
engine/source/audio/wavStreamSource.cc

@@ -128,7 +128,7 @@ void WavStreamSource::clear()
         freeStream();
 
     mHandle           = NULL_AUDIOHANDLE;
-    mSource			  = NULL;
+    mSource			  = 0;
 
     if(mBufferList[0] != 0)
         alDeleteBuffers(NUMBUFFERS, mBufferList);

+ 1 - 1
engine/source/collection/nameTags_ScriptBinding.h

@@ -80,7 +80,7 @@ ConsoleMethodWithDocs(NameTags, deleteTag, ConsoleInt, 3, 3, (tagId))
     if ( tagId == 0 )
     {
         Con::warnf("Invalid tag Id.\n");
-        return NULL;
+        return 0;
     }
 
     return object->deleteTag( tagId );

+ 1 - 1
engine/source/delegates/delegateSignal.h

@@ -54,7 +54,7 @@ public:
    {
       mList.next = mList.prev = &mList;
       mList.order = 0.5f;
-      mTriggerNext = NULL;
+      //mTriggerNext = NULL;
    }
 
    ~SignalBase();

+ 1 - 1
engine/source/gui/guiCanvas_ScriptBinding.h

@@ -256,7 +256,7 @@ ConsoleMethodWithDocs( GuiCanvas, getMouseControl, ConsoleInt, 2, 2, ())
    if (control)
       return control->getId();
    
-   return NULL;
+   return 0;
 }
 
 //-----------------------------------------------------------------------------

+ 1 - 1
engine/source/persistence/taml/json/tamlJSONReader.cc

@@ -45,7 +45,7 @@ SimObject* TamlJSONReader::read( FileStream& stream )
         Con::warnf("TamlJSONReader::read() -  Could not load Taml JSON file from stream.");
         return NULL;
     }
-    jsonText[streamSize] = NULL;
+    jsonText[streamSize] = '\0';
 
     // Create JSON document.
     rapidjson::Document document;

+ 3 - 3
engine/source/platformAndroid/AndroidEvents.h

@@ -54,7 +54,7 @@ bool AndroidHandleMenuCommand(void* hiCommand);
 void AndroidSendTorqueEventToMain( U32 eventKind, void* userData = NULL );
 
 /// event type for alerts. The event class is an arbitrary val, it must not collide w/ kEventApp* .
-const U32 kEventClassTorque   = 'TORQ';
+const U32 kEventClassTorque   = ('T' * 0x1000000 + 'O' * 0x10000 + 'R' * 0x100 + 'Q'); //'TORQ';
 const U32 kEventTorqueAlert   = 1;
 const U32 kEventTorqueFadeInWindow = 2;
 const U32 kEventTorqueFadeOutWindow = 3;
@@ -63,7 +63,7 @@ const U32 kEventTorqueShowMenuBar = 5;
 const U32 kEventTorqueModalDialog = 6;
 const U32 kEventTorqueDrawMenuBar = 7;
 
-const U32 kEventParamTorqueData           = 'tDAT'; // typeVoidPtr void*
+const U32 kEventParamTorqueData           = ('t' * 0x1000000 + 'D' * 0x10000 + 'A' * 0x100 + 'T'); //'tDAT'; // typeVoidPtr void*
 //const U32 kEventParamTorqueSemaphorePtr   = 'tSEM'; // typeVoidPtr void*
 //const U32 kEventParamTorqueDialogRef      = 'tDRF'; // typeDialogRef DialogRef
 //const U32 kEventParamTorqueHitPtr         = 'tHIT'; // typeVoidPtr U32*
@@ -71,6 +71,6 @@ const U32 kEventParamTorqueData           = 'tDAT'; // typeVoidPtr void*
 
 
 // this command id is used for all dynamically created menus.
-const U32 kHICommandTorque = 'TORQ';
+const U32 kHICommandTorque = ('T' * 0x1000000 + 'O' * 0x10000 + 'R' * 0x100 + 'Q'); //'TORQ';
 
 #endif

+ 1 - 1
engine/source/platformAndroid/AndroidProcessControl.cpp

@@ -38,7 +38,7 @@ void Platform::postQuitMessage(const U32 in_quitVal)
 
 void Platform::debugBreak()
 {
-   Platform::outputDebugString((const char *)"\pDEBUG_BREAK!");
+   Platform::outputDebugString((const char *)"DEBUG_BREAK!");
 }
 
 void Platform::forceShutdown(S32 returnValue)

+ 1 - 1
engine/source/string/stringBuffer.cc

@@ -384,7 +384,7 @@ void StringBuffer::getCopy(UTF16 *buff, const U32 buffSize) const
    AssertFatal(mBuffer.last() == 0, "StringBuffer::get UTF8 - not a null terminated string!");
    dMemcpy(buff, mBuffer.address(), sizeof(UTF16) * getMin(buffSize, (U32)mBuffer.size()));
    // ensure null termination.
-   buff[buffSize-1] = NULL;
+   buff[buffSize-1] = '\0';
 }
 
 UTF8* StringBuffer::createCopy8() const