[ooo-build-commit] patches/dev300
Kohei Yoshida
kohei at kemper.freedesktop.org
Tue Jul 28 18:33: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 bea32504cbf60f51034a6ef45b7e44242b749174
Author: Kohei Yoshida <kyoshida at novell.com>
Date: Tue Jul 28 21:26:26 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 d674742..97e6ced 100644
--- a/patches/dev300/apply
+++ b/patches/dev300/apply
@@ -3367,6 +3367,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
+
# draw an animated dashed border around copied ranges.
calc-copy-range-animated-border-sc.diff, kohei
calc-copy-range-animated-border-svx.diff, kohei
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