X-Git-Url: http://git.cinelerra-gg.org/git/?a=blobdiff_plain;f=cinelerra-5.1%2Fguicast%2Ffilesystem.C;h=1d0aee887127385affb67d6f34dec726389437cd;hb=a6369311556cc1e1877142181d8606e4f68aa803;hp=9beef424e09af374686870fbbe94c7d86aa99a54;hpb=78555663c7d2d1148808014cc7ada53255c0c305;p=goodguy%2Fhistory.git diff --git a/cinelerra-5.1/guicast/filesystem.C b/cinelerra-5.1/guicast/filesystem.C index 9beef424..1d0aee88 100644 --- a/cinelerra-5.1/guicast/filesystem.C +++ b/cinelerra-5.1/guicast/filesystem.C @@ -44,8 +44,7 @@ FileItem::FileItem() } FileItem::FileItem(char *path, char *name, int is_dir, - int64_t size, int month, int day, int year, - int64_t calendar_time, int item_no) + int64_t size, time_t mtime, int item_no) { this->path = new char[strlen(path)]; this->name = new char[strlen(name)]; @@ -53,10 +52,7 @@ FileItem::FileItem(char *path, char *name, int is_dir, if(this->name) strcpy(this->name, name); this->is_dir = is_dir; this->size = size; - this->month = month; - this->day = day; - this->year = year; - this->calendar_time = calendar_time; + this->mtime = mtime; this->item_no = item_no; } @@ -73,10 +69,7 @@ int FileItem::reset() name = 0; is_dir = 0; size = 0; - month = 0; - day = 0; - year = 0; - calendar_time = 0; + mtime = 0; item_no = -1; return 0; } @@ -206,18 +199,18 @@ int FileSystem::date_ascending(const void *ptr1, const void *ptr2) { FileItem *item1 = *(FileItem**)ptr1; FileItem *item2 = *(FileItem**)ptr2; - return item1->calendar_time == item2->calendar_time ? + return item1->mtime == item2->mtime ? item1->item_no - item2->item_no : - item1->calendar_time > item2->calendar_time; + item1->mtime > item2->mtime; } int FileSystem::date_descending(const void *ptr1, const void *ptr2) { FileItem *item1 = *(FileItem**)ptr1; FileItem *item2 = *(FileItem**)ptr2; - return item2->calendar_time == item1->calendar_time ? + return item2->mtime == item1->mtime ? item2->item_no - item1->item_no : - item2->calendar_time > item1->calendar_time; + item2->mtime > item1->mtime; } int FileSystem::ext_ascending(const void *ptr1, const void *ptr2) @@ -449,11 +442,7 @@ int FileSystem::scan_directory(const char *new_dir) if(!stat(full_path, &ostat)) { new_file->size = ostat.st_size; - struct tm *mod_time = localtime(&(ostat.st_mtime)); - new_file->month = mod_time->tm_mon + 1; - new_file->day = mod_time->tm_mday; - new_file->year = mod_time->tm_year + 1900; - new_file->calendar_time = ostat.st_mtime; + new_file->mtime = ostat.st_mtime; if(S_ISDIR(ostat.st_mode)) { @@ -481,6 +470,7 @@ int FileSystem::scan_directory(const char *new_dir) delete new_file; } } + closedir(dirstream); return 0; }