style cleanup: comments
[blender.git] / source / blender / editors / space_file / filelist.c
index ce522ec..9d5f7fd 100644 (file)
@@ -420,7 +420,7 @@ void filelist_free_icons(void)
        }
 }
 
-//-----------------FOLDERLIST (previous/next) --------------//
+/* -----------------FOLDERLIST (previous/next) -------------- */
 ListBase *folderlist_new(void)
 {
        ListBase *p = MEM_callocN(sizeof(ListBase), "folderlist");
@@ -520,7 +520,7 @@ static void filelist_read_main(struct FileList *filelist);
 static void filelist_read_library(struct FileList *filelist);
 static void filelist_read_dir(struct FileList *filelist);
 
-//------------------FILELIST------------------------//
+/* ------------------FILELIST------------------------ */
 FileList *filelist_new(short type)
 {
        FileList *p = MEM_callocN(sizeof(FileList), "filelist");
@@ -1225,21 +1225,22 @@ void filelist_from_main(struct FileList *filelist)
                        if (ok) {
                                if (!filelist->hide_dot || id->name[2] != '.') {
                                        memset(files, 0, sizeof(struct direntry));
-                                       if (id->lib == NULL)
+                                       if (id->lib == NULL) {
                                                files->relname = BLI_strdup(id->name + 2);
+                                       }
                                        else {
-                                               files->relname = MEM_mallocN(FILE_MAX + 32, "filename for lib");
-                                               sprintf(files->relname, "%s | %s", id->lib->name, id->name + 2);
+                                               files->relname = MEM_mallocN(FILE_MAX + (MAX_ID_NAME - 2),     "filename for lib");
+                                               BLI_snprintf(files->relname, FILE_MAX + (MAX_ID_NAME - 2) + 3, "%s | %s", id->lib->name, id->name + 2);
                                        }
                                        files->type |= S_IFREG;
-#if 0               // XXXXX TODO show the selection status of the objects
+#if 0               /* XXXXX TODO show the selection status of the objects */
                                        if (!filelist->has_func) { /* F4 DATA BROWSE */
                                                if (idcode == ID_OB) {
                                                        if ( ((Object *)id)->flag & SELECT) files->selflag |= SELECTED_FILE;
                                                }
                                                else if (idcode == ID_SCE) {
                                                        if ( ((Scene *)id)->r.scemode & R_BG_RENDER) files->selflag |= SELECTED_FILE;
-                                               }                                       
+                                               }
                                        }
 #endif
                                        files->nr = totbl + 1;
@@ -1248,10 +1249,10 @@ void filelist_from_main(struct FileList *filelist)
                                        if (idcode == ID_MA || idcode == ID_TE || idcode == ID_LA || idcode == ID_WO || idcode == ID_IM) {
                                                files->flags |= IMAGEFILE;
                                        }
-                                       if (id->lib && fake) BLI_snprintf(files->extra, sizeof(files->extra), "LF %d", id->us);
-                                       else if (id->lib) BLI_snprintf(files->extra, sizeof(files->extra), "L    %d", id->us);
-                                       else if (fake) BLI_snprintf(files->extra, sizeof(files->extra), "F    %d", id->us);
-                                       else BLI_snprintf(files->extra, sizeof(files->extra), "      %d", id->us);
+                                       if      (id->lib && fake) BLI_snprintf(files->extra, sizeof(files->extra), "LF %d",    id->us);
+                                       else if (id->lib)         BLI_snprintf(files->extra, sizeof(files->extra), "L    %d",  id->us);
+                                       else if (fake)            BLI_snprintf(files->extra, sizeof(files->extra), "F    %d",  id->us);
+                                       else                      BLI_snprintf(files->extra, sizeof(files->extra), "      %d", id->us);
                                        
                                        if (id->lib) {
                                                if (totlib == 0) firstlib = files;