[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[virt-tools-list] [PATCH 1/2] entity: Use g_ascii_strtoll to parse int64 strings

osinfo_entity_get_param_value_int64 uses g_ascii_strod to parse
strings to int64, better to use g_ascii_strtoll which is there
for that purpose.

Maybe this was done on purpose because we have floating point values which
we want to interpret as int64, but even in this case I think this patch
will do the right thing.

 osinfo/osinfo_entity.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/osinfo/osinfo_entity.c b/osinfo/osinfo_entity.c
index 348981e..f86b142 100644
--- a/osinfo/osinfo_entity.c
+++ b/osinfo/osinfo_entity.c
@@ -371,7 +371,7 @@ gint64 osinfo_entity_get_param_value_int64(OsinfoEntity *entity,
     if (str == NULL)
         return -1;
-    return (gint64) g_ascii_strtod(str, NULL);
+    return (gint64) g_ascii_strtoll(str, NULL);
 gint64 osinfo_entity_get_param_value_int64_with_default(OsinfoEntity *entity,

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]