#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)
Change History (8)
by , 18 years ago
Attachment: | markupstl.cpp-mloskot-20060228.3.patch added |
---|
comment:1 by , 18 years ago
Resolution: | none → fixed |
---|
comment:2 by , 16 years ago
Milestone: | imported |
---|---|
Reporter: | changed from | to
Resolution: | fixed |
Status: | closed → reopened |
Version: | 3.0.0 → svn-trunk |
comment:3 by , 16 years ago
Owner: | changed from | to
---|---|
Status: | reopened → new |
comment:4 by , 16 years ago
Milestone: | → 3.0.0 |
---|---|
Status: | new → assigned |
comment:5 by , 16 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
comment:6 by , 16 years ago
Component: | Core → XML Tests |
---|---|
Priority: | 2 → major |
Severity: | Unassigned → Significant |
Patch proposal created using cvs diff -Nua