Skip to content

Commit

Permalink
[Minor] Set binary flag on binary texts
Browse files Browse the repository at this point in the history
  • Loading branch information
vstakhov committed Jul 1, 2022
1 parent d3baaae commit e002ae9
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions contrib/libucl/lua_ucl.c
Expand Up @@ -512,6 +512,11 @@ ucl_object_lua_fromelt (lua_State *L, int idx, ucl_string_flags_t flags)

if (t) {
obj = ucl_object_fromstring_common(t->start, t->len, 0);

/* Binary text */
if (t->flags & (1u << 5u)) {
obj->flags |= UCL_OBJECT_BINARY;
}
}
}
break;
Expand Down Expand Up @@ -569,10 +574,10 @@ ucl_object_lua_import (lua_State *L, int idx)
t = lua_type (L, idx);
switch (t) {
case LUA_TTABLE:
obj = ucl_object_lua_fromtable (L, idx, 0);
obj = ucl_object_lua_fromtable (L, idx, UCL_STRING_RAW);
break;
default:
obj = ucl_object_lua_fromelt (L, idx, 0);
obj = ucl_object_lua_fromelt (L, idx, UCL_STRING_RAW);
break;
}

Expand All @@ -597,10 +602,10 @@ ucl_object_lua_import_escape (lua_State *L, int idx)
t = lua_type (L, idx);
switch (t) {
case LUA_TTABLE:
obj = ucl_object_lua_fromtable (L, idx, UCL_STRING_RAW);
obj = ucl_object_lua_fromtable (L, idx, UCL_STRING_ESCAPE);
break;
default:
obj = ucl_object_lua_fromelt (L, idx, UCL_STRING_RAW);
obj = ucl_object_lua_fromelt (L, idx, UCL_STRING_ESCAPE);
break;
}

Expand Down

0 comments on commit e002ae9

Please sign in to comment.