# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1279210580 -10800 # Node ID e5e3f539dd557933bafe6809f293b495c3d343d1 # Parent d3300267661e18df4553318e76d4999a30319db7 Revision: 201025 Kit: 2010127 diff -r d3300267661e -r e5e3f539dd55 gfxconversion/mifconv/group/ReleaseNotes_Mifconv.txt --- a/gfxconversion/mifconv/group/ReleaseNotes_Mifconv.txt Tue May 11 16:43:53 2010 +0300 +++ b/gfxconversion/mifconv/group/ReleaseNotes_Mifconv.txt Thu Jul 15 19:16:20 2010 +0300 @@ -1,7 +1,7 @@ =============================================================================== -RELEASE NOTES - MIFCONV v3.2.1 -RELEASED 20th April 2010 +RELEASE NOTES - MIFCONV v3.2.2 +RELEASED 28th April 2010 SUPPORTS S60 3.2+ @@ -26,9 +26,10 @@ =============================================================================== -What's New in v3.2.1 +What's New in v3.2.2 ==================== -- Change: Added new default search directories for icon files. +- Fix: Mifconv now support the marking ".\" in front of a filename in Linux. +- Fix: Mifconv now compiles correctly in Linux. =============================================================================== @@ -66,6 +67,10 @@ Version History: ================ +Version 3.2.1 - 20th April 2010 +==================== +- Change: Added new default search directories for icon files. + Version 3.2.0 - 24th February 2010 ==================== - Change: Removed dependencies to BMCONV tool by adding the BMCONV encoding diff -r d3300267661e -r e5e3f539dd55 gfxconversion/mifconv/inc/mifconv_bitmapconverter.h --- a/gfxconversion/mifconv/inc/mifconv_bitmapconverter.h Tue May 11 16:43:53 2010 +0300 +++ b/gfxconversion/mifconv/inc/mifconv_bitmapconverter.h Thu Jul 15 19:16:20 2010 +0300 @@ -69,7 +69,7 @@ * Check first from argument manager if palette name has been given. * If not, use default palette file name. */ - const MifConvString MifConvBitmapConverter::GetPaletteFileName(); + const MifConvString GetPaletteFileName(); /** * Returns defaulta palette file name. diff -r d3300267661e -r e5e3f539dd55 gfxconversion/mifconv/inc/mifconv_util.h --- a/gfxconversion/mifconv/inc/mifconv_util.h Tue May 11 16:43:53 2010 +0300 +++ b/gfxconversion/mifconv/inc/mifconv_util.h Thu Jul 15 19:16:20 2010 +0300 @@ -99,6 +99,15 @@ */ static void ReplaceChar( MifConvString& str, char replaceFrom, char replaceTo); + /** + * Replaces given strings to other one from the given string. + * @param str String from which the characters will be replaced. + * @param replaceFrom This section of the str will be replaced by other one. + * @param replaceTo Characters will be replaced by this. + */ + static void ReplaceStr( MifConvString& str, + MifConvString replaceFrom, MifConvString replaceTo); + /** * Tells whether the given character is a whitespace character or not. * @param c Charater to be investigated. diff -r d3300267661e -r e5e3f539dd55 gfxconversion/mifconv/src/mifconv_iconbinaryconverter.cpp --- a/gfxconversion/mifconv/src/mifconv_iconbinaryconverter.cpp Tue May 11 16:43:53 2010 +0300 +++ b/gfxconversion/mifconv/src/mifconv_iconbinaryconverter.cpp Thu Jul 15 19:16:20 2010 +0300 @@ -175,9 +175,29 @@ */ void MifConvIconBinaryConverter::ConvertToBinaryFilename( MifConvString& input ) { + // Change "/" into "\". + MifConvUtil::ReplaceChar(input, INCORRECT_DIR_SEPARATOR2, DIR_SEPARATOR2); + + // Change "\.\" into "_". + MifConvString replace_str = ""; + replace_str += DIR_SEPARATOR2; + replace_str += '.'; + replace_str += DIR_SEPARATOR2; + MifConvUtil::ReplaceStr(input, replace_str, "_"); + + // Remove ".\" from start if existing. + replace_str = '.'; + replace_str += DIR_SEPARATOR2; + MifConvString::size_type index = input.find(replace_str, 0); + if (index == 0) { + input = input.substr(replace_str.length(), input.length()-replace_str.length()); + } + + // Change "\" into "_". MifConvUtil::ReplaceChar(input, DIR_SEPARATOR2, '_'); - MifConvUtil::ReplaceChar(input, INCORRECT_DIR_SEPARATOR2, '_'); + // Change ":" into "_". MifConvUtil::ReplaceChar(input, ':', '_'); + // Change " " into "_". MifConvUtil::ReplaceChar(input, ' ', '_'); } @@ -186,6 +206,7 @@ */ void MifConvIconBinaryConverter::RunExtConverter() { +#ifdef WIN32 MifConvArgumentManager* argMgr = MifConvArgumentManager::Instance(); // Build svgtbinencode command @@ -226,7 +247,7 @@ // Build temp filename by replacing dir separator and ':' chars with '_': MifConvString tmpFileName(i->Filename()); ConvertToBinaryFilename(tmpFileName); - + // Copy source file to temp directory: MifConvString to(iTempDir + tmpFileName); if( MifConvUtil::CopyFile(i->Filename(), to) == false ) @@ -238,6 +259,7 @@ // enclosed with quotation marks. If the whole string is enclosed with quotation marks then it works... // For example: command '"\epoc32\tools\bmconv" "somefile"' does not work while command // '""\epoc32\tools\bmconv" "somefile""' does. + if( system(MifConvString("\""+extConverterCommand+"\""+to+"\"\"").c_str()) < 0 ) { int ernro = errno; // The error number must check straight away before any next system command @@ -250,6 +272,98 @@ THROW_ERROR_COMMON(errStr, MifConvString(__FILE__), __LINE__ ); } } +#else + MifConvArgumentManager* argMgr = MifConvArgumentManager::Instance(); + + // Build svgtbinencode command + MifConvString extConverterCommand("\""); // Open the " mark + MifConvString versionArgument; + MifConvString sourceArgument; + + const MifConvString& extConverterPath = argMgr->StringValue(MifConvSvgencodePathArg); + const MifConvString& defaultExtConverterPath = GetDefaultExtConverterPath(); + if( extConverterPath.length() > 0 ) + { + extConverterCommand += extConverterPath; // If the path is given, use it. + } + else + { + extConverterCommand += defaultExtConverterPath; // Use default path + } + + // Ensure that the last char of the path is dir-separator: + if( extConverterCommand.length() > 1 && extConverterCommand.at(extConverterCommand.length()-1) != DIR_SEPARATOR2 ) + extConverterCommand += DIR_SEPARATOR; + + // Then add SVGTBINENCODE executable call and close the " mark + extConverterCommand += SVGTBINENCODE_EXECUTABLE_NAME + MifConvString("\" "); + + // If SVGTBINENCODE version is given, use it also: + const MifConvString& extConverterVersion = argMgr->StringValue(MifConvSvgtVersionArg); + if( extConverterVersion.length() > 0 ) + { + versionArgument = SVGTBINENCODE_OPTION_PREFIX + + MifConvString(SVGTBINENCODE_VERSION_PARAMETER) + " " + extConverterVersion; + extConverterCommand += versionArgument + " "; + } + + // Run converter for each of the source files: + for( MifConvSourceFileList::iterator i = iSourceFiles.begin(); i != iSourceFiles.end(); ++i ) + { + // Build temp filename by replacing dir separator and ':' chars with '_': + MifConvString tmpFileName(i->Filename()); + + MifConvString epoc = std::string(getenv("EPOCROOT")); + int len = epoc.length(); + bool isLongName = (epoc == tmpFileName.substr(0, len)); + + ConvertToBinaryFilename(tmpFileName); + MifConvString orig=tmpFileName; + + // temporarily skip EPOCROOT to avoid long filename problem in xercers and svgtbinencode + if(isLongName) + tmpFileName = tmpFileName.substr(len); + + + // Copy source file to temp directory: + MifConvString to(iTempDir + tmpFileName); + if( MifConvUtil::CopyFile(i->Filename(), to) == false ) + { + THROW_ERROR_COMMON("File copy failed: " + to, MifConvString(__FILE__), __LINE__ ); + } + iTempFilenames.push_back(iTempDir + orig); + // It seems that system() function does not work if the command consists of two separate parts + // enclosed with quotation marks. If the whole string is enclosed with quotation marks then it works... + // For example: command '"\epoc32\tools\bmconv" "somefile"' does not work while command + // '""\epoc32\tools\bmconv" "somefile""' does. + + if( system(MifConvString(extConverterCommand+"\""+to+"\"").c_str()) < 0 ) + { + int ernro = errno; // The error number must check straight away before any next system command + + MifConvString errStr("Executing SVGTBINENCODE failed"); + if( ernro ) + { + errStr += ", system error = " + MifConvUtil::ToString(ernro); // Possible system error. + } + THROW_ERROR_COMMON(errStr, MifConvString(__FILE__), __LINE__ ); + } + + if(isLongName) + { + // restore original long filename, corresponding to iSourceFiles. + rename(to.c_str(), (iTempDir + orig).c_str()); + + MifConvString n1 = MifConvUtil::FilenameWithoutExtension(tmpFileName) + + "." + SVGB_BINARY_FILE_EXTENSION; + MifConvString n2 = MifConvUtil::FilenameWithoutExtension(orig) + + "." + SVGB_BINARY_FILE_EXTENSION; + + rename((iTempDir + n1).c_str(), (iTempDir + n2).c_str()); + } + } + +#endif } /** diff -r d3300267661e -r e5e3f539dd55 gfxconversion/mifconv/src/mifconv_util.cpp --- a/gfxconversion/mifconv/src/mifconv_util.cpp Tue May 11 16:43:53 2010 +0300 +++ b/gfxconversion/mifconv/src/mifconv_util.cpp Thu Jul 15 19:16:20 2010 +0300 @@ -28,6 +28,7 @@ #endif #include // for _MAX_PATH #include +#include #ifndef _MAX_PATH #define _MAX_PATH (260) @@ -192,6 +193,26 @@ /** * */ +void MifConvUtil::ReplaceStr( MifConvString& str, + MifConvString replaceFrom, MifConvString replaceTo) +{ + if( str.length() >= replaceFrom.length() ) + { + MifConvString::size_type index = 0; + while( (index = str.find(replaceFrom, index)) != MifConvString::npos ) + { + MifConvString tmp_str = str.substr(0, index); + tmp_str = tmp_str + replaceTo; + str = tmp_str + str.substr(index+replaceFrom.length(), + str.length()-index+replaceFrom.length() + ); + } + } +} + +/** + * + */ void MifConvUtil::SplitPath( const MifConvString& sourcePath, MifConvString& drive, MifConvString& path) { if( sourcePath.length() > 0 )