From 57c470408c8de49bf30d68498be52d4e0a275e22 Mon Sep 17 00:00:00 2001 From: tantric Date: Sat, 23 Nov 2013 23:35:01 +0000 Subject: [PATCH] fix SMB issues on synology DSM 4.3 --- changelog.txt | 4 ++ source/fileop.cpp | 117 +++++++++++++++++++++------------------------- source/wiimc.h | 2 +- update.xml | 4 +- 4 files changed, 61 insertions(+), 66 deletions(-) diff --git a/changelog.txt b/changelog.txt index 95d253dc..8f49839a 100644 --- a/changelog.txt +++ b/changelog.txt @@ -6,6 +6,10 @@ ¸,ø¤°`°¤ø,¸¸,ø¤°`°¤ø,¸,ø¤°`°¤ø,¸¸,ø¤°`°¤ø,¸,ø¤°`°¤ø,¸¸,ø¤°`°¤ø,¸,ø¤°`°¤ø,¸¸,ø¤ +[1.3.4 - November 23, 2013] + +* SMB support for Synology DSM 4.3 + [1.3.3 - March 31, 2013] * Fixed YouTube (thanks jhb50!) diff --git a/source/fileop.cpp b/source/fileop.cpp index 540f8bfd..12a1cb8c 100644 --- a/source/fileop.cpp +++ b/source/fileop.cpp @@ -1703,57 +1703,49 @@ static bool ParseDirEntries() if(entry == NULL) break; - if(strcmp(entry->d_name, "..") == 0) + if(strcmp(entry->d_name, "..") == 0 || entry->d_name[0] == '.' || entry->d_name[0] == '$') { - if(IsDeviceRoot(browser.dir)) - continue; - - filestat.st_mode = _IFDIR; + continue; } + + #ifdef _DIRENT_HAVE_D_TYPE + if(entry->d_type==DT_DIR) + filestat.st_mode = S_IFDIR; else + filestat.st_mode = S_IFREG; + + if(menuCurrent == MENU_BROWSE_PICTURES) { - if(entry->d_name[0] == '.' || entry->d_name[0] == '$') - continue; + #endif + snprintf(path, MAXPATHLEN, "%s%s", browser.dir, entry->d_name); - #ifdef _DIRENT_HAVE_D_TYPE - if(entry->d_type==DT_DIR) - filestat.st_mode = S_IFDIR; - else - filestat.st_mode = S_IFREG; + if(stat(path, &filestat) < 0) + continue; + #ifdef _DIRENT_HAVE_D_TYPE + } + #endif - if(menuCurrent == MENU_BROWSE_PICTURES) - { - #endif - snprintf(path, MAXPATHLEN, "%s%s", browser.dir, entry->d_name); - - if(stat(path, &filestat) < 0) - continue; - #ifdef _DIRENT_HAVE_D_TYPE - } - #endif + // skip this file if it's not an allowed extension + if(!S_ISDIR(filestat.st_mode)) + { + GetExt(entry->d_name, ext); - // skip this file if it's not an allowed extension - if(!S_ISDIR(filestat.st_mode)) + if(menuCurrent == MENU_BROWSE_VIDEOS && IsSubtitleExt(ext)) { - GetExt(entry->d_name, ext); - - if(menuCurrent == MENU_BROWSE_VIDEOS && IsSubtitleExt(ext)) + BROWSERENTRY *s_entry = AddEntrySubs(); + if(s_entry) + s_entry->file = mem2_strdup(entry->d_name, MEM2_BROWSER); + if(!s_entry->file) // no mem { - BROWSERENTRY *s_entry = AddEntrySubs(); - if(s_entry) - s_entry->file = mem2_strdup(entry->d_name, MEM2_BROWSER); - if(!s_entry->file) // no mem - { - DeleteEntrySubs(s_entry); - InfoPrompt("Warning", "This directory contains more entries than the maximum allowed. Not all entries will be visible."); - entry = NULL; - break; - } - } - - if(!IsAllowedExt(ext) && (!IsPlaylistExt(ext) || menuCurrent == MENU_BROWSE_PICTURES)) - continue; + DeleteEntrySubs(s_entry); + InfoPrompt("Warning", "This directory contains more entries than the maximum allowed. Not all entries will be visible."); + entry = NULL; + break; + } } + + if(!IsAllowedExt(ext) && (!IsPlaylistExt(ext) || menuCurrent == MENU_BROWSE_PICTURES)) + continue; } // add the entry @@ -1906,30 +1898,29 @@ ParseDirectory(bool waitParse) if(dirHandle == NULL) return -1; - if(IsDeviceRoot(browser.dir)) - { - BROWSERENTRY *f_entry = AddEntryFiles(); - - if(!f_entry) - return 0; + // add Up One Level + BROWSERENTRY *f_entry = AddEntryFiles(); + + if(!f_entry) + return 0; - f_entry->file = mem2_strdup("..", MEM2_BROWSER); - if(!f_entry->file) // no mem - { - DeleteEntryFiles(f_entry); - return 0; - } - f_entry->display = mem2_strdup(gettext("Up One Level"), MEM2_BROWSER); - if(!f_entry->display) // no mem - { - DeleteEntryFiles(f_entry); - return 0; - } - f_entry->length = 0; - f_entry->type = TYPE_FOLDER; // flag this as a dir - f_entry->icon = ICON_FOLDER; + f_entry->file = mem2_strdup("..", MEM2_BROWSER); + if(!f_entry->file) // no mem + { + DeleteEntryFiles(f_entry); + return 0; } - + f_entry->display = mem2_strdup(gettext("Up One Level"), MEM2_BROWSER); + if(!f_entry->display) // no mem + { + DeleteEntryFiles(f_entry); + return 0; + } + f_entry->length = 0; + f_entry->type = TYPE_FOLDER; // flag this as a dir + f_entry->icon = ICON_FOLDER; + + // start parsing parseHalt = 0; findLoadedFile = 1; ParseDirEntries(); // index first 20 entries diff --git a/source/wiimc.h b/source/wiimc.h index d960a374..b74e8fba 100644 --- a/source/wiimc.h +++ b/source/wiimc.h @@ -12,7 +12,7 @@ #include "network.h" #define APPNAME "WiiMC" -#define APPVERSION "1.3.3" +#define APPVERSION "1.3.4" #define APPFOLDER "wiimc" enum { diff --git a/update.xml b/update.xml index 31bd3d1f..1c06b3cc 100644 --- a/update.xml +++ b/update.xml @@ -1,4 +1,4 @@ - - + +