Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2011-10-20 03:10:54 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-10-20 03:10:54 +0400
commit5cf593a778e3dca51a5ebd6b4c23ce6c7b0a7ac6 (patch)
treed5d8889ff9dcffa4c15b7160a8850d3f16b6562e /source/blender/blenloader
parent364fcde86d3cdcb09d075a0445fc2e1eb64170d5 (diff)
strcpy() --> BLI_strncpy(), where source strings are not fixed and target size is known.
Diffstat (limited to 'source/blender/blenloader')
-rw-r--r--source/blender/blenloader/BLO_readfile.h2
-rw-r--r--source/blender/blenloader/BLO_runtime.h4
-rw-r--r--source/blender/blenloader/intern/readblenentry.c2
-rw-r--r--source/blender/blenloader/intern/readfile.c16
-rw-r--r--source/blender/blenloader/intern/runtime.c4
5 files changed, 14 insertions, 14 deletions
diff --git a/source/blender/blenloader/BLO_readfile.h b/source/blender/blenloader/BLO_readfile.h
index e7be98d955d..2799b2165f0 100644
--- a/source/blender/blenloader/BLO_readfile.h
+++ b/source/blender/blenloader/BLO_readfile.h
@@ -252,7 +252,7 @@ void BLO_library_append_end(const struct bContext *C, struct Main *mainl, BlendH
void *BLO_library_read_struct(struct FileData *fd, struct BHead *bh, const char *blockname);
-BlendFileData* blo_read_blendafterruntime(int file, char *name, int actualsize, struct ReportList *reports);
+BlendFileData* blo_read_blendafterruntime(int file, const char *name, int actualsize, struct ReportList *reports);
#ifdef __cplusplus
}
diff --git a/source/blender/blenloader/BLO_runtime.h b/source/blender/blenloader/BLO_runtime.h
index 920b14e92fa..0a3ceeefa78 100644
--- a/source/blender/blenloader/BLO_runtime.h
+++ b/source/blender/blenloader/BLO_runtime.h
@@ -42,8 +42,8 @@ extern "C" {
struct BlendFileData;
struct ReportList;
-int BLO_is_a_runtime(char *file);
-struct BlendFileData *BLO_read_runtime(char *file, struct ReportList *reports);
+int BLO_is_a_runtime(const char *file);
+struct BlendFileData *BLO_read_runtime(const char *file, struct ReportList *reports);
#ifdef __cplusplus
}
diff --git a/source/blender/blenloader/intern/readblenentry.c b/source/blender/blenloader/intern/readblenentry.c
index 0e93e5fa8c0..220784c9ff7 100644
--- a/source/blender/blenloader/intern/readblenentry.c
+++ b/source/blender/blenloader/intern/readblenentry.c
@@ -288,7 +288,7 @@ BlendFileData *BLO_read_from_memfile(Main *oldmain, const char *filename, MemFil
fd = blo_openblendermemfile(memfile, reports);
if (fd) {
fd->reports= reports;
- strcpy(fd->relabase, filename);
+ BLI_strncpy(fd->relabase, filename, sizeof(fd->relabase));
/* clear ob->proxy_from pointers in old main */
blo_clear_proxy_pointers_from_lib(oldmain);
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index a6474fb5044..667550bcaa0 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -9275,7 +9275,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
simasel->prv_h = 96;
simasel->prv_w = 96;
simasel->flag = 7; /* ??? elubie */
- strcpy (simasel->dir, U.textudir); /* TON */
+ BLI_strncpy (simasel->dir, U.textudir, sizeof(simasel->dir)); /* TON */
simasel->file[0]= '\0';
simasel->returnfunc = NULL;
@@ -9498,7 +9498,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
ct= MEM_callocN(sizeof(bConstraintTarget), "PyConTarget");
ct->tar = data->tar;
- strcpy(ct->subtarget, data->subtarget);
+ BLI_strncpy(ct->subtarget, data->subtarget, sizeof(ct->subtarget));
ct->space = con->tarspace;
BLI_addtail(&data->targets, ct);
@@ -9528,7 +9528,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
ct= MEM_callocN(sizeof(bConstraintTarget), "PyConTarget");
ct->tar = data->tar;
- strcpy(ct->subtarget, data->subtarget);
+ BLI_strncpy(ct->subtarget, data->subtarget, sizeof(ct->subtarget));
ct->space = con->tarspace;
BLI_addtail(&data->targets, ct);
@@ -12008,8 +12008,8 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
aa->flag = ia->flag;
aa->sta = ia->sta;
aa->end = ia->end;
- strcpy(aa->name, ia->name);
- strcpy(aa->frameProp, ia->frameProp);
+ BLI_strncpy(aa->name, ia->name, sizeof(aa->name));
+ BLI_strncpy(aa->frameProp, ia->frameProp, sizeof(aa->frameProp));
if (ob->adt)
aa->act = ob->adt->action;
@@ -13651,8 +13651,8 @@ static void read_libraries(FileData *basefd, ListBase *mainlist)
printf(" enter a new path:\n");
if(scanf("%s", newlib_path) > 0) {
- strcpy(mainptr->curlib->name, newlib_path);
- strcpy(mainptr->curlib->filepath, newlib_path);
+ BLI_strncpy(mainptr->curlib->name, newlib_path, sizeof(mainptr->curlib->name));
+ BLI_strncpy(mainptr->curlib->filepath, newlib_path, sizeof(mainptr->curlib->filepath));
cleanup_path(G.main->name, mainptr->curlib->filepath);
fd= blo_openblenderfile(mainptr->curlib->filepath, basefd->reports);
@@ -13768,7 +13768,7 @@ static void read_libraries(FileData *basefd, ListBase *mainlist)
/* reading runtime */
-BlendFileData *blo_read_blendafterruntime(int file, char *name, int actualsize, ReportList *reports)
+BlendFileData *blo_read_blendafterruntime(int file, const char *name, int actualsize, ReportList *reports)
{
BlendFileData *bfd = NULL;
FileData *fd = filedata_new();
diff --git a/source/blender/blenloader/intern/runtime.c b/source/blender/blenloader/intern/runtime.c
index f5308b5ea5c..7a241e007f2 100644
--- a/source/blender/blenloader/intern/runtime.c
+++ b/source/blender/blenloader/intern/runtime.c
@@ -68,7 +68,7 @@ static int handle_read_msb_int(int handle)
return (buf[0]<<24) + (buf[1]<<16) + (buf[2]<<8) + (buf[3]<<0);
}
-int BLO_is_a_runtime(char *path)
+int BLO_is_a_runtime(const char *path)
{
int res= 0, fd= open(path, O_BINARY|O_RDONLY, 0);
int datastart;
@@ -97,7 +97,7 @@ cleanup:
return res;
}
-BlendFileData *BLO_read_runtime(char *path, ReportList *reports)
+BlendFileData *BLO_read_runtime(const char *path, ReportList *reports)
{
BlendFileData *bfd= NULL;
size_t actualsize;