fix rawsockets test

FAIL: trawsockets.nim
Test "tests/cpp/trawsockets.nim" in category "cpp"
Failure: reNimcCrash
Expected:

Gotten:
Hint: system [Processing]
Hint: trawsockets [Processing]
Hint: rawsockets [Processing]
Hint: unsigned [Processing]
lib/pure/rawsockets.nim(15, 8) Warning: unsigned is deprecated [Deprecated]
Hint: os [Processing]
Hint: strutils [Processing]
Hint: parseutils [Processing]
Hint: times [Processing]
Hint: posix [Processing]
CC: compiler_trawsockets
CC: stdlib_system
CC: stdlib_rawsockets
CC: stdlib_unsigned
CC: stdlib_os
CC: stdlib_strutils
Error: execution of an external compiler program 'clang++ -c  -w  -I/Users/tmm1/code/nim/lib -o tests/cpp/nimcache/stdlib_rawsockets.o tests/cpp/nimcache/stdlib_rawsockets.cpp' failed with exit code: 256

tests/cpp/nimcache/stdlib_rawsockets.cpp:355:8: error: assigning to 'NCSTRING' (aka 'char *') from incompatible type 'const char *'
                LOC6 = gai_strerror(gairesult);
                     ^ ~~~~~~~~~~~~~~~~~~~~~~~
tests/cpp/nimcache/stdlib_rawsockets.cpp:499:8: error: assigning to 'NCSTRING' (aka 'char *') from incompatible type 'const char *'
                LOC5 = hstrerror(h_errno);
                     ^ ~~~~~~~~~~~~~~~~~~
tests/cpp/nimcache/stdlib_rawsockets.cpp:650:8: error: assigning to 'NCSTRING' (aka 'char *') from incompatible type 'const char *'
                LOC9 = inet_ntop(AF_INET6, ((void*) (addr6)), result->data, ((NI32)chckRange((result ? result->len : 0), ((NI32) (-2147483647 -1)), ((NI32) 2147483647))));
                     ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tests/cpp/nimcache/stdlib_rawsockets.cpp:771:10: error: assigning to 'NCSTRING' (aka 'char *') from incompatible type 'const char *'
                        LOC17 = inet_ntop(name.sin6_family, ((void*) ((&name))), ((NCSTRING) (buf)), ((NI32)chckRange(((NI)sizeof(TY143006)), ((NI32) (-2147483647 -1)), ((NI32) 2147483647))));
                              ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tests/cpp/nimcache/stdlib_rawsockets.cpp:859:10: error: assigning to 'NCSTRING' (aka 'char *') from incompatible type 'const char *'
                        LOC17 = inet_ntop(name.sin6_family, ((void*) ((&name))), ((NCSTRING) (buf)), ((NI32)chckRange(((NI)sizeof(TY143006)), ((NI32) (-2147483647 -1)), ((NI32) 2147483647))));
                              ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5 errors generated.
This commit is contained in:
Aman Gupta
2015-10-02 16:00:33 -07:00
parent 59d226221b
commit 2f7802bea3
2 changed files with 3 additions and 4 deletions

View File

@@ -1810,7 +1810,7 @@ proc ntohs*(a1: int16): int16 {.importc, header: "<arpa/inet.h>".}
proc inet_addr*(a1: cstring): InAddrT {.importc, header: "<arpa/inet.h>".}
proc inet_ntoa*(a1: InAddr): cstring {.importc, header: "<arpa/inet.h>".}
proc inet_ntop*(a1: cint, a2: pointer, a3: cstring, a4: int32): cstring {.
importc, header: "<arpa/inet.h>".}
importc:"(char *)$1", header: "<arpa/inet.h>".}
proc inet_pton*(a1: cint, a2: cstring, a3: pointer): cint {.
importc, header: "<arpa/inet.h>".}
@@ -2381,7 +2381,7 @@ proc sched_setscheduler*(a1: Pid, a2: cint, a3: var Sched_param): cint {.
proc sched_yield*(): cint {.importc, header: "<sched.h>".}
proc strerror*(errnum: cint): cstring {.importc, header: "<string.h>".}
proc hstrerror*(herrnum: cint): cstring {.importc, header: "<netdb.h>".}
proc hstrerror*(herrnum: cint): cstring {.importc:"(char *)$1", header: "<netdb.h>".}
proc FD_CLR*(a1: cint, a2: var TFdSet) {.importc, header: "<sys/select.h>".}
proc FD_ISSET*(a1: cint | SocketHandle, a2: var TFdSet): cint {.
@@ -2565,7 +2565,7 @@ proc endprotoent*() {.importc, header: "<netdb.h>".}
proc endservent*() {.importc, header: "<netdb.h>".}
proc freeaddrinfo*(a1: ptr AddrInfo) {.importc, header: "<netdb.h>".}
proc gai_strerror*(a1: cint): cstring {.importc, header: "<netdb.h>".}
proc gai_strerror*(a1: cint): cstring {.importc:"(char *)$1", header: "<netdb.h>".}
proc getaddrinfo*(a1, a2: cstring, a3: ptr AddrInfo,
a4: var ptr AddrInfo): cint {.importc, header: "<netdb.h>".}

View File

@@ -345,7 +345,6 @@ proc getAddrString*(sockAddr: ptr SockAddr): string =
elif sockAddr.sa_family == rawAfInet6:
when not useWinVersion:
# TODO: Windows
var v6addr = cast[ptr Sockaddr_in6](sockAddr).sin6_addr
result = newString(posix.INET6_ADDRSTRLEN)
let addr6 = addr cast[ptr Sockaddr_in6](sockAddr).sin6_addr
discard posix.inet_ntop(posix.AF_INET6, addr6, result.cstring,