a_star: don't crash on deserialization errors and limit static types
[nit.git] / lib / mongodb / mongodb.nit
index 3469976..1baf7f3 100644 (file)
@@ -96,9 +96,9 @@ private class BSON
        end
 
        redef fun to_s do
-               var ns = native.to_native_string
-               var res = ns.to_s_with_copy
-               ns.free # manual free of gc allocated NativeString
+               var ns = native.to_c_string
+               var res = ns.to_s
+               ns.free # manual free of gc allocated CString
                return res
        end
 
@@ -152,7 +152,7 @@ class MongoError
        # Human readable error message.
        fun message: String do
                var ns = native.message
-               var res = ns.to_s_with_copy
+               var res = ns.to_s
                ns.free
                return res
        end
@@ -244,7 +244,7 @@ class MongoClient
                var i = 0
                var name = nas[i]
                while not name.address_is_null do
-                       res.add name.to_s_with_copy
+                       res.add name.to_s
                        name.free
                        i += 1
                        name = nas[i]
@@ -335,7 +335,7 @@ class MongoDb
                var i = 0
                var name = nas[i]
                while not name.address_is_null do
-                       res.add name.to_s_with_copy
+                       res.add name.to_s
                        name.free
                        i += 1
                        name = nas[i]