Closed
Bug 406169
Opened 17 years ago
Closed 17 years ago
Move some of nsIDBFolderInfo to ns*String and help migration to frozen linkage
Categories
(MailNews Core :: Backend, defect)
MailNews Core
Backend
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: standard8, Assigned: standard8)
References
Details
Attachments
(1 file, 4 obsolete files)
39.79 KB,
patch
|
neil
:
review+
philor
:
review+
neil
:
superreview+
|
Details | Diff | Splinter Review |
I was looking at migrating some more of mailnews/base to frozen linkage and it quickly became clear that moving some more of the nsIDBFolderInfo from string to nsCString would be a lot more sensible than reworking the code twice.
Hence patch attached does some string tidy up in nsIDBFolderInfo (and the associated changes) and there's a couple of small frozen linkage changes in there.
Note, I also decided it was approprate to rename {G,S}etCharPtrProperty to {G,S}CharProperty now we're no longer using string pointers there.
Neil, can you review the mailnews changes, Phil could you review the TB-specific changes?
Attachment #290873 -
Flags: superreview?(neil)
Attachment #290873 -
Flags: review?(philringnalda)
Attachment #290873 -
Flags: review?(neil)
Assignee | ||
Comment 1•17 years ago
|
||
Correct version, this has an optimisation to an if statement that I forgot to regenerate the patch for.
Attachment #290873 -
Attachment is obsolete: true
Attachment #290875 -
Flags: superreview?(neil)
Attachment #290875 -
Flags: review?(philringnalda)
Attachment #290875 -
Flags: review?(neil)
Attachment #290873 -
Flags: superreview?(neil)
Attachment #290873 -
Flags: review?(philringnalda)
Attachment #290873 -
Flags: review?(neil)
Comment 2•17 years ago
|
||
Comment on attachment 290875 [details] [diff] [review]
The fix v2
>+ ACString getCharProperty(in ACString propertyName);
>+ void setCharProperty(in ACString aPropertyName, in ACString aPropertyValue);
Although it is correct to make the values ACString, the property names themselves should stay string.
> void getCharacterSet(out ACString charSet, out boolean overriden);
>- void setCharacterSet(in string charSet);
>+ void setCharacterSet(in ACString charSet);
>
> attribute boolean characterSetOverride;
>
>- string getCharPtrCharacterSet();
>+ readonly attribute ACString charPtrCharacterSet;
I don't see anyone using getCharacterSet, so I would change those three methods into an attribute ACString characterSet.
>+static nsCString gDefaultCharacterSet;
No static strings. Try making it a member of gFolderCharsetObserver instead?
Attachment #290875 -
Flags: superreview?(neil)
Attachment #290875 -
Flags: superreview-
Attachment #290875 -
Flags: review?(neil)
Assignee | ||
Comment 3•17 years ago
|
||
Comment on attachment 290875 [details] [diff] [review]
The fix v2
I'll update the patch in a bit.
Attachment #290875 -
Flags: review?(philringnalda)
Comment 4•17 years ago
|
||
OK, so as Mark pointed out nsMsgDBFolder.cpp does uses GetCharacterSet, but my MXR search didn't find it because I searched case-sensitively for FolderInfo.
folderInfo->GetCharacterSet(mCharset, &defaultUsed);
if (defaultUsed)
mCharset.Truncate();
Since this caller only wants the folder info's m_charSet (and not the gDefaultCharacterSet) it makes sense to use attribute ACString characterSet; and change this call to folderInfo->GetCharacterSet(mCharset);
We can then replace the uses of Get[Const]CharPtrCharacterSet with a readonly attribute, perhaps call it effectiveCharacterSet?
Assignee | ||
Comment 5•17 years ago
|
||
Revised patch as per discussion with Neil and to fix the static string problem.
Attachment #290875 -
Attachment is obsolete: true
Attachment #291225 -
Flags: superreview?(neil)
Attachment #291225 -
Flags: review?(philringnalda)
Attachment #291225 -
Flags: review?(neil)
Comment 6•17 years ago
|
||
Comment on attachment 291225 [details] [diff] [review]
The fix v3
>- nsCString m_charSet;
I don't claim to understand the perf/bloat aspects of this change...
>- if (gDefaultCharacterSet)
>- nsMemory::Free(gDefaultCharacterSet);
>- gDefaultCharacterSet = ToNewCString(ucsval);
>+ *gDefaultCharacterSet = NS_ConvertUTF16toUTF8(ucsval);
You don't null-check gDefaultCharacterSet. Also, please use CopyUTF16toUTF8.
>+ if (!gDefaultCharacterSet)
>+ gDefaultCharacterSet = new nsCString;
>+
>+ *gDefaultCharacterSet = NS_ConvertUTF16toUTF8(ucsval);
Same here - the new might fail...
Attachment #291225 -
Flags: review?(neil) → review+
Comment 7•17 years ago
|
||
Comment on attachment 291225 [details] [diff] [review]
The fix v3
> NS_IMETHODIMP
>-nsDBFolderInfo::GetCharPtrCharacterSet(char **result)
>+nsDBFolderInfo::GetEffectiveCharacterSet(nsACString &result)
> {
>- *result = ToNewCString(m_charSet);
This gets called a lot, particularly from nsMsgDBView::GetCellText.
Removing m_charSet isn't really an option.
Attachment #291225 -
Flags: superreview?(neil) → superreview-
Assignee | ||
Comment 8•17 years ago
|
||
Updated per Neil's comments.
Attachment #291225 -
Attachment is obsolete: true
Attachment #291949 -
Flags: superreview?(neil)
Attachment #291949 -
Flags: review?(philringnalda)
Attachment #291949 -
Flags: review?(neil)
Attachment #291225 -
Flags: review?(philringnalda)
Assignee | ||
Comment 9•17 years ago
|
||
Comment on attachment 291949 [details] [diff] [review]
The fix v4
Sorry, attached the wrong patch :-(
Attachment #291949 -
Attachment is obsolete: true
Attachment #291949 -
Flags: superreview?(neil)
Attachment #291949 -
Flags: review?(philringnalda)
Attachment #291949 -
Flags: review?(neil)
Assignee | ||
Comment 10•17 years ago
|
||
The right patch this time.
Attachment #292052 -
Flags: superreview?(neil)
Attachment #292052 -
Flags: review?(philringnalda)
Attachment #292052 -
Flags: review?(neil)
Comment 11•17 years ago
|
||
Comment on attachment 292052 [details] [diff] [review]
The fix v4
>+ CopyUTF16toUTF8(ucsval, *gDefaultCharacterSet);
Right :-)
>+ *gDefaultCharacterSet = NS_ConvertUTF16toUTF8(ucsval);
Wrong ;-)
>+ if (NS_FAILED(GetCharProperty(kCharacterSetColumnName, result)) ||
>+ result.IsEmpty() && gDefaultCharacterSet)
You need extra parens here because && has higher precedence than ||.
r+sr=me with that fixed.
Attachment #292052 -
Flags: superreview?(neil)
Attachment #292052 -
Flags: superreview+
Attachment #292052 -
Flags: review?(neil)
Attachment #292052 -
Flags: review+
Comment 12•17 years ago
|
||
Comment on attachment 292052 [details] [diff] [review]
The fix v4
r=me on the parts I understand ;)
Attachment #292052 -
Flags: review?(philringnalda) → review+
Assignee | ||
Comment 13•17 years ago
|
||
Patch checked in -> fixed.
Status: NEW → RESOLVED
Closed: 17 years ago
Resolution: --- → FIXED
Updated•16 years ago
|
Product: Core → MailNews Core
You need to log in
before you can comment on or make changes to this bug.
Description
•