[ooo-build-commit] Branch 'ooo-build-3-1' - patches/dev300

Kohei Yoshida kohei at kemper.freedesktop.org
Tue Jul 28 18:36:42 PDT 2009


 patches/dev300/apply                                   |    4 +
 patches/dev300/stream-read-csv-always-single-line.diff |   52 +++++++++++++++++
 2 files changed, 56 insertions(+)

New commits:
commit 0167abff05d5bb66fc11da8791686bc9ead0c5b6
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Tue Jul 28 21:35:31 2009 -0400

    When reading csv stream, don't read multiple lines.
    
    * patches/dev300/apply: add the new patch in CalcExperimental.
    
    * patches/dev300/stream-read-csv-always-single-line.diff: terminate
      each line when the line break reaches, even in the middle of an
      open quoted sequence.  This behavior is in line with how Excel
      handles csv import. (n#523517)

diff --git a/patches/dev300/apply b/patches/dev300/apply
index beabe3f..ef3aca8 100644
--- a/patches/dev300/apply
+++ b/patches/dev300/apply
@@ -3031,6 +3031,10 @@ calc-formula-externref-countif-fix.diff, n#521624, i#102750, kohei
 
 calc-xls-import-shared-formula-refwrap.diff, n#522833, i#103861, kohei
 
+# when reading csv file, don't read multiple physical lines for one logical 
+# line even if matching quotes are on separate lines.
+stream-read-csv-always-single-line.diff, n#523517, kohei
+
 
 [ UbuntuHardyOnly ]
 # Add patch to only show local files needed when gnome-vfs/gio is disabled
diff --git a/patches/dev300/stream-read-csv-always-single-line.diff b/patches/dev300/stream-read-csv-always-single-line.diff
new file mode 100644
index 0000000..63933ea
--- /dev/null
+++ b/patches/dev300/stream-read-csv-always-single-line.diff
@@ -0,0 +1,52 @@
+diff --git tools/inc/tools/stream.hxx tools/inc/tools/stream.hxx
+index a8f0874..b8334db 100644
+--- tools/inc/tools/stream.hxx
++++ tools/inc/tools/stream.hxx
+@@ -535,6 +535,13 @@ public:
+                     If sal_True, an embedded quote character inside a quoted
+                     field may also be escaped with a preceding backslash.
+                     Normally, quotes are escaped by doubling them.
++                    
++                    @param bAllowQuotedMultiLine
++                    If true, a quoted sequence may have line breaks, which
++                    means multiple lines may be read if the opening and
++                    closing quotes are on different lines.  If false, then
++                    only a single line is read even when the closing quote of
++                    a quoted seqence is not reached.
+ 
+                     @return
+                     sal_True if no stream error.
+@@ -557,7 +564,7 @@ public:
+                   */
+     sal_Bool        ReadCsvLine( String& rStr, sal_Bool bEmbeddedLineBreak,
+                         const String& rFieldSeparators, sal_Unicode cFieldQuote,
+-                        sal_Bool bAllowBackslashEscape = sal_False);
++                        sal_Bool bAllowBackslashEscape = sal_False, bool bAllowQuotedMultiLine = false);
+ 
+     void			SetBufferSize( sal_uInt16 nBufSize );
+     sal_uInt16	GetBufferSize() const { return nBufSize; }
+diff --git tools/source/stream/stream.cxx tools/source/stream/stream.cxx
+index ae4dfff..bb9421f 100644
+--- tools/source/stream/stream.cxx
++++ tools/source/stream/stream.cxx
+@@ -1089,7 +1089,7 @@ inline const sal_Unicode* lcl_UnicodeStrChr( const sal_Unicode* pStr,
+ 
+ sal_Bool SvStream::ReadCsvLine( String& rStr, sal_Bool bEmbeddedLineBreak,
+         const String& rFieldSeparators, sal_Unicode cFieldQuote,
+-        sal_Bool bAllowBackslashEscape)
++        sal_Bool bAllowBackslashEscape, bool bAllowQuotedMultiLine)
+ {
+     ReadUniOrByteStringLine( rStr);
+ 
+@@ -1126,6 +1126,11 @@ sal_Bool SvStream::ReadCsvLine( String& rStr, sal_Bool bEmbeddedLineBreak,
+                 ++p;
+             }
+ 
++            if (!bAllowQuotedMultiLine)
++                // Don't read more than a single line even if a quoted
++                // sequence has not reached its closing quote.
++                break;
++
+             if (nQuotes % 2 == 0)
+                 break;
+             else


More information about the ooo-build-commit mailing list