Closed Bug 224678 Opened 21 years ago Closed 19 years ago

nsComposerRegistration.cpp has suspicious code

Categories

(Core :: DOM: Editor, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: mmokrejs, Assigned: timeless)

References

Details

Attachments

(2 obsolete files)

User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030826
Build Identifier: 

Hi,
  I get the following with current snapshot on Tru64 Unix 5.1A:

cxx: Warning: nsComposerRegistration.cpp, line 59: integer conversion resulted
          in truncation
static NS_DEFINE_CID(kHTMLEditorCommandTableCID, NS_HTMLEDITOR_COMMANDTABLE_CID);
-------^
cxx: Warning: nsComposerRegistration.cpp, line 60: integer conversion resulted
          in truncation
static NS_DEFINE_CID(kHTMLEditorDocStateCommandTableCID,
NS_HTMLEDITOR_DOCSTATE_COMMANDTABLE_CID);
-------^
cxx: Warning: nsComposerRegistration.cpp, line 229: integer conversion resulted
          in truncation
    { "HTML Editor command table", NS_HTMLEDITOR_COMMANDTABLE_CID,
-----------------------------------^
cxx: Warning: nsComposerRegistration.cpp, line 233: integer conversion resulted
          in truncation
    { "HTML Editor doc state command table",
NS_HTMLEDITOR_DOCSTATE_COMMANDTABLE_CID,
---------------------------------------------^


Reproducible: Always

Steps to Reproduce:
1.
2.
3.
Similarly, I get:

cxx: Warning: nsEditorRegistration.cpp, line 60: integer conversion resulted in
          truncation
static NS_DEFINE_CID(kEditorCommandTableCID, NS_EDITORCOMMANDTABLE_CID);
-------^
cxx: Warning: nsEditorRegistration.cpp, line 154: integer conversion resulted
          in truncation
    { "Editor Command Table", NS_EDITORCOMMANDTABLE_CID,
------------------------------^
*** Bug 224677 has been marked as a duplicate of this bug. ***
Editor, not localization.  The problem, of course, is that the CID format used
in Mozilla is:

{ 0x00000000, 0x0000, 0x0000, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }

while the CIDs in question use

{ 0x00000000, 0x0000, 0x0000, { 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }

(so the first element of the sub-array does not fit in the PRUint8 it's assigned
into, and the last element does not exist).

I'm actually somewhat surprised this works... ;)
Assignee: localization → mozeditor
Status: UNCONFIRMED → NEW
Component: Localization → Editor: Core
Ever confirmed: true
QA Contact: amyy → sairuh
Sorry for spam, but I've given up on being surprised that a segment of code
works. But then, I'm fighting with the Microsoft Win32 API ;-)
Hi,
  any progress on this? ;)
Attached patch new cid (obsolete) — Splinter Review
I'm tired of seeing a warning for this on windows. I've issued a new cid
because i don't want to rely on 'correcting' the old cid.
Assignee: mozeditor → timeless
Status: NEW → ASSIGNED
Attachment #143728 - Flags: superreview?(dbaron)
Attachment #143728 - Flags: review?(brade)
Attachment #143728 - Flags: approval1.7b?
Attachment #143728 - Flags: review?(brade) → review+
Comment on attachment 143728 [details] [diff] [review]
new cid

If nobody uses the CID, why do we have it?
(Meaning, why do we bother with an entry in the modules list if nobody ever does
a CreateInstance or a GetService for that CID / contractid (empty contractid).)
Comment on attachment 143728 [details] [diff] [review]
new cid

for lack of answer to my question, marking sr- to get off my review queue
Attachment #143728 - Flags: superreview?(dbaron) → superreview-
well, the creature eventually leads to an nsIControllerCommandTable, i wonder if
there was an internal customer which had some use for it.

smfr: is there really no need for this cid and the constructor it chains to?
killing the pair would be nice...
Depends on: 201257
I'd have to spend time looking around to see what the state of things there is,
time which I don't have right now.
Attachment #143728 - Flags: approval1.7b? → approval1.7?
Comment on attachment 143728 [details] [diff] [review]
new cid

Can we have a patch that removes this CID and its use at line 154 (remove the
nsModuleComponentInfo array element initializer)?

/be
Comment on attachment 143728 [details] [diff] [review]
new cid

it is used
consider:
Index: nsEditorRegistration.cpp
===================================================================
RCS file: /cvsroot/mozilla/editor/libeditor/build/nsEditorRegistration.cpp,v
retrieving revision 1.34
diff -u0 -r1.34 nsEditorRegistration.cpp
--- nsEditorRegistration.cpp
+++ nsEditorRegistration.cpp
@@ -56,0 +57 @@
+#if 0
@@ -60,0 +62 @@
+#endif
@@ -100 +102 @@
-
+#if 0
@@ -119 +121 @@
-
+#endif
@@ -153 +155 @@
-
+#if 0
@@ -157 +159 @@
-
+#endif

nsEditorRegistration.cpp
/mnt/ibm/mozhack/mozilla/editor/libeditor/build/nsEditorRegistration.cpp: In
function `nsresult nsEditorControllerConstructor(nsISupports *, const nsIID &,
void **)':
/mnt/ibm/mozhack/mozilla/editor/libeditor/build/nsEditorRegistration.cpp:87:
`kEditorCommandTableCID' undeclared (first use this function)

libeditor uses this CID to ensure service semantics and lifetime. It could
bloat itself with startup and shutdown stuff and a static critter which held a
reference, but i don't think that's a good tradeoff.
Attachment #143728 - Flags: superreview- → superreview?
@@ -56,0 +57 @@
+#if 0
@@ -60,0 +62 @@
+#endif
@@ -100 +102 @@
-
+#if 0
@@ -119 +121 @@
-
+#endif
@@ -153 +155 @@
-
+#if 0
@@ -157 +159 @@
-
+#endif

diff -u would be a little more useful here, timeless.
Attachment #143728 - Flags: approval1.7?
Attachment #143728 - Flags: superreview?
Attachment #143728 - Flags: superreview?(tor)
Attachment #143728 - Flags: superreview?(tor) → superreview+
Attachment #143728 - Flags: approval1.8b3?
Attachment #143728 - Flags: approval1.8b3? → approval1.8b3+
Comment on attachment 143728 [details] [diff] [review]
new cid

mozilla/editor/libeditor/build/nsEditorRegistration.cpp 	1.37
Attachment #143728 - Attachment is obsolete: true
Status: ASSIGNED → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
QA Contact: bugzilla → nobody
nsComposerRegistration.cpp needs to be fixed, too :)
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Attached patch new CIDs (obsolete) — Splinter Review
Attachment #186541 - Flags: superreview?(sfraser_bugs)
Attachment #186541 - Flags: review?(brade)
Attachment #186541 - Flags: superreview?(sfraser_bugs) → superreview+
Attachment #186541 - Flags: review?(brade) → review+
Attachment #186541 - Flags: approval1.8b3?
Attachment #186541 - Flags: approval1.8b3? → approval1.8b3+
Comment on attachment 186541 [details] [diff] [review]
new CIDs

mozilla/editor/composer/src/nsComposerRegistration.cpp	1.20
mozilla/editor/composer/src/nsComposerRegistration.cpp	1.21
Attachment #186541 - Attachment is obsolete: true
fixed now
Status: REOPENED → RESOLVED
Closed: 19 years ago19 years ago
Resolution: --- → FIXED
QA Contact: nobody → editor
Flags: in-testsuite-
OS: Other → All
Hardware: Other → All
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: