gluon-web: fix c indentation

This commit is contained in:
Jan-Niklas Burfeind 2023-01-03 16:12:08 +01:00
parent 9c023fba57
commit 896dae59f6
4 changed files with 32 additions and 32 deletions

View File

@ -38,9 +38,9 @@ static inline uint16_t get_le16(const void *data) {
static inline uint32_t get_be32(const void *data) {
const uint8_t *d = data;
return (((uint32_t)d[0]) << 24)
| (((uint32_t)d[1]) << 16)
| (((uint32_t)d[2]) << 8)
| d[3];
| (((uint32_t)d[1]) << 16)
| (((uint32_t)d[2]) << 8)
| d[3];
}
/*

View File

@ -97,8 +97,8 @@ static int template_L_load_catalog(lua_State *L)
return 0;
}
luaL_getmetatable(L, TEMPLATE_CATALOG);
lua_setmetatable(L, -2);
luaL_getmetatable(L, TEMPLATE_CATALOG);
lua_setmetatable(L, -2);
return 1;
}
@ -106,7 +106,7 @@ static int template_L_load_catalog(lua_State *L)
static int template_catalog_call(lua_State *L)
{
size_t inlen, outlen;
lmo_catalog_t *cat = luaL_checkudata(L, 1, TEMPLATE_CATALOG);
lmo_catalog_t *cat = luaL_checkudata(L, 1, TEMPLATE_CATALOG);
const char *in = luaL_checklstring(L, 2, &inlen), *out;
if (!lmo_translate(cat, in, inlen, &out, &outlen))
return 0;
@ -118,7 +118,7 @@ static int template_catalog_call(lua_State *L)
static int template_catalog_gc(lua_State *L)
{
lmo_catalog_t *cat = luaL_checkudata(L, 1, TEMPLATE_CATALOG);
lmo_catalog_t *cat = luaL_checkudata(L, 1, TEMPLATE_CATALOG);
lmo_unload(cat);
return 0;
@ -133,8 +133,8 @@ static const luaL_reg R[] = {
};
static const luaL_reg template_catalog_methods[] = {
{ "__call", template_catalog_call },
{ "__gc", template_catalog_gc },
{ "__call", template_catalog_call },
{ "__gc", template_catalog_gc },
{}
};

View File

@ -414,7 +414,7 @@ int template_error(lua_State *L, struct template_parser *parser)
}
snprintf(msg, sizeof(msg), "Syntax error in %s:%d: %s",
parser->file ?: "[string]", line + chunkline, err ?: "(unknown error)");
parser->file ?: "[string]", line + chunkline, err ?: "(unknown error)");
lua_pushnil(L);
lua_pushinteger(L, line + chunkline);

View File

@ -130,37 +130,37 @@ static inline bool mb_is_shortest(const unsigned char *s, size_t n)
case 2:
/* 1100000x (10xxxxxx) */
return !(((*s >> 1) == 0x60) &&
((*(s+1) >> 6) == 0x02));
((*(s+1) >> 6) == 0x02));
case 3:
/* 11100000 100xxxxx (10xxxxxx) */
return !((*s == 0xE0) &&
((*(s+1) >> 5) == 0x04) &&
((*(s+2) >> 6) == 0x02));
((*(s+1) >> 5) == 0x04) &&
((*(s+2) >> 6) == 0x02));
case 4:
/* 11110000 1000xxxx (10xxxxxx 10xxxxxx) */
return !((*s == 0xF0) &&
((*(s+1) >> 4) == 0x08) &&
((*(s+2) >> 6) == 0x02) &&
((*(s+3) >> 6) == 0x02));
((*(s+1) >> 4) == 0x08) &&
((*(s+2) >> 6) == 0x02) &&
((*(s+3) >> 6) == 0x02));
case 5:
/* 11111000 10000xxx (10xxxxxx 10xxxxxx 10xxxxxx) */
return !((*s == 0xF8) &&
((*(s+1) >> 3) == 0x10) &&
((*(s+2) >> 6) == 0x02) &&
((*(s+3) >> 6) == 0x02) &&
((*(s+4) >> 6) == 0x02));
((*(s+1) >> 3) == 0x10) &&
((*(s+2) >> 6) == 0x02) &&
((*(s+3) >> 6) == 0x02) &&
((*(s+4) >> 6) == 0x02));
case 6:
/* 11111100 100000xx (10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx) */
return !((*s == 0xF8) &&
((*(s+1) >> 2) == 0x20) &&
((*(s+2) >> 6) == 0x02) &&
((*(s+3) >> 6) == 0x02) &&
((*(s+4) >> 6) == 0x02) &&
((*(s+5) >> 6) == 0x02));
((*(s+1) >> 2) == 0x20) &&
((*(s+2) >> 6) == 0x02) &&
((*(s+3) >> 6) == 0x02) &&
((*(s+4) >> 6) == 0x02) &&
((*(s+5) >> 6) == 0x02));
}
return true;
@ -270,18 +270,18 @@ bool pcdata(const char *s, size_t l, char **out, size_t *outl)
for (o = 0; o < l; o++) {
/* Invalid XML bytes */
if ((*ptr <= 0x08) ||
((*ptr >= 0x0B) && (*ptr <= 0x0C)) ||
((*ptr >= 0x0E) && (*ptr <= 0x1F)) ||
(*ptr == 0x7F)) {
((*ptr >= 0x0B) && (*ptr <= 0x0C)) ||
((*ptr >= 0x0E) && (*ptr <= 0x1F)) ||
(*ptr == 0x7F)) {
ptr++;
}
/* Escapes */
else if ((*ptr == '\'') ||
(*ptr == '"') ||
(*ptr == '&') ||
(*ptr == '<') ||
(*ptr == '>')) {
(*ptr == '"') ||
(*ptr == '&') ||
(*ptr == '<') ||
(*ptr == '>')) {
esl = snprintf(esq, sizeof(esq), "&#%i;", *ptr);
if (!buf_append(buf, esq, esl))