Skip to content

Wrong type format #1

@shakna-israel

Description

@shakna-israel

The type formats have been a pain, and aren't always the same crossplatform, even today.
However, in the 64bit era, this little change should fix some rare bugs:

diff --git a/include/libsdlang.h b/include/libsdlang.h
index 8376957..4e4a6a2 100644
--- a/include/libsdlang.h
+++ b/include/libsdlang.h
@@ -1229,10 +1229,10 @@ extern "C"
             _SDLANG_EMIT_RETURN(slice);
             return error;
         case SDLANG_VALUE_TYPE_FLOATING:
-            slice.length = sprintf(buffer, "%lf", v.floatValue);
+            slice.length = sprintf(buffer, "%Lf", v.floatValue);
             return emitter(slice, userData);
         case SDLANG_VALUE_TYPE_INTEGER:
-            slice.length = sprintf(buffer, "%lld", v.intValue);
+            slice.length = sprintf(buffer, "%zu", v.intValue);
             return emitter(slice, userData);
         case SDLANG_VALUE_TYPE_NULL:
             return emitter({"null", 4}, userData);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions