[Libreoffice-commits] core.git: Branch 'private/lmamane/for-julien2412-master' - 3 commits - configure.ac sc/source

Lionel Elie Mamane lionel at mamane.lu
Wed Jun 28 01:56:35 UTC 2017


 configure.ac                    |    2 
 sc/source/ui/unoobj/filtuno.cxx |  107 +++++++++++++++++++++++-----------------
 2 files changed, 65 insertions(+), 44 deletions(-)

New commits:
commit 536768846427e9e9d1065c1ab91fd6205eaf2d52
Author: Lionel Elie Mamane <lionel at mamane.lu>
Date:   Wed Jun 28 03:55:33 2017 +0200

    check for end of file, correct comment
    
    Change-Id: I8262651019364b5a2a927667cfd31555d03e6eab

diff --git a/sc/source/ui/unoobj/filtuno.cxx b/sc/source/ui/unoobj/filtuno.cxx
index cacf6956110b..c58ba5a4914b 100644
--- a/sc/source/ui/unoobj/filtuno.cxx
+++ b/sc/source/ui/unoobj/filtuno.cxx
@@ -103,9 +103,8 @@ namespace
                 dbf_Stream->SetEndian(SvStreamEndian::LITTLE);
 
                 dbf_Stream->Seek(STREAM_SEEK_TO_BEGIN + 29);
-               // TODO : how to check this?
-               // if (seek_succeeded_ie_not_end_of_file)
-                //{
+                if (! dbf_Stream->IsEof())
+                {
                     sal_uInt8 nEncoding=0;
                     dbf_Stream->ReadUChar( nEncoding );
                     if (nEncoding != 0x00)
@@ -148,9 +147,8 @@ namespace
                             return charsetSource::charset_from_file;
                         }
                     }
-                //}
+                }
             }
-            // dbf_Stream goes out of scope, is automatically closed
         }
         {
             Sequence<Any> aValues;
@@ -361,6 +359,7 @@ sal_Int16 SAL_CALL ScFilterOptionsObj::execute()
                    break;
             }
             bDBEnc = true;
+            // pInStream goes out of scope, the stream is automatically closed
         }
         else if ( aFilterString == ScDocShell::GetDifFilterName() )
         {
commit df18d9d5d7acef2612916ede1e54902c6b440111
Author: Lionel Elie Mamane <lionel at mamane.lu>
Date:   Wed Jun 28 03:55:00 2017 +0200

    we need gpgme header, too
    
    not only gpgmepp headers
    
    Change-Id: I46723ce751d631e165982c6c7bc2f820f9a5d0a8

diff --git a/configure.ac b/configure.ac
index 36f6ccebf452..0eb7ed7150a1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -10281,6 +10281,8 @@ if test "$_os" = "Linux"; then
         # checking for it also filters out older, KDE-dependent libgpgmepp versions
         AC_CHECK_LIB(gpgmepp, progress_callback, [ GPGMEPP_LIBS=-lgpgmepp ],
             [AC_MSG_ERROR(gpgmepp not found or not functional)], [])
+        AC_CHECK_HEADER(gpgme.h, [],
+            [AC_MSG_ERROR([gpgme headers not found, install gpgme development package])], [])
     else
         AC_MSG_RESULT([internal])
         BUILD_TYPE="$BUILD_TYPE LIBGPGERROR LIBASSUAN GPGMEPP"
commit f3e471f6434bb7b84de1fd1c75545a4d339119d6
Author: Lionel Elie Mamane <lionel at mamane.lu>
Date:   Wed Jun 28 03:03:02 2017 +0200

    julien it compiles patch
    
    Change-Id: I89fa48dda0d907fa0bdcc49be373ed1b1cfd8c73

diff --git a/sc/source/ui/unoobj/filtuno.cxx b/sc/source/ui/unoobj/filtuno.cxx
index 6b0d56cfd565..cacf6956110b 100644
--- a/sc/source/ui/unoobj/filtuno.cxx
+++ b/sc/source/ui/unoobj/filtuno.cxx
@@ -68,13 +68,25 @@ namespace
         charset_from_user_setting,
         charset_default
     };
-
-    charsetSource load_CharSet( rtl_TextEncoding &nCharSet, bool bExport, string_or_url fname )
+    // TODO: use DTable.hxx instead
+            enum DBFType  { dBaseIII         = 0x03,
+                            dBaseIV          = 0x04,
+                            dBaseV           = 0x05,
+                            VisualFoxPro     = 0x30,
+                            VisualFoxProAuto = 0x31, // Visual FoxPro with AutoIncrement field
+                            dBaseFS          = 0x43,
+                            dBaseFSMemo      = 0xB3,
+                            dBaseIIIMemo     = 0x83,
+                            dBaseIVMemo      = 0x8B,
+                            dBaseIVMemoSQL   = 0x8E,
+                            FoxProMemo       = 0xF5
+                          };
+
+    charsetSource load_CharSet(rtl_TextEncoding &nCharSet, bool bExport, SvStream* dbf_Stream)
     {
         {
-            lo_stream dbfStream(fname, ...);
             sal_uInt8 nType=0;
-            dbfStream.ReadUChar( nType );
+            dbf_Stream->ReadUChar( nType );
 
             switch (nType)
             {
@@ -88,56 +100,57 @@ namespace
             case dBaseIVMemoSQL:
             case dBaseIIIMemo:
             case FoxProMemo:
-                dbfStream.SetEndian(SvStreamEndian::LITTLE);
+                dbf_Stream->SetEndian(SvStreamEndian::LITTLE);
 
-                dbf_stream.Seek(STREAM_SEEK_TO_BEGIN + 29);
-                if (seek_succeeded_ie_not_end_of_file)
-                {
+                dbf_Stream->Seek(STREAM_SEEK_TO_BEGIN + 29);
+               // TODO : how to check this?
+               // if (seek_succeeded_ie_not_end_of_file)
+                //{
                     sal_uInt8 nEncoding=0;
-                    dbfStream.ReadUChar( nEncoding );
+                    dbf_Stream->ReadUChar( nEncoding );
                     if (nEncoding != 0x00)
                     {
                         auto eEncoding(RTL_TEXTENCODING_DONTKNOW);
-                        switch(m_aHeader.db_frei[17])
+                        switch(nEncoding)
                         {
-                        case 0x01: m_eEncoding = RTL_TEXTENCODING_IBM_437; break;       // DOS USA  code page 437
-                        case 0x02: m_eEncoding = RTL_TEXTENCODING_IBM_850; break;       // DOS Multilingual code page 850
-                        case 0x03: m_eEncoding = RTL_TEXTENCODING_MS_1252; break;       // Windows ANSI code page 1252
-                        case 0x04: m_eEncoding = RTL_TEXTENCODING_APPLE_ROMAN; break;   // Standard Macintosh
-                        case 0x64: m_eEncoding = RTL_TEXTENCODING_IBM_852; break;       // EE MS-DOS    code page 852
-                        case 0x65: m_eEncoding = RTL_TEXTENCODING_IBM_866; break;       // Russian MS-DOS   code page 866
-                        case 0x66: m_eEncoding = RTL_TEXTENCODING_IBM_865; break;       // Nordic MS-DOS    code page 865
-                        case 0x67: m_eEncoding = RTL_TEXTENCODING_IBM_861; break;       // Icelandic MS-DOS
-                        //case 0x68: m_eEncoding = ; break;     // Kamenicky (Czech) MS-DOS
-                        //case 0x69: m_eEncoding = ; break;     // Mazovia (Polish) MS-DOS
-                        case 0x6A: m_eEncoding = RTL_TEXTENCODING_IBM_737; break;       // Greek MS-DOS (437G)
-                        case 0x6B: m_eEncoding = RTL_TEXTENCODING_IBM_857; break;       // Turkish MS-DOS
-                        case 0x6C: m_eEncoding = RTL_TEXTENCODING_IBM_863; break;       // MS-DOS, Canada
-                        case 0x78: m_eEncoding = RTL_TEXTENCODING_MS_950; break;        // Windows, Traditional Chinese
-                        case 0x79: m_eEncoding = RTL_TEXTENCODING_MS_949; break;        // Windows, Korean (Hangul)
-                        case 0x7A: m_eEncoding = RTL_TEXTENCODING_MS_936; break;        // Windows, Simplified Chinese
-                        case 0x7B: m_eEncoding = RTL_TEXTENCODING_MS_932; break;        // Windows, Japanese (Shift-jis)
-                        case 0x7C: m_eEncoding = RTL_TEXTENCODING_MS_874; break;        // Windows, Thai
-                        case 0x7D: m_eEncoding = RTL_TEXTENCODING_MS_1255; break;       // Windows, Hebrew
-                        case 0x7E: m_eEncoding = RTL_TEXTENCODING_MS_1256; break;       // Windows, Arabic
-                        case 0x96: m_eEncoding = RTL_TEXTENCODING_APPLE_CYRILLIC; break;    // Russian Macintosh
-                        case 0x97: m_eEncoding = RTL_TEXTENCODING_APPLE_CENTEURO; break;    // Eastern European Macintosh
-                        case 0x98: m_eEncoding = RTL_TEXTENCODING_APPLE_GREEK; break;   // Greek Macintosh
-                        case 0xC8: m_eEncoding = RTL_TEXTENCODING_MS_1250; break;       // Windows EE   code page 1250
-                        case 0xC9: m_eEncoding = RTL_TEXTENCODING_MS_1251; break;       // Russian Windows
-                        case 0xCA: m_eEncoding = RTL_TEXTENCODING_MS_1254; break;       // Turkish Windows
-                        case 0xCB: m_eEncoding = RTL_TEXTENCODING_MS_1253; break;       // Greek Windows
-                        case 0xCC: m_eEncoding = RTL_TEXTENCODING_MS_1257; break;       // Windows, Baltic
+                        case 0x01: eEncoding = RTL_TEXTENCODING_IBM_437; break;       // DOS USA  code page 437
+                        case 0x02: eEncoding = RTL_TEXTENCODING_IBM_850; break;       // DOS Multilingual code page 850
+                        case 0x03: eEncoding = RTL_TEXTENCODING_MS_1252; break;       // Windows ANSI code page 1252
+                        case 0x04: eEncoding = RTL_TEXTENCODING_APPLE_ROMAN; break;   // Standard Macintosh
+                        case 0x64: eEncoding = RTL_TEXTENCODING_IBM_852; break;       // EE MS-DOS    code page 852
+                        case 0x65: eEncoding = RTL_TEXTENCODING_IBM_866; break;       // Russian MS-DOS   code page 866
+                        case 0x66: eEncoding = RTL_TEXTENCODING_IBM_865; break;       // Nordic MS-DOS    code page 865
+                        case 0x67: eEncoding = RTL_TEXTENCODING_IBM_861; break;       // Icelandic MS-DOS
+                        //case 0x68: eEncoding = ; break;     // Kamenicky (Czech) MS-DOS
+                        //case 0x69: eEncoding = ; break;     // Mazovia (Polish) MS-DOS
+                        case 0x6A: eEncoding = RTL_TEXTENCODING_IBM_737; break;       // Greek MS-DOS (437G)
+                        case 0x6B: eEncoding = RTL_TEXTENCODING_IBM_857; break;       // Turkish MS-DOS
+                        case 0x6C: eEncoding = RTL_TEXTENCODING_IBM_863; break;       // MS-DOS, Canada
+                        case 0x78: eEncoding = RTL_TEXTENCODING_MS_950; break;        // Windows, Traditional Chinese
+                        case 0x79: eEncoding = RTL_TEXTENCODING_MS_949; break;        // Windows, Korean (Hangul)
+                        case 0x7A: eEncoding = RTL_TEXTENCODING_MS_936; break;        // Windows, Simplified Chinese
+                        case 0x7B: eEncoding = RTL_TEXTENCODING_MS_932; break;        // Windows, Japanese (Shift-jis)
+                        case 0x7C: eEncoding = RTL_TEXTENCODING_MS_874; break;        // Windows, Thai
+                        case 0x7D: eEncoding = RTL_TEXTENCODING_MS_1255; break;       // Windows, Hebrew
+                        case 0x7E: eEncoding = RTL_TEXTENCODING_MS_1256; break;       // Windows, Arabic
+                        case 0x96: eEncoding = RTL_TEXTENCODING_APPLE_CYRILLIC; break;    // Russian Macintosh
+                        case 0x97: eEncoding = RTL_TEXTENCODING_APPLE_CENTEURO; break;    // Eastern European Macintosh
+                        case 0x98: eEncoding = RTL_TEXTENCODING_APPLE_GREEK; break;   // Greek Macintosh
+                        case 0xC8: eEncoding = RTL_TEXTENCODING_MS_1250; break;       // Windows EE   code page 1250
+                        case 0xC9: eEncoding = RTL_TEXTENCODING_MS_1251; break;       // Russian Windows
+                        case 0xCA: eEncoding = RTL_TEXTENCODING_MS_1254; break;       // Turkish Windows
+                        case 0xCB: eEncoding = RTL_TEXTENCODING_MS_1253; break;       // Greek Windows
+                        case 0xCC: eEncoding = RTL_TEXTENCODING_MS_1257; break;       // Windows, Baltic
                         }
                         if(eEncoding != RTL_TEXTENCODING_DONTKNOW)
                         {
                             nCharSet = eEncoding;
-                            return charset_from_file;
+                            return charsetSource::charset_from_file;
                         }
                     }
-                }
+                //}
             }
-            // dbfStream goes out of scope, is automatically closed
+            // dbf_Stream goes out of scope, is automatically closed
         }
         {
             Sequence<Any> aValues;
@@ -156,13 +169,13 @@ namespace
                 if( nChar >= 0)
                 {
                     nCharSet = (rtl_TextEncoding) nChar;
-                    return charset_from_user_setting;
+                    return charsetSource::charset_from_user_setting;
                 }
             }
 
             // Default choice
             nCharSet = RTL_TEXTENCODING_IBM_850;
-            return charset_default;
+            return charsetSource::charset_default;
         }
     }
 
@@ -335,10 +348,17 @@ sal_Int16 SAL_CALL ScFilterOptionsObj::execute()
                 //  dBase import
                 aTitle = ScGlobal::GetRscString( STR_IMPORT_DBF );
             }
-            switch(load_CharSet( eEncoding, bExport, aFileName ))
+
+            std::unique_ptr<SvStream> pInStream;
+            if ( xInputStream.is() )
+                pInStream.reset(utl::UcbStreamHelper::CreateStream( xInputStream ));
+            switch(load_CharSet( eEncoding, bExport, pInStream.get()))
             {
-            case charset_from_file:
-                skipDialog = true;
+                case charsetSource::charset_from_file:
+                  skipDialog = true;break;
+                case charsetSource::charset_from_user_setting:
+                case charsetSource::charset_default:
+                   break;
             }
             bDBEnc = true;
         }


More information about the Libreoffice-commits mailing list