Catchup to latest Symbian^4 GCC_SURGE
authorWilliam Roberts <williamr@symbian.org>
Thu, 22 Jul 2010 16:38:28 +0100
branchGCC_SURGE
changeset 24 721cfe18efd0
parent 20 ea46263362ca (current diff)
parent 23 535624a8d239 (diff)
Catchup to latest Symbian^4
--- a/gfxconversion/group/bld.inf	Fri Jun 11 16:29:29 2010 +0100
+++ b/gfxconversion/group/bld.inf	Thu Jul 22 16:38:28 2010 +0100
@@ -18,6 +18,6 @@
 -----------------------------------------------------------------------------
 */
 
-#include "../bmconv_s60/group/bld.inf"
+// Removed bmconv from builds #include "../bmconv_s60/group/bld.inf"
 #include "../mifconv/group/bld.inf"
 
--- a/gfxconversion/mifconv/group/ReleaseNotes_Mifconv.txt	Fri Jun 11 16:29:29 2010 +0100
+++ b/gfxconversion/mifconv/group/ReleaseNotes_Mifconv.txt	Thu Jul 22 16:38:28 2010 +0100
@@ -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 
--- a/gfxconversion/mifconv/inc/mifconv_bitmapconverter.h	Fri Jun 11 16:29:29 2010 +0100
+++ b/gfxconversion/mifconv/inc/mifconv_bitmapconverter.h	Thu Jul 22 16:38:28 2010 +0100
@@ -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.
--- a/gfxconversion/mifconv/inc/mifconv_util.h	Fri Jun 11 16:29:29 2010 +0100
+++ b/gfxconversion/mifconv/inc/mifconv_util.h	Thu Jul 22 16:38:28 2010 +0100
@@ -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.
--- a/gfxconversion/mifconv/src/mifconv_iconbinaryconverter.cpp	Fri Jun 11 16:29:29 2010 +0100
+++ b/gfxconversion/mifconv/src/mifconv_iconbinaryconverter.cpp	Thu Jul 22 16:38:28 2010 +0100
@@ -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
 }
 
 /**
--- a/gfxconversion/mifconv/src/mifconv_util.cpp	Fri Jun 11 16:29:29 2010 +0100
+++ b/gfxconversion/mifconv/src/mifconv_util.cpp	Thu Jul 22 16:38:28 2010 +0100
@@ -28,6 +28,7 @@
 #endif
 #include <stdlib.h>     // for _MAX_PATH
 #include <stdio.h>
+#include <cctype>
 
 #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 )