Closed
Bug 1404654
Opened 9 years ago
Closed 9 years ago
use FOLDER_SUFFIX constant where possible
Categories
(MailNews Core :: Backend, enhancement)
MailNews Core
Backend
Tracking
(Not tracked)
RESOLVED
FIXED
Thunderbird 58.0
People
(Reporter: aceman, Assigned: aceman)
Details
Attachments
(1 file, 2 obsolete files)
|
12.32 KB,
patch
|
jorgk-bmo
:
review+
|
Details | Diff | Splinter Review |
Following bug 1404003 and bug 1402750, there are still some places in m-c code using hardcoded ".sbd" string instead of the FOLDER_SUFFIX constant. Those could be improved.
Attachment #8914047 -
Flags: review?(jorgk)
Comment 2•9 years ago
|
||
Comment on attachment 8914047 [details] [diff] [review]
1404654.patch
Nice-ö ;-)
Have you considered creating defines for the length of those strings?
#define SUMMARY_SUFFIX_LENGTH 4
etc.
We'd fire anyone changing the string without adapting the length ;-)
That would avoid code like:
proposedDBName.SetLength(proposedDBName.Length() - NS_LITERAL_STRING(SUMMARY_SUFFIX).Length());
(In reply to Jorg K (GMT+2) from comment #2)
> We'd fire anyone changing the string without adapting the length ;-)
>
> That would avoid code like:
> proposedDBName.SetLength(proposedDBName.Length() -
> NS_LITERAL_STRING(SUMMARY_SUFFIX).Length());
Yes that happens also in the patch
name.SetLength(len - suffix.Length()); // truncate the string
I don't like it much, I can think about it.
Another place uses
moveValue.Cut(offset, strlen(FOLDER_SUFFIX8));
but has to already know where the suffix is in the string (offset), it may not be at the end.
Comment 4•9 years ago
|
||
(In reply to :aceman from comment #3)
> I don't like it much, I can think about it.
It will get rid of all the ugly constructs we do to get a know value: 4:
NS_LITERAL_STRING(SUMMARY_SUFFIX).Length()
suffix.Length()
strlen(FOLDER_SUFFIX8), although the compiler might pre-evaluate this one.
I mean I do not like the ugly ways of cutting the string.
Yes, using the constant could make them prettier.
Comment 6•9 years ago
|
||
Comment on attachment 8914047 [details] [diff] [review]
1404654.patch
Too many requests, so cancelling this one since we're waiting for a new patch.
Attachment #8914047 -
Flags: review?(jorgk)
Attachment #8914047 -
Attachment is obsolete: true
Attachment #8914857 -
Flags: review?(jorgk)
Comment 8•9 years ago
|
||
Comment on attachment 8914857 [details] [diff] [review]
1404654.patch v2
Nice-ö! (Korean pronunciation)
Attachment #8914857 -
Flags: review?(jorgk) → review+
Comment 9•9 years ago
|
||
Comment on attachment 8914857 [details] [diff] [review]
1404654.patch v2
Hold on, where is the hunk to remove this??
proposedDBName.SetLength(proposedDBName.Length() - NS_LITERAL_STRING(SUMMARY_SUFFIX).Length());
Attachment #8914857 -
Flags: review+
| Assignee | ||
Comment 10•9 years ago
|
||
Sorry, got overlooked ;)
Attachment #8914857 -
Attachment is obsolete: true
Attachment #8914938 -
Flags: review?(jorgk)
Comment 11•9 years ago
|
||
Comment on attachment 8914938 [details] [diff] [review]
1404654.patch v2.1
Thanks. Missed my last push by 5 minutes.
Attachment #8914938 -
Flags: review?(jorgk) → review+
Comment 12•9 years ago
|
||
Comment on attachment 8914938 [details] [diff] [review]
1404654.patch v2.1
Review of attachment 8914938 [details] [diff] [review]:
-----------------------------------------------------------------
::: mailnews/local/src/nsMsgLocalStoreUtils.cpp
@@ +56,5 @@
> StringBeginsWith(name, NS_LITERAL_STRING("feeditems_error")))
> return true;
>
> // The .mozmsgs dir is for spotlight support
> return (StringEndsWith(name, NS_LITERAL_STRING(".mozmsgs")) ||
I think that should have a 'u' prepended, but then we have heaps of those, as does M-C, see bug 870698 comment #30, so I'll leave that for another bug.
Comment 13•9 years ago
|
||
Pushed by mozilla@jorgk.com:
https://hg.mozilla.org/comm-central/rev/d7d59e4c13d7
use FOLDER_SUFFIX and SUMMARY_SUFFIX constants where possible, use #define for length. r=jorgk
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Updated•9 years ago
|
Target Milestone: --- → Thunderbird 58.0
You need to log in
before you can comment on or make changes to this bug.
Description
•