diff options
Diffstat (limited to 'source/blender/blenlib/intern')
-rw-r--r-- | source/blender/blenlib/intern/BLI_args.c | 2 | ||||
-rw-r--r-- | source/blender/blenlib/intern/BLI_ghash.c | 4 | ||||
-rw-r--r-- | source/blender/blenlib/intern/bpath.c | 2 | ||||
-rw-r--r-- | source/blender/blenlib/intern/math_vector_inline.c | 8 | ||||
-rw-r--r-- | source/blender/blenlib/intern/path_util.c | 18 | ||||
-rw-r--r-- | source/blender/blenlib/intern/pbvh.c | 4 | ||||
-rw-r--r-- | source/blender/blenlib/intern/storage.c | 11 |
7 files changed, 43 insertions, 6 deletions
diff --git a/source/blender/blenlib/intern/BLI_args.c b/source/blender/blenlib/intern/BLI_args.c index 1a677499d1f..61ddf8314e5 100644 --- a/source/blender/blenlib/intern/BLI_args.c +++ b/source/blender/blenlib/intern/BLI_args.c @@ -102,7 +102,7 @@ bArgs *BLI_argsInit(int argc, char **argv) { bArgs *ba = MEM_callocN(sizeof(bArgs), "bArgs"); ba->passes = MEM_callocN(sizeof(int) * argc, "bArgs passes"); - ba->items = BLI_ghash_new(keyhash, keycmp); + ba->items = BLI_ghash_new(keyhash, keycmp, "bArgs passes gh"); ba->argc = argc; ba->argv = argv; diff --git a/source/blender/blenlib/intern/BLI_ghash.c b/source/blender/blenlib/intern/BLI_ghash.c index ee312174cf8..11756ada40e 100644 --- a/source/blender/blenlib/intern/BLI_ghash.c +++ b/source/blender/blenlib/intern/BLI_ghash.c @@ -45,8 +45,8 @@ unsigned int hashsizes[]= { /***/ -GHash *BLI_ghash_new(GHashHashFP hashfp, GHashCmpFP cmpfp) { - GHash *gh= MEM_mallocN(sizeof(*gh), "GHash"); +GHash *BLI_ghash_new(GHashHashFP hashfp, GHashCmpFP cmpfp, const char *info) { + GHash *gh= MEM_mallocN(sizeof(*gh), info); gh->hashfp= hashfp; gh->cmpfp= cmpfp; gh->entrypool = BLI_mempool_create(sizeof(Entry), 64, 64, 0); diff --git a/source/blender/blenlib/intern/bpath.c b/source/blender/blenlib/intern/bpath.c index 2367af470fe..afe73a53e5b 100644 --- a/source/blender/blenlib/intern/bpath.c +++ b/source/blender/blenlib/intern/bpath.c @@ -622,7 +622,7 @@ static int findFileRecursive(char *filename_new, const char *dirname, const char while ((de = readdir(dir)) != NULL) { - if (strncmp(".", de->d_name, 2)==0 || strncmp("..", de->d_name, 3)==0) + if (strcmp(".", de->d_name)==0 || strcmp("..", de->d_name)==0) continue; BLI_join_dirfile(path, dirname, de->d_name); diff --git a/source/blender/blenlib/intern/math_vector_inline.c b/source/blender/blenlib/intern/math_vector_inline.c index 974832051af..fa8d1a30269 100644 --- a/source/blender/blenlib/intern/math_vector_inline.c +++ b/source/blender/blenlib/intern/math_vector_inline.c @@ -188,6 +188,14 @@ MINLINE void mul_v3_v3(float r[3], const float a[3]) r[2] *= a[2]; } +MINLINE void mul_v4_fl(float r[4], float f) +{ + r[0]*= f; + r[1]*= f; + r[2]*= f; + r[3]*= f; +} + MINLINE void madd_v2_v2fl(float r[2], const float a[2], float f) { r[0] += a[0]*f; diff --git a/source/blender/blenlib/intern/path_util.c b/source/blender/blenlib/intern/path_util.c index 454663df1ae..85d18d99f96 100644 --- a/source/blender/blenlib/intern/path_util.c +++ b/source/blender/blenlib/intern/path_util.c @@ -1109,6 +1109,24 @@ int BLI_testextensie(const char *str, const char *ext) return (retval); } +int BLI_replace_extension(char *path, int maxlen, const char *ext) +{ + int a; + + for(a=strlen(path)-1; a>=0; a--) + if(path[a] == '.' || path[a] == '/' || path[a] == '\\') + break; + + if(path[a] != '.') + a= strlen(path); + + if(a + strlen(ext) >= maxlen) + return 0; + + strcpy(path+a, ext); + return 1; +} + /* Converts "/foo/bar.txt" to "/foo/" and "bar.txt" * - wont change 'string' * - wont create any directories diff --git a/source/blender/blenlib/intern/pbvh.c b/source/blender/blenlib/intern/pbvh.c index a189e9fbaf2..8aff062c1d4 100644 --- a/source/blender/blenlib/intern/pbvh.c +++ b/source/blender/blenlib/intern/pbvh.c @@ -303,7 +303,7 @@ static void build_mesh_leaf_node(PBVH *bvh, PBVHNode *node) GHash *map; int i, j, totface; - map = BLI_ghash_new(BLI_ghashutil_inthash, BLI_ghashutil_intcmp); + map = BLI_ghash_new(BLI_ghashutil_inthash, BLI_ghashutil_intcmp, "build_mesh_leaf_node gh"); node->uniq_verts = node->face_verts = 0; totface= node->totprim; @@ -970,7 +970,7 @@ void BLI_pbvh_get_grid_updates(PBVH *bvh, int clear, void ***gridfaces, int *tot void *face, **faces; int i, tot; - map = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp); + map = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "pbvh_get_grid_updates gh"); pbvh_iter_begin(&iter, bvh, NULL, NULL); diff --git a/source/blender/blenlib/intern/storage.c b/source/blender/blenlib/intern/storage.c index d9fea2483b9..51d5f0354f9 100644 --- a/source/blender/blenlib/intern/storage.c +++ b/source/blender/blenlib/intern/storage.c @@ -500,3 +500,14 @@ void BLI_free_file_lines(LinkNode *lines) { BLI_linklist_free(lines, (void(*)(void*)) MEM_freeN); } + +int BLI_file_older(const char *file1, const char *file2) +{ + struct stat st1, st2; + + if(stat(file1, &st1)) return 0; + if(stat(file2, &st2)) return 0; + + return (st1.st_mtime < st2.st_mtime); +} + |