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= mailnews.search_date_separator=
# offline msg # 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, \ the server for reading offline. To read this message, \
you must reconnect to the network, choose Offline from \ you must reconnect to the network, choose Offline from \
the File menu and then select Work Online.\ the File menu and then select Work Online.\
@ -241,10 +240,9 @@ mailAcctType=Mail
newsAcctType=News newsAcctType=News
# LOCALIZATION NOTES(nocachedbodytitle): Do not translate "<TITLE>" or "</TITLE>" in the line below # 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 # mailWindowOverlay.js
confirmUnsubscribeTitle=Confirm Unsubscribe confirmUnsubscribeTitle=Confirm Unsubscribe
confirmUnsubscribeText=Are you sure you want to unsubscribe from %S? confirmUnsubscribeText=Are you sure you want to unsubscribe from %S?
cannotHaveTwoFilterRulesDialogs=Filter Rules Dialog cannotHaveTwoFilterRulesDialogs=Filter Rules Dialog

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

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