fix for #190215. multi-line properties in string bundles don't work on win32.

this isn't a blocker, but it's bad enough to take for the respin.
patch by alecf.  r/sr=sspitzer, a=kyle
This commit is contained in:
sspitzer%netscape.com 2003-01-24 21:47:53 +00:00
Родитель b3fb20bc0e
Коммит b5757d961c
2 изменённых файлов: 25 добавлений и 9 удалений

Просмотреть файл

@ -224,8 +224,7 @@ mailnews.search_date_format=0
mailnews.search_date_separator=
# offline msg
nocachedbodybody =The body of this message has not been downloaded from \
nocachedbodybody=The body of this message has not been downloaded from \
the server for reading offline. To read this message, \
you must reconnect to the network, choose Offline from \
the File menu and then select Work Online.\
@ -241,10 +240,9 @@ mailAcctType=Mail
newsAcctType=News
# LOCALIZATION NOTES(nocachedbodytitle): Do not translate "<TITLE>" or "</TITLE>" in the line below
nocachedbodytitle=<TITLE>Go Online to View This Message</TITLE>\n\
nocachedbodytitle=<TITLE>Go Online to View This Message</TITLE>\n
# mailWindowOverlay.js
confirmUnsubscribeTitle=Confirm Unsubscribe
confirmUnsubscribeText=Are you sure you want to unsubscribe from %S?
cannotHaveTwoFilterRulesDialogs=Filter Rules Dialog

Просмотреть файл

@ -141,7 +141,8 @@ class nsParserState
{
public:
nsParserState(nsIPersistentProperties* aProps) :
mState(eParserState_AwaitingKey), mProps(aProps) {}
mState(eParserState_AwaitingKey), mHaveMultiLine(PR_FALSE),
mProps(aProps) {}
void WaitForKey() {
mState = eParserState_AwaitingKey;
@ -183,8 +184,9 @@ public:
// if we see a '\' then we enter this special state
PRUint32 mSpecialState;
PRUint32 mUnicodeValuesRead; // should be 4!
PRUnichar mUnicodeValue;
PRUint32 mUnicodeValuesRead; // should be 4!
PRUnichar mUnicodeValue; // currently parsed unicode value
PRBool mHaveMultiLine; // if this key is multi-line
private:
PRUint32 mState;
@ -263,19 +265,34 @@ ParseValueCharacter(nsParserState& aState, PRUnichar c,
case eParserSpecial_None:
switch (c) {
case '\\':
// handle multilines - since this is the beginning of a line,
// there's no value to append
if (aState.mHaveMultiLine)
aState.mHaveMultiLine = PR_FALSE;
else
aState.mValue += Substring(tokenStart, cur);
aState.mSpecialState = eParserSpecial_Escaped;
aState.mValue += Substring(tokenStart, cur);
break;
case '\n':
case '\r':
// ignore sequential line endings
if (aState.mHaveMultiLine)
break;
// we're done! We have a key and value
aState.mValue += Substring(tokenStart, cur);
aState.FinishValueState(oldValue);
break;
default:
// there is nothing to do with normal characters
// there is nothing to do with normal characters,
// but handle multilines correctly
if (aState.mHaveMultiLine) {
aState.mHaveMultiLine = PR_FALSE;
tokenStart = cur;
}
break;
}
break;
@ -314,6 +331,7 @@ ParseValueCharacter(nsParserState& aState, PRUnichar c,
// a \ immediately followed by a newline means we're going multiline
case '\r':
case '\n':
aState.mHaveMultiLine = PR_TRUE;
aState.mSpecialState = eParserSpecial_None;
break;