Skip to content

Commit 862877a

Browse files
cyberhumanrr0gi
authored andcommitted
Convert signed tinyint properly (fixes #30)
1 parent 42f18a9 commit 862877a

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/field.ml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,9 @@ let convert field typ unsigned =
7474
let open Unsigned in
7575
match typ, unsigned with
7676
| `Null, _ -> `Null
77-
| (`Tiny | `Year), _ -> `Int (int_of_char (cast_to char field))
77+
| `Year, _
78+
| `Tiny, true -> `Int (int_of_char (cast_to char field))
79+
| `Tiny, false -> `Int (cast_to schar field)
7880
| `Short, true -> `Int (cast_to int field)
7981
| `Short, false -> `Int (UInt.to_int (cast_to uint field))
8082
| (`Int24 | `Long), true -> `Int (UInt32.to_int (cast_to uint32_t field))

0 commit comments

Comments
 (0)