On Fri, 2006-12-08 at 19:23 +0530, Kite Flyer wrote:
> The error occurs because above strchr call doesn't match either of the
> following VC++ declarations in string.h.
>
> const char *strchr(const char *, int)
> char *strchr(char *, int)
Interesting -- gcc doesn't flag that as a problem, because the argument
of strchr is declared (const char *), but the result is declared (char
*). Presumably so that strchr has only one declaration, in the C
manner.
I've attached a patch which ought to work, and gcc accepts it. Can you
apply it to your code and tell us if it is acceptd by VC++?
Thanks,
Dale
Index: sipXportLib/src/os/OsSocket.cpp
===================================================================
--- sipXportLib/src/os/OsSocket.cpp (revision 8210)
+++ sipXportLib/src/os/OsSocket.cpp (working copy)
@@ -1134,17 +1134,17 @@
// ^====== dot2
// ^========= dot1
- char* dot1 = strchr(address, '.');
+ const char* dot1 = strchr(address, '.');
UtlBoolean isIp4 = FALSE;
if(dot1)
{
- char* dot2 = strchr(dot1 + 1, '.');
+ const char* dot2 = strchr(dot1 + 1, '.');
if((dot2) && (dot2-dot1 > 1))
{
- char* dot3 = strchr(dot2 + 1, '.');
+ const char* dot3 = strchr(dot2 + 1, '.');
if((dot3) && (dot3-dot2 > 1))
{
- char* dot4 = strchr(dot3 + 1, '.');
+ const char* dot4 = strchr(dot3 + 1, '.');
if((dot4 == NULL) && strlen(dot3) > 1)
{
if(INADDR_NONE != inet_addr(address))
_______________________________________________
sipxtapi-dev mailing list
[email protected]
List Archive: http://list.sipfoundry.org/archive/sipxtapi-dev/