Opened 14 years ago

Closed 12 years ago

Last modified 11 years ago

#30 closed defect (fixed)

Incorrect usage of strchr in MarkupSTL.cpp file

Reported by: mloskot Owned by: mloskot
Priority: major Milestone:
Component: XML Tests Version: master
Severity: Significant Keywords: imported, phpbugtracker
Cc:

Description

When trying to compile latest CVS HEAD using VC++ 8.0 I get following error:

Error 25 error C2440: '=' : cannot convert from 'const char *' to 'char *'
d:__projectsgeos_cvsgeostestsxmltestermarkupmarkupstl.cpp 917

I revealed the strchr function is used incorrectly in line 917 mentioned above.

How to fix it?

Change line MarkupSTL.cpp:914

char* pFound;

to read:

const char* pFound;

Why GCC allows to build this buggy version?

According to C++ docs (http://www.cplusplus.com/ref/cstring/strchr.html) there is only one version of strchr in ANSI C:

char *  strchr (const char * string, int c); 

but in ANSI C++ there are two versions - different from that one in ANSI C:

const char * strchr (const char * string, int c);
      char * strchr (char * string, int c);

So, ANSI C version of strchr is not supported in ANSI C++. As I also discovered, it is possible to use/compile C version of strchr in C++ programs using g++ (I tested with 3.2.3) but it is a bug in libstdc++

Here, I reported this bug on libstdc++ list: http://gcc.gnu.org/ml/libstdc++/2006-02/msg00086.html

This bug is strongly related to the known issue #6257 in libstdc++: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=6257

Attachments (1)

markupstl.cpp-mloskot-20060228.3.patch (556 bytes) - added by mateusz@… 14 years ago.
Patch proposal created using cvs diff -Nua

Download all attachments as: .zip

Change History (8)

Changed 14 years ago by mateusz@…

Patch proposal created using cvs diff -Nua

comment:1 Changed 14 years ago by

Resolution: nonefixed

comment:2 Changed 12 years ago by mloskot

Milestone: imported
Reporter: changed from mateusz@… to mloskot
Resolution: fixed
Status: closedreopened
Version: 3.0.0svn-trunk

comment:3 Changed 12 years ago by mloskot

Owner: changed from to mloskot
Status: reopenednew

comment:4 Changed 12 years ago by mloskot

Milestone: 3.0.0
Status: newassigned

comment:5 Changed 12 years ago by mloskot

Resolution: fixed
Status: assignedclosed

comment:6 Changed 12 years ago by mloskot

Component: CoreXML Tests
Priority: 2major
Severity: UnassignedSignificant

comment:7 Changed 11 years ago by (none)

Milestone: 3.0.0

Milestone 3.0.0 deleted

Note: See TracTickets for help on using tickets.