Opened 18 years ago

Closed 16 years ago

Last modified 15 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: main
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@… 18 years ago.
Patch proposal created using cvs diff -Nua

Download all attachments as: .zip

Change History (8)

by mateusz@…, 18 years ago

Patch proposal created using cvs diff -Nua

comment:1 by , 18 years ago

Resolution: nonefixed

comment:2 by mloskot, 16 years ago

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

comment:3 by mloskot, 16 years ago

Owner: changed from to mloskot
Status: reopenednew

comment:4 by mloskot, 16 years ago

Milestone: 3.0.0
Status: newassigned

comment:5 by mloskot, 16 years ago

Resolution: fixed
Status: assignedclosed

comment:6 by mloskot, 16 years ago

Component: CoreXML Tests
Priority: 2major
Severity: UnassignedSignificant

comment:7 by (none), 15 years ago

Milestone: 3.0.0

Milestone 3.0.0 deleted

Note: See TracTickets for help on using tickets.