|Cannot use const char* to initialize char*| bustage

VERIFIED FIXED

Status

SeaMonkey
Build Config
--
blocker
VERIFIED FIXED
16 years ago
14 years ago

People

(Reporter: Roland Mainz, Assigned: hacker formerly known as seawood@netscape.com)

Tracking

Trunk
Sun
Solaris

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(2 attachments, 1 obsolete attachment)

5.05 KB, patch
karnaze (gone)
: review+
Darin Fisher
: superreview+
Details | Diff | Splinter Review
781 bytes, patch
Roland Mainz
: review+
Details | Diff | Splinter Review
(Reporter)

Description

16 years ago
2002-03-06-08-trunk build with Sun Workshop 7EA2. The build breaks due some
|Cannot use const char* to initialize char*| errors in the code ("nebiros" is
gone from the Seamonkey-Ports page, there is no RED tinderbox but it will be RED
once it's "up" again...) ...
(Reporter)

Comment 1

16 years ago
Created attachment 73017 [details] [diff] [review]
Patch for 2002-03-06-08-trunk

Comment 2

16 years ago
Looks fine, r=/sr=jag.

Darin, what do you think?

Comment 3

16 years ago
Comment on attachment 73017 [details] [diff] [review]
Patch for 2002-03-06-08-trunk

sr=darin
Attachment #73017 - Flags: superreview+

Updated

16 years ago
Attachment #73017 - Flags: review+
*** Bug 129619 has been marked as a duplicate of this bug. ***

Comment 5

16 years ago
Comment on attachment 73017 [details] [diff] [review]
Patch for 2002-03-06-08-trunk

a=asa (on behalf of drivers) for checkin to the 1.0 trunk
Attachment #73017 - Flags: approval+
Patch has been checked in
Status: NEW → RESOLVED
Last Resolved: 16 years ago
Resolution: --- → FIXED

Comment 7

16 years ago
nsMsgUtils.cpp also has the same problem.
"nsMsgUtils.cpp", line 416: Error: Cannot use const char* to initialize 
416 and 410 line:
-------------------------
char*.    if (s != decodedString.get())
    {
      // extract between "=?" and "?"
      // e.g. =?ISO-2022-JP?
->416 char *p1 = strstr(*stringP, "=?");
      if (p1)
      {
        p1 += sizeof("=?")-1;         // skip "=?"
->420   char *p2 = strchr(p1, '?');   // then search for '?'
        if (p2)
        {
          char charset[kMAX_CSNAME] = "";
----------------------------
Status: RESOLVED → REOPENED
Resolution: FIXED → ---

Comment 8

16 years ago
Created attachment 73452 [details] [diff] [review]
nsMsgUtils.cpp

Patch to fix nsMsgUtils.cpp
taking a guess that this is related to the problem I filed about it: bug 129994.

Comment 11

16 years ago
shouldn't use strstr function,we should usr PL_strstr,it will let mozilla build 
ok on sun Platform.
(Reporter)

Comment 12

16 years ago
Antonio.Xu wrote:
> shouldn't use strstr function, we should usr PL_strstr, it will let mozilla 
> build ok on sun Platform.

Well, then the prototype for PL_strstr() is wrong and should be fixed. And then
we have the same problem...

BTW: We should always use the OS native functions if possible and available,
they are usually better optimised and/or |inline| or compiler buildins
(currently we are slaughtering most stuff in nsCRT::* for that reason...) ...

Comment 13

16 years ago
i'm 80% certain strstr isn't available from all c libraries, so for now, please 
use the PL_ version and contact nspr about any prototype issues.

Comment 14

16 years ago
timeless, see:

netwerk/protocol/data/src/nsDataChannel.cpp:
    char *buffer = strstr(spec.get(), "data:");

netwerk/protocol/ftp/src/nsFtpConnectionThread.cpp:
        char* eol = strstr(currLine, CRLF);

so, i think strstr should be ok to use.

Comment 15

16 years ago
See Kernighan and Ritchie, The C Programming Language, 2nd. Ed.,
page 250.  The function strstr() is documented.

Comment 16

16 years ago
Comment on attachment 73452 [details] [diff] [review]
nsMsgUtils.cpp

a=asa (on behalf of drivers) for checkin to the 1.0 trunk
Attachment #73452 - Flags: approval+
Patch checked in.
Status: REOPENED → RESOLVED
Last Resolved: 16 years ago16 years ago
Resolution: --- → FIXED

Comment 18

16 years ago
This has just (approximately 3/30/02) shown up in a new spot 

 mozilla/netwerk/protocol/ftp/src/nsFtpConnectionThread.cpp

suggest the following fix

485c485
<         char* eol = strstr(currLine, CRLF);
---
>         char* eol = (char *) strstr(currLine, CRLF);

Comment 19

16 years ago
no. patch coming up

Comment 20

16 years ago
Created attachment 76965 [details] [diff] [review]
correct fix for bbaetz's
Comment on attachment 76965 [details] [diff] [review]
correct fix for bbaetz's

r=bryner
Attachment #76965 - Flags: review+

Comment 22

16 years ago
Comment on attachment 76965 [details] [diff] [review]
correct fix for bbaetz's

sr=darin
Attachment #76965 - Flags: superreview+

Comment 23

16 years ago
Seeing this problem on todays Sun Solaris cvs

"nsFtpConnectionThread.cpp" , line 485: Error: Cannot use const char* to
initialize  char*.


Lets get this checked in so I can start getting Solaris dailys built and tested
again.

Thanks

Donnie

-dcran-

Comment 24

16 years ago
Comment on attachment 76965 [details] [diff] [review]
correct fix for bbaetz's

checked in a=asa
Attachment #76965 - Attachment is obsolete: true
Attachment #76965 - Flags: approval+
verfied checked in
Status: RESOLVED → VERIFIED
Product: Browser → Seamonkey
You need to log in before you can comment on or make changes to this bug.