Closed Bug 202716 Opened 21 years ago Closed 21 years ago

Fix to provide a "Foolish consistency" in const attributes of parameters and thereby eliminate some compiler warnings

Categories

(Camino Graveyard :: General, defect)

PowerPC
macOS
defect
Not set
minor

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: bfowler, Assigned: mikepinkerton)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

User-Agent:       Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.4b) Gecko/20030418 Chimera/0.7+
Build Identifier: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.4b) Gecko/20030418 Chimera/0.7+

gcc as called by Project Builder will warn if a programmer provides a 
const char * where a char * is specified. These patches specifiy that
certain strings (which ought not to be modified) are marked as such
in the code.

Reproducible: Always

Steps to Reproduce:
1. Compile Camino with Project Builder
2.
3.

Actual Results:  
Navigation.mm has two warnings

Expected Results:  
A bit optimistic, but I would wish all code in Mozilla to compile with no
warnings (however much one turns up the 'pickiness' of the compiler) on all
widely used compilers.

Patch will follow submission
Ben, does this apply to Mozilla as well as Camino?
I think not. The files concerned contain Cocoa classes and belong
inside the PreferencesPane folder of the Camino port.

It pains me to say that  bug 173287 is a duplicate of  this one and  should be retired.
*** Bug 173287 has been marked as a duplicate of this bug. ***
Ben, if your patch is ready for review, be sure to set the appropriate flag on it.
1. The flags popups are not visible in this browser. (Chimera 0.7+)/Jaguar 1.2.3

2. It is a three line patch and just needs looking at either by whoever is
in charge of the module, or whoever last modified the file. You know who
are! Just modify you sources and commit when convenient. There is no
intentional enhancement in functionality, or bug fix.

3. The need for setting a flag (whilst in the Bugzilla docs) is not described
in <URL: http://www.mozilla.org/hacking/life-cycle.html >, which whilst not
the only guide for helping with Mozilla, is one of the best written (of a very
fine bunch), and what I have been going by.

O.K. I. REQUEST A REVIEW FROM ANYONE HANDY.
Summary: Fix to provide a "Foolish consistency" in const attributes of parameters and thereby eliminate some compiler warnings → [has patch] Fix to provide a "Foolish consistency" in const attributes of parameters and thereby eliminate some compiler warnings
Blocks: buildwarning
Attachment #121135 - Flags: review?(pinkerton)
mine.
Assignee: saari → pinkerton
Status: UNCONFIRMED → NEW
Ever confirmed: true
I don't understand why a method would return a const NSString*. Maybe the
warnings should be fixed at the other end?
I really hope that I am not going to make a fool of myself here, but returning
a 'const NSString *' to be means returning a pointer to an NSString that the
caller should not modify. If you like something that is read only.

If the caller attempts to modify it, then this can be detected at compile
time.

If this is on the wrong lines, then by all means fix the warning the opposite
way.
Perhaps pasting the warnings in here would help.
These:
PreferencePanes/Navigation/Navigation.mm: In function
`-[OrgMozillaChimeraPreferenceNavigation getSystemHomePage]':
PreferencePanes/Navigation/Navigation.mm:289: warning: invalid conversion from
`const unsigned char*' to `unsigned char*'
PreferencePanes/Navigation/Navigation.mm: In function
`-[OrgMozillaChimeraPreferenceNavigation getSystemSearchPage]':
PreferencePanes/Navigation/Navigation.mm:304: warning: invalid conversion from
`const unsigned char*' to `unsigned char*'
this patch is malformed. is it incomplete?
Comment on attachment 121135 [details] [diff] [review]
Fix for compiler warnings

This doesn't fix the warnings which are totally unrelated to const char*'s.
Attachment #121135 - Flags: review?(pinkerton) → review-
fixed. (Str255 -> ConstStr255Param in param decl)
Status: NEW → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
Summary: [has patch] Fix to provide a "Foolish consistency" in const attributes of parameters and thereby eliminate some compiler warnings → Fix to provide a "Foolish consistency" in const attributes of parameters and thereby eliminate some compiler warnings
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: