diff options
Diffstat (limited to 'geoip/ip.lisp')
-rw-r--r-- | geoip/ip.lisp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/geoip/ip.lisp b/geoip/ip.lisp index 7b6a23e..d97f5c2 100644 --- a/geoip/ip.lisp +++ b/geoip/ip.lisp @@ -172,13 +172,14 @@ (ecase type (1 (mread-pointer db-ptr length)) (2 (mread-uft8 db-ptr length)) - (3 (cons 'double (mread-unsigned db-ptr 8))) + (3 (ieee-floats:decode-float64 (mread-unsigned db-ptr 8))) (4 (bytes-from-foreign db-ptr length)) ((5 6 9 10) (mread-unsigned db-ptr length)) (7 (mread-map db-ptr length)) (8 (mread-int32 db-ptr length)) (11 (mread-list db-ptr length)) (14 (< 0 length)) ; bool + (15 (ieee-floats:decode-float32 (mread-unsigned db-ptr 4))) ))) (defun read-node-record (mmdb node-number bit) @@ -243,3 +244,7 @@ (with-slots (ptr fd size) mmdb (mmap:munmap ptr fd size))) +(defmacro with-mmdb ((mmdb file) &body body) + `(mmap:with-mmap (ptr fd size ,file) + (let ((,mmdb (mmap->mmdb ,file ptr fd size))) + ,@body))) |