Simplify nsMsgDBView::Sort and friends

RESOLVED FIXED

Status

MailNews Core
Backend
--
minor
RESOLVED FIXED
15 years ago
10 years ago

People

(Reporter: neil@parkwaycc.co.uk, Assigned: (not reading, please use seth@sspitzer.org instead))

Tracking

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

15 years ago
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.
(Reporter)

Comment 1

15 years ago
Created attachment 138133 [details] [diff] [review]
Proposed patch
(Reporter)

Updated

15 years ago
Attachment #138133 - Flags: review?(bienvenu)

Comment 2

15 years ago
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.

Updated

15 years ago
Attachment #138133 - Flags: review?(bienvenu) → review+
(Reporter)

Updated

15 years ago
Attachment #138133 - Flags: superreview?(mscott)

Updated

15 years ago
Attachment #138133 - Flags: superreview?(mscott) → superreview+
(Reporter)

Comment 3

15 years ago
Fix checked in. Thanks guys!
Status: NEW → RESOLVED
Last Resolved: 15 years ago
Resolution: --- → FIXED

Comment 4

15 years ago
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 ?)
(Reporter)

Comment 6

15 years ago
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.