code cleanup: replace strncpy -> BLI_strncpy, skip first 2 chars when making a hash...
authorCampbell Barton <ideasman42@gmail.com>
Sun, 4 Aug 2013 03:45:30 +0000 (03:45 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Sun, 4 Aug 2013 03:45:30 +0000 (03:45 +0000)
source/blender/bmesh/intern/bmesh_walkers.c
source/blender/modifiers/intern/MOD_weightvgedit.c
source/blender/modifiers/intern/MOD_weightvgproximity.c
source/gameengine/Converter/KX_BlenderSceneConverter.cpp
source/gameengine/Ketsji/KX_NavMeshObject.cpp

index 04edec01a5c3c05092fb91b13ff75a3fa190ef05..80b85ab6eddfae9efe5646d9056716f47b9516a6 100644 (file)
@@ -92,10 +92,11 @@ void BMW_init(BMWalker *walker, BMesh *bm, int type,
 
        if (UNLIKELY(type >= BMW_MAXWALKERS || type < 0)) {
                fprintf(stderr,
-                       "Invalid walker type in BMW_init; type: %d, "
+                       "%s: Invalid walker type in BMW_init; type: %d, "
                        "searchmask: (v:%d, e:%d, f:%d), flag: %d, layer: %d\n",
-                       type, mask_vert, mask_edge, mask_face, flag, layer);
-               BMESH_ASSERT(0);
+                       __func__, type, mask_vert, mask_edge, mask_face, flag, layer);
+               BLI_assert(0);
+               return;
        }
        
        if (type != BMW_CUSTOM) {
index 959e4d4f59dc6e487888b0585c534258f0157fb5..c8da0eb6de7d87103c51e51a7e9652f942aba33e 100644 (file)
@@ -253,7 +253,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der
                RNG *rng = NULL;
 
                if (wmd->falloff_type == MOD_WVG_MAPPING_RANDOM)
-                       rng = BLI_rng_new_srandom(BLI_ghashutil_strhash(ob->id.name));
+                       rng = BLI_rng_new_srandom(BLI_ghashutil_strhash(ob->id.name + 2));
 
                weightvg_do_map(numVerts, new_w, wmd->falloff_type, wmd->cmap_curve, rng);
 
index f0e9a26f10abde1581cd333bca5a8de42d1c0238..632675385284d6cedd4d71ea4b2ae450c5370d6f 100644 (file)
@@ -216,7 +216,7 @@ static void do_map(Object *ob, float *weights, const int nidx, const float min_d
                RNG *rng = NULL;
 
                if (mode == MOD_WVG_MAPPING_RANDOM)
-                       rng = BLI_rng_new_srandom(BLI_ghashutil_strhash(ob->id.name));
+                       rng = BLI_rng_new_srandom(BLI_ghashutil_strhash(ob->id.name + 2));
 
                weightvg_do_map(nidx, weights, mode, NULL, rng);
 
index 7a53144657db20e42751907f5eea97375faac7d3..98af99825e1fc96f002400f5829cf825a7f48bd5 100644 (file)
@@ -1143,7 +1143,7 @@ KX_LibLoadStatus *KX_BlenderSceneConverter::LinkBlendFile(BlendHandle *bpy_openl
        
        /* needed for lookups*/
        GetMainDynamic().push_back(main_newlib);
-       strncpy(main_newlib->name, path, sizeof(main_newlib->name));
+       BLI_strncpy(main_newlib->name, path, sizeof(main_newlib->name));
        
        
        status = new KX_LibLoadStatus(this, m_ketsjiEngine, scene_merge, path);
index bf9c6ddb442be1e2955b75598ffbbabf931a36a5..e45346db9c7daf395574727b10b307fd9e4d08c8 100644 (file)
@@ -49,7 +49,7 @@ extern "C" {
 #include "DetourStatNavMeshBuilder.h"
 #include "KX_ObstacleSimulation.h"
 
-static const int MAX_PATH_LEN = 256;
+#define MAX_PATH_LEN 256
 static const float polyPickExt[3] = {2, 4, 2};
 
 static void calcMeshBounds(const float* vert, int nverts, float* bmin, float* bmax)
@@ -214,7 +214,7 @@ bool KX_NavMeshObject::BuildVertIndArrays(float *&vertices, int& nverts,
                        }
                }
 
-               MEM_freeN(allVerts);
+               MEM_SAFE_FREE(allVerts);
        }
        else
        {