[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Bug in ResText with double backslashes

From: <vss2svn_at_nogga.de>
Date: 2006-02-07 13:09:41 CET

Hello steveking,

I found that you added my bugfixes to the repository, thanks. I expect
due to my wrong tab and space formatting you had overseen, that I
intentionally removed the final else path in the StringCollapse
function. You need to increase the cPos counter after you replaced the
double backslashes. Otherwise it could happen, that you run into
following situation:

source string: "Hello \\n world"

which would be translated into

in the first loop: "Hello \n world"
and in the second loop: "Hello
World" (see the line break)

After the replacement of the character the cPos counter is still on the
replaced character which is in my bugfix case the "\" and this will
trigger the loop again.

Anyway it is save to move the cPos behind the replaced character for all
cases, since you will never want to query the replaced character itself
again.

Best regards
Dirk

vss2svn@nogga.de schrieb:
> Hi again,
>
> there is another bug in ResText when translating strings containing
> backslashes. The backslash is not converted into a double backslash
> and therefore the msgmerge utility will fail.
>
> Attached is a small fix
> Best regards
> Dirk
>
>
>
> Index: C:/src/tortoiseSVN/src/ResText/Utils.cpp
> ===================================================================
> --- C:/src/tortoiseSVN/src/ResText/Utils.cpp (revision 5619)
> +++ C:/src/tortoiseSVN/src/ResText/Utils.cpp (working copy)
> @@ -29,7 +29,20 @@
> void CUtils::StringExtend(LPTSTR str)
> {
> TCHAR * cPos = str;
> - do
> + do
> + {
> + cPos = _tcschr(cPos, '\\');
> + if (cPos)
> + {
> + memmove(cPos+1, cPos, _tcslen(cPos)*sizeof(TCHAR));
> + *cPos = '\\';
> + *(cPos+1) = '\\';
> + cPos++;
> + cPos++;
> + }
> + } while (cPos != NULL);
> + cPos = str;
> + do
> {
> cPos = _tcschr(cPos, '\n');
> if (cPos)
> @@ -104,10 +117,12 @@
> *cPos = '"';
> memmove(cPos+1, cPos+2,
> (_tcslen(cPos+2)+1)*sizeof(TCHAR));
> }
> - else
> - {
> - cPos++;
> - }
> + else if (*(cPos+1) == '\\')
> + {
> + *cPos = '\\';
> + memmove(cPos+1, cPos+2, (_tcslen(cPos+2)+1)*sizeof(TCHAR));
> + }
> + cPos++;
> }
> } while (cPos != NULL);
> }
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tortoisesvn.tigris.org
> For additional commands, e-mail: users-help@tortoisesvn.tigris.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tortoisesvn.tigris.org
For additional commands, e-mail: users-help@tortoisesvn.tigris.org
Received on Tue Feb 7 13:09:51 2006

This is an archived mail posted to the TortoiseSVN Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.