Re: CVS: commit dom abi/src/wp/impexp/xp ie_mailmerge.cpp

From: J.M. Maurer <uwog_at_uwog.net>
Date: Fri Apr 07 2006 - 10:01:58 CEST

On Fri, 2006-04-07 at 03:55 +0000, cvs@abisource.com wrote:
> Update of /cvsroot/abi/src/wp/impexp/xp
> In directory abiword.snt.utwente.nl:/tmp/cvs-serv21207
>
> Modified Files:
> Tag: ABI-2-4-0-STABLE
> ie_mailmerge.cpp
> Log Message:
> support quoting mailmerge field bodies; fixes 8191. please forward-port

Can we do the
commit-to-head-and-then-backport-trick-especially-so-close-for-releases
next time? Just to create the fake impression that we do have a release
process in place... we've seen stuff break too often already close for a
release :) Ofcourse it's not that we don't trust your code Dom, because
you've never broken stuff like, say, link-grammar :-P

/me runs to update the changelog :)

  Marc

> Index: ie_mailmerge.cpp
> ===================================================================
> RCS file: /cvsroot/abi/src/wp/impexp/xp/ie_mailmerge.cpp,v
> retrieving revision 1.12
> retrieving revision 1.12.4.1
> diff -u -d -r1.12 -r1.12.4.1
> --- ie_mailmerge.cpp 18 May 2005 19:32:32 -0000 1.12
> +++ ie_mailmerge.cpp 7 Apr 2006 03:55:47 -0000 1.12.4.1
> @@ -591,6 +591,7 @@
>
> UT_uint32 lineno = 0;
> bool cont = true;
> + bool in_quotes = false;
>
> FILE * fp = fopen(szFilename, "rb");
> if (!fp)
> @@ -605,26 +606,53 @@
> // line 2..n == Data
>
> while (cont && (1 == fread (&ch, 1, 1, fp))){
> - if (ch == '\r')
> - continue;
> - else if (ch == '\n') {
> - defineItem (item, lineno == 0);
> - if (lineno != 0)
> - cont = fire ();
> - lineno++;
> - item.truncate (0);
> - continue;
> - }
> - else if (ch == m_delim) {
> - defineItem (item, lineno == 0);
> - item.truncate (0);
> + if (ch == '\r' && !in_quotes) // swallow carriage return unless in quoted block
> + continue;
> + else if (ch == '\n' && !in_quotes) { // newline. fire changeset
> + defineItem (item, lineno == 0);
> + item.truncate (0);
> + if (lineno != 0)
> + cont = fire ();
> + lineno++;
> + }
> + else if (ch == m_delim && !in_quotes) {
> + defineItem (item, lineno == 0);
> + item.truncate (0);
> + }
> + else if (ch == '"' && in_quotes) {
> + if (1 == fread (&ch, 1, 1, fp)) {
> + if (ch == '"') // 2 double quotes == escaped quote
> + item.append (&ch, 1);
> + else { // assume that it's the end of the quoted sequence and ch is the delimiter char or a newline
> + in_quotes = false;
> + defineItem (item, lineno == 0);
> + item.truncate (0);
> +
> + if (ch == '\n') {
> + if (lineno != 0)
> + cont = fire ();
> + lineno++;
> }
> - else
> - item.append(&ch, 1);
> + }
> + } else {
> + // eof??
> + defineItem (item, lineno == 0);
> + item.truncate (0);
> + in_quotes = false;
> + }
> + }
> + else if ((ch == '"') && !in_quotes && (item.getLength () == 0)) // beginning of a quoted sequence
> + in_quotes = true;
> + else // append whatever we're given
> + item.append(&ch, 1);
> }
>
> fclose (fp);
>
> + // if there's a non-empty line that wasn't terminated by a newline, fire it off
> + if (m_items.size())
> + fire ();
> +
> return UT_OK;
> }
>
>
> -----------------------------------------------
> To unsubscribe from this list, send a message to
> abisource-cvs-commit-request@abisource.com with the word
> unsubscribe in the message body.
Received on Fri Apr 7 10:01:22 2006

This archive was generated by hypermail 2.1.8 : Fri Apr 07 2006 - 10:01:23 CEST