Skip to content

Commit

Permalink
fix SMB issues on synology DSM 4.3
Browse files Browse the repository at this point in the history
  • Loading branch information
tantric committed Nov 23, 2013
1 parent 5da316f commit 57c4704
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 66 deletions.
4 changes: 4 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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!)
Expand Down
117 changes: 54 additions & 63 deletions source/fileop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion source/wiimc.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include "network.h"

#define APPNAME "WiiMC"
#define APPVERSION "1.3.3"
#define APPVERSION "1.3.4"
#define APPFOLDER "wiimc"

enum {
Expand Down
4 changes: 2 additions & 2 deletions update.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<app version="1.3.3">
<file url="http://wiimc.googlecode.com/files/WiiMC%201.3.3%20(Update).zip"></file>
<app version="1.3.4">
<file url="http://wiimc.googlecode.com/files/WiiMC%201.3.4%20(Update).zip"></file>
</app>

0 comments on commit 57c4704

Please sign in to comment.