From 23e72f3978675e43bd91a6eb056a805e618bc706 Mon Sep 17 00:00:00 2001 From: Inusaito Sayori Date: Sat, 5 Oct 2013 18:23:13 -0400 Subject: [PATCH] [Warnings] Fix signed/unsigned mismatches rather than disabling 4018 --- indra/newview/daeexport.cpp | 21 +++++++++---------- indra/newview/llfloatermodelpreview.cpp | 27 ++++++++++++------------- 2 files changed, 23 insertions(+), 25 deletions(-) diff --git a/indra/newview/daeexport.cpp b/indra/newview/daeexport.cpp index 1e71bf61b..82619bb2a 100644 --- a/indra/newview/daeexport.cpp +++ b/indra/newview/daeexport.cpp @@ -27,7 +27,6 @@ //colladadom includes #if LL_MSVC -#pragma warning (disable : 4018) #pragma warning (push) #pragma warning (disable : 4068) #pragma warning (disable : 4263) @@ -358,7 +357,7 @@ public: scroll_container->addChild(panel); panel->setEnabled(FALSE); S32 img_nr = 0; - for (S32 i=0; i < mSaver.mTextures.size(); i++) + for (U32 i=0; i < mSaver.mTextures.size(); i++) { if (mSaver.mTextureNames[i].empty()) continue; @@ -375,7 +374,7 @@ public: void saveTextures() { mTexturesToSave.clear(); - for (S32 i=0; i < mSaver.mTextures.size(); i++) + for (U32 i=0; i < mSaver.mTextures.size(); i++) { if (mSaver.mTextureNames[i].empty()) continue; mTexturesToSave[mSaver.mTextures[i]] = mSaver.mTextureNames[i]; @@ -613,7 +612,7 @@ void DAESaver::addSource(daeElement* mesh, const char* src_id, std::string param src_array->setAttribute("id", llformat("%s-%s", src_id, "array").c_str()); src_array->setAttribute("count", llformat("%d", vals.size()).c_str()); - for (S32 i = 0; i < vals.size(); i++) + for (U32 i = 0; i < vals.size(); i++) { ((domFloat_array*)src_array)->getValue().append(vals[i]); } @@ -870,7 +869,7 @@ bool DAESaver::saveDAE(std::string filename) // Add triangles if (gSavedSettings.getBOOL("DAEExportConsolidateMaterials")) { - for (S32 objMaterial = 0; objMaterial < objMaterials.size(); objMaterial++) + for (U32 objMaterial = 0; objMaterial < objMaterials.size(); objMaterial++) { int_list_t faces; getFacesWithMaterial(obj, objMaterials[objMaterial], &faces); @@ -913,7 +912,7 @@ bool DAESaver::saveDAE(std::string filename) // Bind materials daeElement* tq = nodeGeometry->add("bind_material technique_common"); - for (S32 objMaterial = 0; objMaterial < objMaterials.size(); objMaterial++) + for (U32 objMaterial = 0; objMaterial < objMaterials.size(); objMaterial++) { std::string matName = objMaterials[objMaterial].name; daeElement* instanceMaterial = tq->add("instance_material"); @@ -929,7 +928,7 @@ bool DAESaver::saveDAE(std::string filename) generateEffects(effects); // Materials - for (S32 objMaterial = 0; objMaterial < mAllMaterials.size(); objMaterial++) + for (U32 objMaterial = 0; objMaterial < mAllMaterials.size(); objMaterial++) { daeElement* mat = materials->add("material"); mat->setAttribute("id", (mAllMaterials[objMaterial].name + "-material").c_str()); @@ -955,7 +954,7 @@ DAESaver::MaterialInfo DAESaver::getMaterial(LLTextureEntry* te) { if (gSavedSettings.getBOOL("DAEExportConsolidateMaterials")) { - for (S32 i=0; i < mAllMaterials.size(); i++) + for (U32 i=0; i < mAllMaterials.size(); i++) { if (mAllMaterials[i].matches(te)) { @@ -1010,7 +1009,7 @@ void DAESaver::generateEffects(daeElement *effects) // Effects (face color, alpha) bool export_textures = gSavedSettings.getBOOL("DAEExportTextures"); - for (S32 mat = 0; mat < mAllMaterials.size(); mat++) + for (U32 mat = 0; mat < mAllMaterials.size(); mat++) { LLColor4 color = mAllMaterials[mat].color; domEffect* effect = (domEffect*)effects->add("effect"); @@ -1021,7 +1020,7 @@ void DAESaver::generateEffects(daeElement *effects) if (export_textures) { LLUUID textID; - S32 i = 0; + U32 i = 0; for (; i < mTextures.size(); i++) { if (mAllMaterials[mat].textureID == mTextures[i]) @@ -1068,7 +1067,7 @@ void DAESaver::generateEffects(daeElement *effects) void DAESaver::generateImagesSection(daeElement* images) { - for (S32 i=0; i < mTextureNames.size(); i++) + for (U32 i=0; i < mTextureNames.size(); i++) { std::string name = mTextureNames[i]; if (name.empty()) continue; diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index 6c22653a3..b3ad472bf 100644 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -33,7 +33,6 @@ #include "llviewerprecompiledheaders.h" #if LL_MSVC -#pragma warning (disable : 4018) #pragma warning (push) #pragma warning (disable : 4068) #pragma warning (disable : 4263) @@ -268,7 +267,7 @@ bool ll_is_degenerate(const LLVector4a& a, const LLVector4a& b, const LLVector4a bool validate_face(const LLVolumeFace& face) { - for (U32 i = 0; i < face.mNumIndices; ++i) + for (S32 i = 0; i < face.mNumIndices; ++i) { if (face.mIndices[i] >= face.mNumVertices) { @@ -951,7 +950,7 @@ void LLFloaterModelPreview::onPhysicsStageExecute(LLUICtrl* ctrl, void* data) if (sInstance->mModelPreview) { - for (S32 i = 0; i < sInstance->mModelPreview->mModel[LLModel::LOD_PHYSICS].size(); ++i) + for (U32 i = 0; i < sInstance->mModelPreview->mModel[LLModel::LOD_PHYSICS].size(); ++i) { LLModel* mdl = sInstance->mModelPreview->mModel[LLModel::LOD_PHYSICS][i]; DecompRequest* request = new DecompRequest(stage, mdl); @@ -1501,7 +1500,7 @@ bool LLModelLoader::doLoadModel() //1. Basic validity check on controller U32 controllerCount = (int) db->getElementCount(NULL, "controller"); bool result = false; - for (int i = 0; i < controllerCount; ++i) + for (U32 i = 0; i < controllerCount; ++i) { domController* pController = NULL; db->getElement((daeElement**) &pController, i , NULL, "controller"); @@ -2108,7 +2107,7 @@ bool LLModelLoader::loadFromSLM(const std::string& filename) for (S32 lod = 0; lod < LLModel::NUM_LODS; ++lod) { - for (U32 i = 0; i < mesh.size(); ++i) + for (int i = 0; i < mesh.size(); ++i) { std::stringstream str(mesh[i].asString()); LLPointer loaded_model = new LLModel(volume_params, (F32) lod); @@ -2143,7 +2142,7 @@ bool LLModelLoader::loadFromSLM(const std::string& filename) LLSD& instance = data["instance"]; - for (U32 i = 0; i < instance.size(); ++i) + for (int i = 0; i < instance.size(); ++i) { //deserialize instance list instance_list.push_back(LLModelInstance(instance[i])); @@ -2873,7 +2872,7 @@ void LLModelLoader::processElement(daeElement* element, bool& badElement) std::map LLModelLoader::getMaterials(LLModel* model, domInstance_geometry* instance_geo) { std::map materials; - for (int i = 0; i < model->mMaterialList.size(); i++) + for (U32 i = 0; i < model->mMaterialList.size(); i++) { LLImportMaterial import_material; @@ -2885,7 +2884,7 @@ std::map LLModelLoader::getMaterials(LLModel* mod if (technique) { daeTArray< daeSmartRef > inst_materials = technique->getChildrenByType(); - for (int j = 0; j < inst_materials.getCount(); j++) + for (U32 j = 0; j < inst_materials.getCount(); j++) { std::string symbol(inst_materials[j]->getSymbol()); @@ -2939,7 +2938,7 @@ LLImportMaterial LLModelLoader::profileToMaterial(domProfile_COMMON* material) if (texture) { domCommon_newparam_type_Array newparams = material->getNewparam_array(); - for (S32 i = 0; i < newparams.getCount(); i++) + for (U32 i = 0; i < newparams.getCount(); i++) { domFx_surface_common* surface = newparams[i]->getSurface(); if (surface) @@ -3331,7 +3330,7 @@ void LLModelPreview::rebuildUploadData() base_model->mMetric = metric; } - S32 idx = 0; + U32 idx = 0; for (idx = 0; idx < mBaseModel.size(); ++idx) { //find reference instance for this model if (mBaseModel[idx] == base_model) @@ -3651,7 +3650,7 @@ void LLModelPreview::loadModelCallback(S32 lod) list_iter->mModel = list_iter->mLOD[lod]; //add current model to current LoD's model list (LLModel::mLocalID makes a good vector index) - S32 idx = list_iter->mModel->mLocalID; + U32 idx = list_iter->mModel->mLocalID; if (mModel[lod].size() <= idx) { //stretch model list to fit model at given index @@ -5123,7 +5122,7 @@ BOOL LLModelPreview::render() if (textures) { - int materialCnt = instance.mModel->mMaterialList.size(); + U32 materialCnt = instance.mModel->mMaterialList.size(); if (i < materialCnt) { const std::string& binding = instance.mModel->mMaterialList[i]; @@ -5333,7 +5332,7 @@ BOOL LLModelPreview::render() LLStrider idx; buffer->getIndexStrider(idx, 0); - for (U32 i = 0; i < buffer->getNumIndices(); i += 3) + for (S32 i = 0; i < buffer->getNumIndices(); i += 3) { LLVector4a v1; v1.setMul(pos[*idx++], scale); LLVector4a v2; v2.setMul(pos[*idx++], scale); @@ -5417,7 +5416,7 @@ BOOL LLModelPreview::render() } } - for (U32 j = 0; j < buffer->getNumVerts(); ++j) + for (S32 j = 0; j < buffer->getNumVerts(); ++j) { LLMatrix4 final_mat; final_mat.mMatrix[0][0] = final_mat.mMatrix[1][1] = final_mat.mMatrix[2][2] = final_mat.mMatrix[3][3] = 0.f;