Closed Bug 542959 Opened 10 years ago Closed 10 years ago

Fix " PluginPRLibrary.h:177: warning: deprecated conversion from string constant to ‘char*’"

Categories

(Core :: Plug-ins, defect)

x86
Linux
defect
Not set

Tracking

()

RESOLVED FIXED

People

(Reporter: dholbert, Assigned: dholbert)

References

Details

(Whiteboard: [build_warning])

Attachments

(1 file)

Attached patch fixSplinter Review
Just ran across this build warning:
> PluginPRLibrary.h: In member function ‘virtual nsresult mozilla::PluginPRLibrary::NP_GetMIMEDescription(char**)’:
> PluginPRLibrary.h:177: warning: deprecated conversion from string constant to ‘char*’

That's flagging this assignment:
    *mimeDesc = "";
Here, mimeDesc is a char** parameter inside of the function NP_GetMIMEDescription, added here: http://hg.mozilla.org/mozilla-central/rev/05ac28100696#l6.153

As it turns out, mimeDesc's non-const-ness causes problems in two other places, too, though we already work around those with explicit casts to (char*) [1] and (char**) [2].

We can fix all three of those issues and avoid the need for casts by just making NP_GetMIMEDescription's argument a |const char**| instead of a |char**|.  The attached patch does this (removes the casts).

[1] http://hg.mozilla.org/mozilla-central/rev/05ac28100696#l4.236
[2] http://hg.mozilla.org/mozilla-central/rev/05ac28100696#l10.229
Attachment #424193 - Flags: review?(jones.chris.g)
(In reply to comment #0)
>  The attached patch does this (removes the casts).
er, I meant "(_and_ removes the casts)."
Assignee: nobody → dholbert
Status: NEW → ASSIGNED
Comment on attachment 424193 [details] [diff] [review]
fix

Looks OK to me.  (And oops, we're not forwarding NP_GetMimeDescription.)
Attachment #424193 - Flags: review?(jones.chris.g) → review+
Patch pushed to m-c: http://hg.mozilla.org/mozilla-central/rev/79c95205075d
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Whiteboard: [build_warning]
You need to log in before you can comment on or make changes to this bug.