From 0ce2da3a23fae4b87cd82ef08525ee9a71b920b2 Mon Sep 17 00:00:00 2001 From: AzaezelX Date: Thu, 27 Apr 2023 16:10:04 -0500 Subject: [PATCH] clean up math varsize complaints --- Engine/lib/opcode/Ice/IceMemoryMacros.h | 2 +- Engine/lib/opcode/OPC_OptimizedTree.h | 6 +++--- Engine/source/T3D/assets/assetImporter.cpp | 4 ++-- Engine/source/T3D/tsStatic.cpp | 3 ++- Engine/source/console/astNodes.cpp | 2 +- Engine/source/console/compiledEval.cpp | 10 +++++----- Engine/source/console/engineObject.cpp | 2 +- Engine/source/console/engineObject.h | 4 ++-- Engine/source/core/color.h | 8 ++++---- Engine/source/core/strings/stringFunctions.cpp | 2 +- Engine/source/gfx/bitmap/gBitmap.h | 2 +- Engine/source/gfx/bitmap/loaders/bitmapPng.cpp | 10 +++++----- Engine/source/gui/editor/guiInspectorTypes.cpp | 2 +- .../gui/worldEditor/guiConvexShapeEditorCtrl.cpp | 16 ++++++++-------- Engine/source/materials/materialDefinition.cpp | 2 +- .../source/materials/processedShaderMaterial.cpp | 2 +- Engine/source/math/mMathFn.h | 2 +- Engine/source/math/mPoint2.h | 2 +- Engine/source/persistence/taml/fsTinyXml.cpp | 6 +++--- .../source/platform/nativeDialogs/fileDialog.cpp | 2 +- .../platformWin32/nativeDialogs/win32MsgBox.cpp | 3 ++- Engine/source/platformWin32/winConsole.cpp | 2 +- .../source/platformWin32/winProcessControl.cpp | 2 +- Engine/source/sfx/media/sfxVorbisStream.cpp | 4 ++-- Engine/source/terrain/terrFile.cpp | 2 +- Engine/source/ts/assimp/assimpShapeLoader.cpp | 2 ++ Engine/source/ts/collada/colladaAppMesh.cpp | 2 +- Engine/source/ts/collada/colladaImport.cpp | 6 +++--- Engine/source/ts/collada/colladaShapeLoader.cpp | 3 ++- Engine/source/ts/collada/colladaUtils.h | 2 +- 30 files changed, 61 insertions(+), 56 deletions(-) diff --git a/Engine/lib/opcode/Ice/IceMemoryMacros.h b/Engine/lib/opcode/Ice/IceMemoryMacros.h index f4d511189..5827fe87b 100644 --- a/Engine/lib/opcode/Ice/IceMemoryMacros.h +++ b/Engine/lib/opcode/Ice/IceMemoryMacros.h @@ -91,7 +91,7 @@ //! \see CopyMemory inline_ void MoveMemory(void* dest, const void* src, udword size) { memmove(dest, src, size); } - #define SIZEOFOBJECT sizeof(*this) //!< Gives the size of current object. Avoid some mistakes (e.g. "sizeof(this)"). + #define SIZEOFOBJECT udword(sizeof(*this)) //!< Gives the size of current object. Avoid some mistakes (e.g. "sizeof(this)"). //#define CLEAROBJECT { memset(this, 0, SIZEOFOBJECT); } //!< Clears current object. Laziness is my business. HANDLE WITH CARE. #define DELETESINGLE(x) if (x) { delete x; x = null; } //!< Deletes an instance of a class. #define DELETEARRAY(x) if (x) { delete []x; x = null; } //!< Deletes an array. diff --git a/Engine/lib/opcode/OPC_OptimizedTree.h b/Engine/lib/opcode/OPC_OptimizedTree.h index 23f972d94..94f5d2464 100644 --- a/Engine/lib/opcode/OPC_OptimizedTree.h +++ b/Engine/lib/opcode/OPC_OptimizedTree.h @@ -31,7 +31,7 @@ /* Data access */ \ inline_ const base_class* GetPos() const { return (base_class*)mData; } \ inline_ const base_class* GetNeg() const { return ((base_class*)mData)+1; } \ - inline_ udword GetPrimitive() const { return (mData>>1); } \ + inline_ udword GetPrimitive() const { return (udword(mData>>1)); } \ /* Stats */ \ inline_ udword GetNodeSize() const { return SIZEOFOBJECT; } \ \ @@ -50,8 +50,8 @@ /* Data access */ \ inline_ const base_class* GetPos() const { return (base_class*)mPosData; } \ inline_ const base_class* GetNeg() const { return (base_class*)mNegData; } \ - inline_ udword GetPosPrimitive() const { return (mPosData>>1); } \ - inline_ udword GetNegPrimitive() const { return (mNegData>>1); } \ + inline_ udword GetPosPrimitive() const { return (udword(mPosData>>1)); } \ + inline_ udword GetNegPrimitive() const { return (udword(mNegData>>1)); } \ /* Stats */ \ inline_ udword GetNodeSize() const { return SIZEOFOBJECT; } \ \ diff --git a/Engine/source/T3D/assets/assetImporter.cpp b/Engine/source/T3D/assets/assetImporter.cpp index c832e93e4..8a1a79f7e 100644 --- a/Engine/source/T3D/assets/assetImporter.cpp +++ b/Engine/source/T3D/assets/assetImporter.cpp @@ -1173,7 +1173,7 @@ static bool enumColladaForImport(const char* shapePath, GuiTreeViewCtrl* tree, b for (S32 i = 0; i < root->getLibrary_materials_array().getCount(); i++) { const domLibrary_materials* libraryMats = root->getLibrary_materials_array()[i]; - stats.numMaterials += libraryMats->getMaterial_array().getCount(); + stats.numMaterials += (S32)libraryMats->getMaterial_array().getCount(); for (S32 j = 0; j < libraryMats->getMaterial_array().getCount(); j++) { domMaterial* mat = libraryMats->getMaterial_array()[j]; @@ -1267,7 +1267,7 @@ static bool enumColladaForImport(const char* shapePath, GuiTreeViewCtrl* tree, b for (S32 i = 0; i < root->getLibrary_animation_clips_array().getCount(); i++) { const domLibrary_animation_clips* libraryClips = root->getLibrary_animation_clips_array()[i]; - stats.numClips += libraryClips->getAnimation_clip_array().getCount(); + stats.numClips += (S32)libraryClips->getAnimation_clip_array().getCount(); for (S32 j = 0; j < libraryClips->getAnimation_clip_array().getCount(); j++) { domAnimation_clip* clip = libraryClips->getAnimation_clip_array()[j]; diff --git a/Engine/source/T3D/tsStatic.cpp b/Engine/source/T3D/tsStatic.cpp index 2b454a1d1..2301d3531 100644 --- a/Engine/source/T3D/tsStatic.cpp +++ b/Engine/source/T3D/tsStatic.cpp @@ -1641,7 +1641,7 @@ void TSStatic::onInspect(GuiInspector* inspector) { //if (mShapeAsset == nullptr) return; - +/* //Put the GameObject group before everything that'd be gameobject-effecting, for orginazational purposes GuiInspectorGroup* materialGroup = inspector->findExistentGroup(StringTable->insert("Materials")); if (!materialGroup) @@ -1709,6 +1709,7 @@ void TSStatic::onInspect(GuiInspector* inspector) } } } + */ } #endif DefineEngineMethod(TSStatic, getTargetName, const char*, (S32 index), (0), diff --git a/Engine/source/console/astNodes.cpp b/Engine/source/console/astNodes.cpp index efcda048f..73db0693d 100644 --- a/Engine/source/console/astNodes.cpp +++ b/Engine/source/console/astNodes.cpp @@ -1556,7 +1556,7 @@ U32 FunctionDeclStmtNode::compileStmt(CodeStream& codeStream, U32 ip) // map local variables to registers for this function. // Note we have to map these in order because the table itself is ordered by the register id. CompilerLocalVariableToRegisterMappingTable* tbl = &getFunctionVariableMappingTable(); - for (size_t i = 0; i < gFuncVars->variableNameMap.size(); ++i) + for (S32 i = 0; i < gFuncVars->variableNameMap.size(); ++i) { StringTableEntry varName = gFuncVars->variableNameMap[i]; tbl->add(fnName, nameSpace, varName); diff --git a/Engine/source/console/compiledEval.cpp b/Engine/source/console/compiledEval.cpp index 21eed56a9..3c1585b08 100644 --- a/Engine/source/console/compiledEval.cpp +++ b/Engine/source/console/compiledEval.cpp @@ -615,7 +615,7 @@ ConsoleValue CodeBlock::exec(U32 ip, const char* functionName, Namespace* thisNa gExecCount++; #endif - const dsize_t TRACE_BUFFER_SIZE = 1024; + const U32 TRACE_BUFFER_SIZE = 1024; static char traceBuffer[TRACE_BUFFER_SIZE]; U32 i; @@ -648,12 +648,12 @@ ConsoleValue CodeBlock::exec(U32 ip, const char* functionName, Namespace* thisNa } if (thisNamespace && thisNamespace->mName) { - dSprintf(traceBuffer + dStrlen(traceBuffer), sizeof(traceBuffer) - dStrlen(traceBuffer), + dSprintf(traceBuffer + (U32)dStrlen(traceBuffer), sizeof(traceBuffer) - (U32)dStrlen(traceBuffer), "%s::%s(", thisNamespace->mName, thisFunctionName); } else { - dSprintf(traceBuffer + dStrlen(traceBuffer), sizeof(traceBuffer) - dStrlen(traceBuffer), + dSprintf(traceBuffer + (U32)dStrlen(traceBuffer), sizeof(traceBuffer) - (U32)dStrlen(traceBuffer), "%s(", thisFunctionName); } for (i = 0; i < wantedArgc; i++) @@ -2317,12 +2317,12 @@ execFinished: } if (thisNamespace && thisNamespace->mName) { - dSprintf(traceBuffer + dStrlen(traceBuffer), sizeof(traceBuffer) - dStrlen(traceBuffer), + dSprintf(traceBuffer + (U32)dStrlen(traceBuffer), sizeof(traceBuffer) - (U32)dStrlen(traceBuffer), "%s::%s() - return %s", thisNamespace->mName, thisFunctionName, returnValue.getString()); } else { - dSprintf(traceBuffer + dStrlen(traceBuffer), sizeof(traceBuffer) - dStrlen(traceBuffer), + dSprintf(traceBuffer + (U32)dStrlen(traceBuffer), sizeof(traceBuffer) - (U32)dStrlen(traceBuffer), "%s() - return %s", thisFunctionName, returnValue.getString()); } Con::printf("%s", traceBuffer); diff --git a/Engine/source/console/engineObject.cpp b/Engine/source/console/engineObject.cpp index ff19c1acb..c625b3a59 100644 --- a/Engine/source/console/engineObject.cpp +++ b/Engine/source/console/engineObject.cpp @@ -276,7 +276,7 @@ void EngineObject::debugEnumInstances( const char* className, DebugEnumInstances //----------------------------------------------------------------------------- -void* EngineCRuntimeObjectPool::allocateObject( U32 size TORQUE_TMM_ARGS_DECL ) +void* EngineCRuntimeObjectPool::allocateObject(size_t size TORQUE_TMM_ARGS_DECL ) { #ifdef TORQUE_DISABLE_MEMORY_MANAGER return dMalloc( size ); diff --git a/Engine/source/console/engineObject.h b/Engine/source/console/engineObject.h index 21f77b7ce..388fd2244 100644 --- a/Engine/source/console/engineObject.h +++ b/Engine/source/console/engineObject.h @@ -456,7 +456,7 @@ class IEngineObjectPool /// Allocate a new object memory block of the given size. /// @return Pointer to a new memory block or NULL on failure. - virtual void* allocateObject( U32 size TORQUE_TMM_ARGS_DECL ) = 0; + virtual void* allocateObject( size_t size TORQUE_TMM_ARGS_DECL ) = 0; /// Return the member for the object at the given address to the /// allocator for reuse. @@ -485,7 +485,7 @@ class EngineCRuntimeObjectPool : public IEngineObjectPool static EngineCRuntimeObjectPool* instance() { return &smInstance; } // IEngineObjectPool - virtual void* allocateObject( U32 size TORQUE_TMM_ARGS_DECL ); + virtual void* allocateObject(size_t size TORQUE_TMM_ARGS_DECL ); virtual void freeObject( void* ptr ); }; diff --git a/Engine/source/core/color.h b/Engine/source/core/color.h index 12b590f4e..af111207c 100644 --- a/Engine/source/core/color.h +++ b/Engine/source/core/color.h @@ -849,10 +849,10 @@ inline ColorI LinearColorF::toColorI(const bool keepAsLinear) float b = mPow(blue, gOneOverGamma); return ColorI(U8(r * 255.0f + 0.5), U8(g * 255.0f + 0.5), U8(b * 255.0f + 0.5), U8(alpha * 255.0f + 0.5)); #else - float r = red < 0.0031308f ? 12.92f * red : 1.055 * mPow(red, 1.0f / 2.4f) - 0.055f; - float g = green < 0.0031308f ? 12.92f * green : 1.055 * mPow(green, 1.0f / 2.4f) - 0.055f; - float b = blue < 0.0031308f ? 12.92f * blue : 1.055 * mPow(blue, 1.0f / 2.4f) - 0.055f; - return ColorI(U8(r * 255.0f + 0.5), U8(g * 255.0f + 0.5), U8(b * 255.0f + 0.5), U8(alpha * 255.0f + 0.5)); + float r = red < 0.0031308f ? 12.92f * red : 1.055f * mPow(red, 1.0f / 2.4f) - 0.055f; + float g = green < 0.0031308f ? 12.92f * green : 1.055f * mPow(green, 1.0f / 2.4f) - 0.055f; + float b = blue < 0.0031308f ? 12.92f * blue : 1.055f * mPow(blue, 1.0f / 2.4f) - 0.055f; + return ColorI(U8(r * 255.0f + 0.5), U8(g * 255.0f + 0.5), U8(b * 255.0f + 0.5), U8(alpha * 255.0f + 0.5f)); #endif } } diff --git a/Engine/source/core/strings/stringFunctions.cpp b/Engine/source/core/strings/stringFunctions.cpp index 893dc5815..f71c57ad0 100644 --- a/Engine/source/core/strings/stringFunctions.cpp +++ b/Engine/source/core/strings/stringFunctions.cpp @@ -582,7 +582,7 @@ char* dStristr( char* str1, const char* str2 ) // Slow but at least we have it. - U32 str2len = strlen( str2 ); + U64 str2len = (U64)strlen( str2 ); while( *str1 ) { if( strncasecmp( str1, str2, str2len ) == 0 ) diff --git a/Engine/source/gfx/bitmap/gBitmap.h b/Engine/source/gfx/bitmap/gBitmap.h index d608da146..5f0153e11 100644 --- a/Engine/source/gfx/bitmap/gBitmap.h +++ b/Engine/source/gfx/bitmap/gBitmap.h @@ -323,7 +323,7 @@ inline U8* GBitmap::getWritableBits(const U32 in_mipLevel) inline U8* GBitmap::getAddress(const S32 in_x, const S32 in_y, const U32 mipLevel) { - return (getWritableBits(mipLevel) + ((in_y * getWidth(mipLevel)) + in_x) * mBytesPerPixel); + return (getWritableBits(mipLevel) + (U64)(((in_y * getWidth(mipLevel)) + in_x) * mBytesPerPixel)); } inline const U8* GBitmap::getAddress(const S32 in_x, const S32 in_y, const U32 mipLevel) const diff --git a/Engine/source/gfx/bitmap/loaders/bitmapPng.cpp b/Engine/source/gfx/bitmap/loaders/bitmapPng.cpp index 9eb1d7b2c..a857d204d 100644 --- a/Engine/source/gfx/bitmap/loaders/bitmapPng.cpp +++ b/Engine/source/gfx/bitmap/loaders/bitmapPng.cpp @@ -75,7 +75,7 @@ static void pngReadDataFn(png_structp png_ptr, AssertFatal(png_get_io_ptr(png_ptr) != NULL, "No stream?"); Stream *strm = (Stream*)png_get_io_ptr(png_ptr); - bool success = strm->read(length, data); + bool success = strm->read((U32)length, data); AssertFatal(success, "pngReadDataFn - failed to read from stream!"); } @@ -88,7 +88,7 @@ static void pngWriteDataFn(png_structp png_ptr, AssertFatal(png_get_io_ptr(png_ptr) != NULL, "No stream?"); Stream *strm = (Stream*)png_get_io_ptr(png_ptr); - bool success = strm->write(length, data); + bool success = strm->write((U32)length, data); AssertFatal(success, "pngWriteDataFn - failed to write to stream!"); } @@ -101,7 +101,7 @@ static void pngFlushDataFn(png_structp /*png_ptr*/) static png_voidp pngMallocFn(png_structp /*png_ptr*/, png_size_t size) { - return FrameAllocator::alloc(size); + return FrameAllocator::alloc((U32)size); } static void pngFreeFn(png_structp /*png_ptr*/, png_voidp /*mem*/) @@ -265,7 +265,7 @@ static bool sReadPNG(Stream &stream, GBitmap *bitmap) // above... png_read_update_info(png_ptr, info_ptr); - png_uint_32 rowBytes = png_get_rowbytes(png_ptr, info_ptr); + png_uint_32 rowBytes = (png_uint_32)png_get_rowbytes(png_ptr, info_ptr); if (format == GFXFormatR8G8B8) { AssertFatal(rowBytes == width * 3, @@ -642,4 +642,4 @@ void DeferredPNGWriter::end() png_destroy_write_struct(&mData->png_ptr, (png_infopp)NULL); mActive = false; -} \ No newline at end of file +} diff --git a/Engine/source/gui/editor/guiInspectorTypes.cpp b/Engine/source/gui/editor/guiInspectorTypes.cpp index 4529d6392..5f682a1a8 100644 --- a/Engine/source/gui/editor/guiInspectorTypes.cpp +++ b/Engine/source/gui/editor/guiInspectorTypes.cpp @@ -902,7 +902,7 @@ void GuiInspectorTypeCommand::_setCommand( GuiButtonCtrl *ctrl, StringTableEntry S32 written = dSprintf( szBuffer, len, "%s(\"", mTextEditorCommand ); expandEscape(szBuffer.address() + written, command); - written = strlen(szBuffer); + written = (S32)strlen(szBuffer); dSprintf( szBuffer.address() + written, len - written, "\", \"%d.apply\", %d.getRoot());", getId(), getId() ); ctrl->setField( "Command", szBuffer ); diff --git a/Engine/source/gui/worldEditor/guiConvexShapeEditorCtrl.cpp b/Engine/source/gui/worldEditor/guiConvexShapeEditorCtrl.cpp index a095367f0..8acd5ef16 100644 --- a/Engine/source/gui/worldEditor/guiConvexShapeEditorCtrl.cpp +++ b/Engine/source/gui/worldEditor/guiConvexShapeEditorCtrl.cpp @@ -648,17 +648,17 @@ void GuiConvexEditorCtrl::on3DMouseDragged(const Gui3DMouseEvent & event) F32 scalar = 1; mConvexSEL->mSurfaceUVs[mFaceSEL].scale += (Point2F(scale.x, scale.y) * scalar); - if (mConvexSEL->mSurfaceUVs[mFaceSEL].scale.x < 0.01) - mConvexSEL->mSurfaceUVs[mFaceSEL].scale.x = 0.01; + if (mConvexSEL->mSurfaceUVs[mFaceSEL].scale.x < 0.01f) + mConvexSEL->mSurfaceUVs[mFaceSEL].scale.x = 0.01f; - if (mConvexSEL->mSurfaceUVs[mFaceSEL].scale.y < 0.01) - mConvexSEL->mSurfaceUVs[mFaceSEL].scale.y = 0.01; + if (mConvexSEL->mSurfaceUVs[mFaceSEL].scale.y < 0.01f) + mConvexSEL->mSurfaceUVs[mFaceSEL].scale.y = 0.01f; - if (mConvexSEL->mSurfaceUVs[mFaceSEL].scale.x > 100) - mConvexSEL->mSurfaceUVs[mFaceSEL].scale.x = 100; + if (mConvexSEL->mSurfaceUVs[mFaceSEL].scale.x > 100.0f) + mConvexSEL->mSurfaceUVs[mFaceSEL].scale.x = 100.0f; - if (mConvexSEL->mSurfaceUVs[mFaceSEL].scale.y > 100) - mConvexSEL->mSurfaceUVs[mFaceSEL].scale.y = 100; + if (mConvexSEL->mSurfaceUVs[mFaceSEL].scale.y > 100.0f) + mConvexSEL->mSurfaceUVs[mFaceSEL].scale.y = 100.0f; Point2F test = mConvexSEL->mSurfaceUVs[mFaceSEL].scale; mConvexSEL->setMaskBits( ConvexShape::UpdateMask ); diff --git a/Engine/source/materials/materialDefinition.cpp b/Engine/source/materials/materialDefinition.cpp index a31f504f1..5b99ed314 100644 --- a/Engine/source/materials/materialDefinition.cpp +++ b/Engine/source/materials/materialDefinition.cpp @@ -661,7 +661,7 @@ void Material::_mapMaterial() mMapTo = mDiffuseMapName[0]; else // use everything after the last slash - mMapTo = String(mDiffuseMapName[0]).substr(slashPos + 1, strlen(mDiffuseMapName[0]) - slashPos - 1); + mMapTo = String(mDiffuseMapName[0]).substr(slashPos + 1, (U32)strlen(mDiffuseMapName[0]) - slashPos - 1); } else if (!mDiffuseMapAsset->isNull()) { diff --git a/Engine/source/materials/processedShaderMaterial.cpp b/Engine/source/materials/processedShaderMaterial.cpp index 781c5d2e2..dfba63533 100644 --- a/Engine/source/materials/processedShaderMaterial.cpp +++ b/Engine/source/materials/processedShaderMaterial.cpp @@ -230,7 +230,7 @@ bool ProcessedShaderMaterial::init( const FeatureSet &features, } if (mMaterial && mMaterial->mDiffuseMapName[0] != StringTable->EmptyString() && String(mMaterial->mDiffuseMapName[0]).startsWith("#")) { - String texTargetBufferName = String(mMaterial->mDiffuseMapName[0]).substr(1, strlen(mMaterial->mDiffuseMapName[0]) - 1); + String texTargetBufferName = String(mMaterial->mDiffuseMapName[0]).substr(1, (U32)strlen(mMaterial->mDiffuseMapName[0]) - 1); NamedTexTarget *texTarget = NamedTexTarget::find(texTargetBufferName); RenderPassData* rpd = getPass(0); diff --git a/Engine/source/math/mMathFn.h b/Engine/source/math/mMathFn.h index a6668cc53..92d139ae5 100644 --- a/Engine/source/math/mMathFn.h +++ b/Engine/source/math/mMathFn.h @@ -209,7 +209,7 @@ inline F32 mFmod(const F32 val, const F32 mod) inline S32 mRound(const F32 val) { - return (S32)floor(val + 0.5f); + return (S32)floor(F64(val + 0.5f)); } inline F32 mRound(const F32 val, const S32 n) diff --git a/Engine/source/math/mPoint2.h b/Engine/source/math/mPoint2.h index d48fea3c9..851f2aeb0 100644 --- a/Engine/source/math/mPoint2.h +++ b/Engine/source/math/mPoint2.h @@ -915,7 +915,7 @@ inline bool mIsNaN( const Point2F &p ) /// Return negative if p0p1p2 are clockwise inline F64 mCross(const Point2F &p0, const Point2F &p1, const Point2F &pt2) { - return (p1.x - p0.x) * (pt2.y - p0.y) - (p1.y - p0.y) * (pt2.x - p0.x); + return F64(p1.x - p0.x) * F64(pt2.y - p0.y) - F64(p1.y - p0.y) * F64(pt2.x - p0.x); } diff --git a/Engine/source/persistence/taml/fsTinyXml.cpp b/Engine/source/persistence/taml/fsTinyXml.cpp index 961d96b0e..40fba37b3 100644 --- a/Engine/source/persistence/taml/fsTinyXml.cpp +++ b/Engine/source/persistence/taml/fsTinyXml.cpp @@ -53,7 +53,7 @@ void VfsXMLPrinter::Print(const char* format, ...) void VfsXMLPrinter::Write(const char* data, size_t size) { - m_Stream.write(size, data); + m_Stream.write((U32)size, data); } void VfsXMLPrinter::Putc(char ch) @@ -250,12 +250,12 @@ void VfsXMLDocument::SetError(tinyxml2::XMLError error, int lineNum, const char* if (format) { size_t len = strlen(buffer); - dSprintf(buffer + len, BUFFER_SIZE - len, ": "); + dSprintf(buffer + len, (U32)(BUFFER_SIZE - len), ": "); len = strlen(buffer); va_list va; va_start(va, format); - dSprintf(buffer + len, BUFFER_SIZE - len, format, va); + dSprintf(buffer + len, (U32)(BUFFER_SIZE - len), format, va); va_end(va); } _errorStr.SetStr(buffer); diff --git a/Engine/source/platform/nativeDialogs/fileDialog.cpp b/Engine/source/platform/nativeDialogs/fileDialog.cpp index 237e19de1..feb10849b 100644 --- a/Engine/source/platform/nativeDialogs/fileDialog.cpp +++ b/Engine/source/platform/nativeDialogs/fileDialog.cpp @@ -295,7 +295,7 @@ bool FileDialog::Execute() else if (mData.mStyle & FileDialogData::FDS_MULTIPLEFILES) { //check if we have multiple files actually selected or not - U32 fileCount = NFD_PathSet_GetCount(&pathSet); + U32 fileCount = (U32)NFD_PathSet_GetCount(&pathSet); if (fileCount > 1) { //yep, so parse through them and prep our return diff --git a/Engine/source/platformWin32/nativeDialogs/win32MsgBox.cpp b/Engine/source/platformWin32/nativeDialogs/win32MsgBox.cpp index 422800415..284bbe0bb 100644 --- a/Engine/source/platformWin32/nativeDialogs/win32MsgBox.cpp +++ b/Engine/source/platformWin32/nativeDialogs/win32MsgBox.cpp @@ -37,6 +37,7 @@ struct _FlagMap U32 flag; }; +#ifndef TORQUE_SDL static _FlagMap sgButtonMap[] = { { MBOk, MB_OK }, @@ -65,7 +66,7 @@ static _FlagMap sgMsgBoxRetMap[] = { IDYES, MROk }, { 0xffffffff, 0xffffffff } }; - +#endif //----------------------------------------------------------------------------- static U32 getMaskFromID(_FlagMap *map, S32 id) diff --git a/Engine/source/platformWin32/winConsole.cpp b/Engine/source/platformWin32/winConsole.cpp index c22ab735b..2280b5139 100644 --- a/Engine/source/platformWin32/winConsole.cpp +++ b/Engine/source/platformWin32/winConsole.cpp @@ -147,7 +147,7 @@ void WinConsole::printf(const char *s, ...) // Axe the color characters. Con::stripColorChars(buffer); // Print it. - WriteFile(stdOut, buffer, strlen(buffer), &bytes, NULL); + WriteFile(stdOut, buffer, (U32)strlen(buffer), &bytes, NULL); FlushFileBuffers( stdOut ); } diff --git a/Engine/source/platformWin32/winProcessControl.cpp b/Engine/source/platformWin32/winProcessControl.cpp index db2b347db..b9e87f6da 100644 --- a/Engine/source/platformWin32/winProcessControl.cpp +++ b/Engine/source/platformWin32/winProcessControl.cpp @@ -59,7 +59,7 @@ void Platform::outputDebugString( const char *string, ... ) // twice as in a multi-threaded environment, some other thread may output some // stuff in between the two calls. - U32 length = strlen( buffer ); + U32 length = (U32)strlen( buffer ); if( length == ( sizeof( buffer ) - 1 ) ) length --; diff --git a/Engine/source/sfx/media/sfxVorbisStream.cpp b/Engine/source/sfx/media/sfxVorbisStream.cpp index 38e4e5d95..907d26370 100644 --- a/Engine/source/sfx/media/sfxVorbisStream.cpp +++ b/Engine/source/sfx/media/sfxVorbisStream.cpp @@ -85,12 +85,12 @@ size_t SFXVorbisStream::_read_func( void *ptr, size_t size, size_t nmemb, void * // Stream::read() returns true if any data was // read, so we must track the read bytes ourselves. U32 startByte = stream->getPosition(); - stream->read( size * nmemb, ptr ); + stream->read((U32)(size * nmemb), ptr ); U32 endByte = stream->getPosition(); // How many did we actually read? U32 readBytes = ( endByte - startByte ); - U32 readItems = readBytes / size; + U32 readItems = (U32)(readBytes / size); return readItems; } diff --git a/Engine/source/terrain/terrFile.cpp b/Engine/source/terrain/terrFile.cpp index ca9985f5b..28689c0d5 100644 --- a/Engine/source/terrain/terrFile.cpp +++ b/Engine/source/terrain/terrFile.cpp @@ -115,7 +115,7 @@ void TerrainFile::_buildGridMap() for ( S32 i = mGridLevels; i >= 0; i-- ) { mGridMap[i] = grid; - grid += 1 << ( 2 * ( mGridLevels - i ) ); + grid += (U64)1 << (U64)( 2 * ( mGridLevels - i ) ); } for( S32 i = mGridLevels; i >= 0; i-- ) diff --git a/Engine/source/ts/assimp/assimpShapeLoader.cpp b/Engine/source/ts/assimp/assimpShapeLoader.cpp index 0ffa6bd11..2a3735243 100644 --- a/Engine/source/ts/assimp/assimpShapeLoader.cpp +++ b/Engine/source/ts/assimp/assimpShapeLoader.cpp @@ -427,6 +427,7 @@ bool AssimpShapeLoader::fillGuiTreeView(const char* sourceShapePath, GuiTreeView void AssimpShapeLoader::updateMaterialsScript(const Torque::Path &path) { return; + /* Torque::Path scriptPath(path); scriptPath.setFileName("materials"); scriptPath.setExtension(TORQUE_SCRIPT_EXTENSION); @@ -460,6 +461,7 @@ void AssimpShapeLoader::updateMaterialsScript(const Torque::Path &path) return; persistMgr.saveDirty(); + */ } /// Check if an up-to-date cached DTS is available for this DAE file diff --git a/Engine/source/ts/collada/colladaAppMesh.cpp b/Engine/source/ts/collada/colladaAppMesh.cpp index a6bb56f04..a944e2eef 100644 --- a/Engine/source/ts/collada/colladaAppMesh.cpp +++ b/Engine/source/ts/collada/colladaAppMesh.cpp @@ -512,7 +512,7 @@ void ColladaAppMesh::getPrimitives(const domGeometry* geometry) if (!pTriData) continue; - U32 numTriangles = pTriData->getCount() / meshPrims[iPrim]->getStride() / 3; + U32 numTriangles = (U32)(pTriData->getCount() / meshPrims[iPrim]->getStride() / 3); if (!numTriangles) continue; diff --git a/Engine/source/ts/collada/colladaImport.cpp b/Engine/source/ts/collada/colladaImport.cpp index 75e49cac6..55541ed85 100644 --- a/Engine/source/ts/collada/colladaImport.cpp +++ b/Engine/source/ts/collada/colladaImport.cpp @@ -195,8 +195,8 @@ DefineEngineFunction( enumColladaForImport, bool, (const char * shapePath, const for (S32 i = 0; i < root->getLibrary_materials_array().getCount(); i++) { const domLibrary_materials* libraryMats = root->getLibrary_materials_array()[i]; - stats.numMaterials += libraryMats->getMaterial_array().getCount(); - for (S32 j = 0; j < libraryMats->getMaterial_array().getCount(); j++) + stats.numMaterials += (S32)libraryMats->getMaterial_array().getCount(); + for (S32 j = 0; j < (S32)libraryMats->getMaterial_array().getCount(); j++) { domMaterial* mat = libraryMats->getMaterial_array()[j]; tree->insertItem(matsID, _GetNameOrId(mat), "", "", 0, 0); @@ -225,7 +225,7 @@ DefineEngineFunction( enumColladaForImport, bool, (const char * shapePath, const for (S32 i = 0; i < root->getLibrary_animation_clips_array().getCount(); i++) { const domLibrary_animation_clips* libraryClips = root->getLibrary_animation_clips_array()[i]; - stats.numClips += libraryClips->getAnimation_clip_array().getCount(); + stats.numClips += (S32)libraryClips->getAnimation_clip_array().getCount(); for (S32 j = 0; j < libraryClips->getAnimation_clip_array().getCount(); j++) { domAnimation_clip* clip = libraryClips->getAnimation_clip_array()[j]; diff --git a/Engine/source/ts/collada/colladaShapeLoader.cpp b/Engine/source/ts/collada/colladaShapeLoader.cpp index 63e743087..8f96c9cab 100644 --- a/Engine/source/ts/collada/colladaShapeLoader.cpp +++ b/Engine/source/ts/collada/colladaShapeLoader.cpp @@ -462,7 +462,7 @@ void updateMaterialsScript(const Torque::Path &path, bool copyTextures = false) #endif return; - + /* Torque::Path scriptPath(path); scriptPath.setFileName("materials"); scriptPath.setExtension(TORQUE_SCRIPT_EXTENSION); @@ -510,6 +510,7 @@ void updateMaterialsScript(const Torque::Path &path, bool copyTextures = false) } persistMgr.saveDirty(); + */ } //----------------------------------------------------------------------------- diff --git a/Engine/source/ts/collada/colladaUtils.h b/Engine/source/ts/collada/colladaUtils.h index c22561ec0..2c5335784 100644 --- a/Engine/source/ts/collada/colladaUtils.h +++ b/Engine/source/ts/collada/colladaUtils.h @@ -831,7 +831,7 @@ template<> inline const domListOfUInts *ColladaPrimitive::getTriang pSrcData += stride; for (S32 iTri = 0; iTri < vcount[iPoly]-2; iTri++) { pTriangleData->appendArray(stride, v0); - pTriangleData->appendArray(stride*2, pSrcData); + pTriangleData->appendArray((U64)(stride*2), pSrcData); pSrcData += stride; } pSrcData += stride;