Merged changes in the trunk up to revision 41225.
[blender-staging.git] / source / blender / blenloader / intern / readfile.c
index a5977a2fda0966f9f92fd232a5706a681d6ebf79..3df45d5783c502b5a03ac46f9d76ee3ce057623a 100644 (file)
@@ -3113,7 +3113,7 @@ static void direct_link_pointcache(FileData *fd, PointCache *cache)
                                pm->data[i] = newdataadr(fd, pm->data[i]);
                                
                                /* the cache saves non-struct data without DNA */
-                               if(pm->data[i] && strcmp(ptcache_data_struct[i], "")==0 && (fd->flags & FD_FLAGS_SWITCH_ENDIAN)) {
+                               if(pm->data[i] && ptcache_data_struct[i][0]=='\0' && (fd->flags & FD_FLAGS_SWITCH_ENDIAN)) {
                                        int j, tot= (BKE_ptcache_data_size (i) * pm->totpoint)/4; /* data_size returns bytes */
                                        int *poin= pm->data[i];
                                        
@@ -8850,7 +8850,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
                
                for (wo = main->world.first; wo; wo= wo->id.next) {
                        /* Migrate to Bullet for games, except for the NaN versions */
-                       /* People can still explicitely choose for Sumo (after 2.42 is out) */
+                       /* People can still explicitly choose for Sumo (after 2.42 is out) */
                        if(main->versionfile > 225)
                                wo->physicsEngine = WOPHY_BULLET;
                        if(WO_AODIST == wo->aomode)
@@ -9464,7 +9464,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;
@@ -9687,7 +9687,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);
@@ -9717,7 +9717,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);
@@ -10404,8 +10404,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
                {
                        if(scene->ed && scene->ed->seqbasep)
                        {
-                               for(seq = scene->ed->seqbasep->first; seq; seq = seq->next)
-                               {
+                               SEQ_BEGIN(scene->ed, seq) {
                                        if(seq->type == SEQ_HD_SOUND)
                                        {
                                                char str[FILE_MAX];
@@ -10425,6 +10424,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
                                                         seq->strip->dir);
                                        }
                                }
+                               SEQ_END
                        }
                }
 
@@ -12197,8 +12197,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;
 
@@ -13893,8 +13893,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);
@@ -14010,7 +14010,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();