Closed Bug 229692 Opened 21 years ago Closed 21 years ago

Simplify nsMsgDBView::Sort and friends

Categories

(MailNews Core :: Backend, defect)

defect
Not set
minor

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: neil, Assigned: sspitzer)

Details

Attachments

(1 file)

Basically there are two main changes:
1) Instead of storing dword values as an IdDWord of an EntryInfo and a PRUint32
I reuse the "len" field from the EntryInfo (now renamed IdDWord) structure.
2) Instead of having an EntryInfo member I derive the Key/PtrKey structures.
Attached patch Proposed patchSplinter Review
Attachment #138133 - Flags: review?(bienvenu)
don't need the extra braces here...since you've already gotten rid of the extra
assignment.

+  if ((m_viewFlags & nsMsgViewFlagsType::kThreadedDisplay) != 0)
+  {
+    return GetIndexForThread(msgHdr);
+  }
+

I'll note my r= in a sec.
Attachment #138133 - Flags: review?(bienvenu) → review+
Attachment #138133 - Flags: superreview?(mscott)
Attachment #138133 - Flags: superreview?(mscott) → superreview+
Fix checked in. Thanks guys!
Status: NEW → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
Looks like this increased the number of warnings on the Linux brad from 1948 to
1950. These two warnings are new:

1-2.	mailnews/base/src/nsMsgDBView.cpp:3401 (See 1st of 2 warnings in build log)
	Invalid access to non-static data member `IdKey::key' of NULL object
(perhaps the `offsetof' macro was used incorrectly)
	

3399 // build up the beast, so we can sort it.
3400 PRUint32 numSoFar = 0;
3401 const PRUint32 keyOffset = offsetof(IdKey, key);
3402 // calc max possible size needed for all the rest
3403 PRUint32 maxSize = (keyOffset + maxLen) * (arraySize - numSoFar);

(see http://tinderbox.mozilla.org/SeaMonkey/warn1073247120.10586.html#neil and
http://tinderbox.mozilla.org/showlog.cgi?log=SeaMonkey/1073247120.10586.gz:27887 )
Addition to comment 4:

Actually, the result is -1/+3:

Removed:
{
http://tinderbox.mozilla.org/SeaMonkey/warn1073243040.29880.html#sspitzer

4.	mailnews/base/src/nsMsgDBView.cpp:5482 (See build log excerpt)
	Comparison between signed and unsigned integer expressions

5480 if (aSucceeded)
5481 {
5482   PRUint32 numIndices = mIndicesToNoteChange.GetSize();
5483   if (numIndices) 
5484   {
}

Added:
{
http://tinderbox.mozilla.org/SeaMonkey/warn1073247120.10586.html#naving

1.	mailnews/base/src/nsMsgDBView.cpp:5392 (See build log excerpt)
	Comparison between signed and unsigned integer expressions

5390 {
5391   rv = mTreeSelection->GetRangeAt(i, &startRange, &endRange);
5392   *msgToSelectAfterDelete = PR_MIN(*msgToSelectAfterDelete, startRange);
5393 }
5394 nsCOMPtr <nsIMsgImapMailFolder> imapFolder = do_QueryInterface(m_folder);


http://tinderbox.mozilla.org/SeaMonkey/warn1073247120.10586.html#neil

1-2.	mailnews/base/src/nsMsgDBView.cpp:3401 (See 1st of 2 warnings in build log)
	Invalid access to non-static data member `IdKey::key' of NULL object
(perhaps the `offsetof' macro was used incorrectly)

3399 // build up the beast, so we can sort it.
3400 PRUint32 numSoFar = 0;
3401 const PRUint32 keyOffset = offsetof(IdKey, key);
3402 // calc max possible size needed for all the rest
3403 PRUint32 maxSize = (keyOffset + maxLen) * (arraySize - numSoFar);
}

neil: could you fix them ? (do you want a separate bug filed ?)
I don't think the other two warnings are relevant.

I'm still regression testing my fix for the original warning, which is invalid
according to ISO C++ rules... rather than deriving the two versions (inline and
pointer key) I need to use a union.
Product: MailNews → Core
Product: Core → MailNews Core
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: