trunk: ccl:ipaddr-to-dotted and ccl::_inet_ntoa

"R.Stoye" <[email protected]> Sat, 11 Oct 2008 01:56:29 +0200
Newsgroups gmane.lisp.openmcl.bugs
Message-ID <[email protected]>
hi,
trying out the LinuxX8632 trunk, i noticed an error in ipaddr-to-dotted.
I think calling #'htonl in ccl:ipaddr-to-dotted *and* ccl::_inet_ntoa  
is wrong.
Since the results of the release 1.2 are correct, i vote for removing  
the call of htonl in _inet_ntoa but please make up your own mind.

(wrong) result from 1.2-r10988M-trunk  (DarwinX8664): (just testing)
? (ccl:ipaddr-to-dotted 2886730234)
"250.1.16.172"
? (ccl::_inet_ntoa 2886730234)
"172.16.1.250"

(right) result from 1.2-r9739MS-RC1  (DarwinX8664)!  (in production use)
? (ccl:ipaddr-to-dotted 2886730234)
"172.16.1.250"
? (ccl::_inet_ntoa 2886730234)
"250.1.16.172"

(right) result from 1.2-r9733MS-RC1  (LinuxX8664)! (in production use)
? (ccl:ipaddr-to-dotted 2886730234)
"172.16.1.250"
? (ccl::_inet_ntoa 2886730234)
"250.1.16.172"
?

(wrong) result from 1.3-dev-r11012M-trunk  (LinuxX8632)! (just testing)
? (ccl:ipaddr-to-dotted 2886730234)
"250.1.16.172"
? (ccl::_inet_ntoa 2886730234)
"172.16.1.250"


;;;; code from trunk:
#-linuxppc-target
(defun _inet_ntoa (addr)
   (with-macptrs ((p))
     (%setf-macptr p (external-call #+darwin-target "_inet_ntoa"
                                    #-darwin-target "inet_ntoa"
				   :unsigned-fullword (htonl addr)
				   :address))
     (unless (%null-ptr-p p) (%get-cstring p))))	

;;;; code from 1.2

(defun _inet_ntoa (addr)
   (with-macptrs ((p))
     (%setf-macptr p (external-call #+darwin-target "_inet_ntoa"
                                    #-darwin-target "inet_ntoa"
				   :unsigned-fullword addr
				   :address))
     (unless (%null-ptr-p p) (%get-cstring p))))