[vlc-commits] skins2: fix .wsz problem
Erwan Tulou
git at videolan.org
Tue Mar 1 21:33:07 CET 2011
vlc/vlc-1.1 | branch: master | Erwan Tulou <erwan10 at videolan.org> | Tue Mar 1 16:45:15 2011 +0100| [c5d0c3088438e77ce94fa5b12e8fce16799bcc8c] | committer: Erwan Tulou
skins2: fix .wsz problem
filenames must always be forced to lower case in the case of .wsz files
(since the winamp2.xml expects them in this form)
> http://git.videolan.org/gitweb.cgi/vlc/vlc-1.1.git/?a=commit;h=c5d0c3088438e77ce94fa5b12e8fce16799bcc8c
---
modules/gui/skins2/src/ini_file.cpp | 4 +---
modules/gui/skins2/src/theme_loader.cpp | 18 ++++++++----------
modules/gui/skins2/src/theme_loader.hpp | 2 +-
3 files changed, 10 insertions(+), 14 deletions(-)
diff --git a/modules/gui/skins2/src/ini_file.cpp b/modules/gui/skins2/src/ini_file.cpp
index 7fe8282..58478d2 100644
--- a/modules/gui/skins2/src/ini_file.cpp
+++ b/modules/gui/skins2/src/ini_file.cpp
@@ -68,13 +68,11 @@ void IniFile::parseFile()
string name = m_name + "." + section + "." + var;
-#ifdef WIN32
// Convert to lower case because of some buggy winamp2 skins
- for( size_t i=0; i< name.size(); i++)
+ for( size_t i = 0; i < name.size(); i++ )
{
name[i] = tolower( name[i] );
}
-#endif
// Register the value in the var manager
pVarManager->registerConst( name, val );
diff --git a/modules/gui/skins2/src/theme_loader.cpp b/modules/gui/skins2/src/theme_loader.cpp
index 0d9cfd5..db535f5 100644
--- a/modules/gui/skins2/src/theme_loader.cpp
+++ b/modules/gui/skins2/src/theme_loader.cpp
@@ -154,6 +154,8 @@ bool ThemeLoader::extractTarGz( const string &tarFile, const string &rootDir )
bool ThemeLoader::extractZip( const string &zipFile, const string &rootDir )
{
+ bool b_isWsz = strstr( zipFile.c_str(), ".wsz" );
+
// Try to open the ZIP file
unzFile file = unzOpen( zipFile.c_str() );
unz_global_info info;
@@ -165,7 +167,7 @@ bool ThemeLoader::extractZip( const string &zipFile, const string &rootDir )
// Extract all the files in the archive
for( unsigned long i = 0; i < info.number_entry; i++ )
{
- if( !extractFileInZip( file, rootDir ) )
+ if( !extractFileInZip( file, rootDir, b_isWsz ) )
{
msg_Warn( getIntf(), "error while unzipping %s",
zipFile.c_str() );
@@ -190,7 +192,8 @@ bool ThemeLoader::extractZip( const string &zipFile, const string &rootDir )
}
-bool ThemeLoader::extractFileInZip( unzFile file, const string &rootDir )
+bool ThemeLoader::extractFileInZip( unzFile file, const string &rootDir,
+ bool isWsz )
{
// Read info for the current file
char filenameInZip[256];
@@ -202,16 +205,11 @@ bool ThemeLoader::extractFileInZip( unzFile file, const string &rootDir )
return false;
}
-#ifdef WIN32
-
// Convert the file name to lower case, because some winamp skins
// use the wrong case...
- for( size_t i=0; i< strlen( filenameInZip ); i++)
- {
- filenameInZip[i] = tolower( filenameInZip[i] );
- }
-
-#endif
+ if( isWsz )
+ for( size_t i = 0; i < strlen( filenameInZip ); i++ )
+ filenameInZip[i] = tolower( filenameInZip[i] );
// Allocate the buffer
void *pBuffer = malloc( ZIP_BUFFER_SIZE );
diff --git a/modules/gui/skins2/src/theme_loader.hpp b/modules/gui/skins2/src/theme_loader.hpp
index 52457d1..99d43ac 100644
--- a/modules/gui/skins2/src/theme_loader.hpp
+++ b/modules/gui/skins2/src/theme_loader.hpp
@@ -64,7 +64,7 @@ private:
/**
* Expects a string from the current locale.
*/
- bool extractFileInZip( unzFile file, const string &rootDir );
+ bool extractFileInZip( unzFile file, const string &rootDir, bool isWsz );
/// Clean up the temporary files created by the extraction
/**
More information about the vlc-commits
mailing list