aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorRobin Haberkorn <rhaberkorn@fmsbw.de>2026-11-19 20:33:46 +0100
committerRobin Haberkorn <rhaberkorn@fmsbw.de>2026-11-20 00:24:19 +0100
commitb2ab0659fad23fa916505afce07beb277fb0ced9 (patch)
treeae3596163d476c20326bff98590097e840451f98 /src
parentdaa46b24452c2c2eb817170d48a6585bec3c919e (diff)
use G_GSIZE_FORMAT: prevents warnings on platforms where gsize is not size_t
This was observed on OmniOS i386, where it is probably a misconfiguration of glib. I also had to replace one reference of g_ascii_strncasecmp() with libc's strncasecmp() because of the type mismatch.
Diffstat (limited to 'src')
-rw-r--r--src/lsp.c28
-rw-r--r--src/parser.c2
-rw-r--r--src/symbols.c2
3 files changed, 16 insertions, 16 deletions
diff --git a/src/lsp.c b/src/lsp.c
index ee9f945..0253a52 100644
--- a/src/lsp.c
+++ b/src/lsp.c
@@ -296,7 +296,7 @@ teco_lsp_send(const gchar *req, GError **error)
gsize req_len = strlen(req);
gchar header[256];
- gsize header_len = g_snprintf(header, sizeof(header), "Content-Length: %zu\r\n\r\n", req_len);
+ gsize header_len = g_snprintf(header, sizeof(header), "Content-Length: %" G_GSIZE_FORMAT "\r\n\r\n", req_len);
if (g_io_channel_write_chars(teco_lsp.stdin_chan, header, header_len,
NULL, error) == G_IO_STATUS_ERROR ||
@@ -382,7 +382,7 @@ teco_lsp_recv(teco_string_t *resp, GError **error)
return FALSE;
if (len == 0)
break;
- sscanf(line, "Content-Length: %zu", &resp->len);
+ sscanf(line, "Content-Length: %" G_GSIZE_FORMAT, &resp->len);
}
if (!resp->len) {
@@ -401,7 +401,7 @@ teco_lsp_recv(teco_string_t *resp, GError **error)
/* can only mean end of LSP's stdout */
g_free(resp->data);
g_set_error(error, TECO_ERROR, TECO_ERROR_FAILED,
- "Unexpected end of response (%zu bytes instead of %zu)",
+ "Unexpected end of response (%" G_GSIZE_FORMAT " bytes instead of %" G_GSIZE_FORMAT ")",
read_len, resp->len);
return FALSE;
}
@@ -416,7 +416,7 @@ teco_lsp_recv(teco_string_t *resp, GError **error)
if (obj.type != SJ_OBJECT) {
g_free(resp->data);
g_set_error(error, TECO_ERROR, TECO_ERROR_FAILED,
- "Expected object in response (at byte %zu)",
+ "Expected object in response (at byte %" G_GSIZE_FORMAT ")",
obj.start - reader.data);
return FALSE;
}
@@ -668,7 +668,7 @@ teco_lsp_didchange_insert(teco_buffer_t *buffer, gsize pos, gsize len,
gsize req_len = req_prefix_len + teco_json_escape_len(text, len) + sizeof(req_suffix)-1;
gchar header[256];
- gsize header_len = g_snprintf(header, sizeof(header), "Content-Length: %zu\r\n\r\n", req_len);
+ gsize header_len = g_snprintf(header, sizeof(header), "Content-Length: %" G_GSIZE_FORMAT "\r\n\r\n", req_len);
if (g_io_channel_write_chars(teco_lsp.stdin_chan, header, header_len,
NULL, error) == G_IO_STATUS_ERROR ||
@@ -810,7 +810,7 @@ teco_lsp_parse_location(sj_Reader reader, sj_Value obj, GError **error)
{
if (obj.type != SJ_OBJECT) {
g_set_error(error, TECO_ERROR, TECO_ERROR_FAILED,
- "Expected object in response (at byte %zu)",
+ "Expected object in response (at byte %" G_GSIZE_FORMAT ")",
obj.start - reader.data);
return NULL;
}
@@ -826,7 +826,7 @@ teco_lsp_parse_location(sj_Reader reader, sj_Value obj, GError **error)
sj_Value obj = val;
if (obj.type != SJ_OBJECT) {
g_set_error(error, TECO_ERROR, TECO_ERROR_FAILED,
- "Expected object in response (at byte %zu)",
+ "Expected object in response (at byte %" G_GSIZE_FORMAT ")",
obj.start - reader.data);
return NULL;
}
@@ -837,14 +837,14 @@ teco_lsp_parse_location(sj_Reader reader, sj_Value obj, GError **error)
obj = val;
if (obj.type != SJ_OBJECT) {
g_set_error(error, TECO_ERROR, TECO_ERROR_FAILED,
- "Expected object in response (at byte %zu)",
+ "Expected object in response (at byte %" G_GSIZE_FORMAT ")",
obj.start - reader.data);
return NULL;
}
} else if (teco_json_eq(key, "line")) {
if (val.type != SJ_NUMBER) {
g_set_error(error, TECO_ERROR, TECO_ERROR_FAILED,
- "Expected number in response (at byte %zu)",
+ "Expected number in response (at byte %" G_GSIZE_FORMAT ")",
val.start - reader.data);
return NULL;
}
@@ -856,7 +856,7 @@ teco_lsp_parse_location(sj_Reader reader, sj_Value obj, GError **error)
*/
if (val.type != SJ_NUMBER) {
g_set_error(error, TECO_ERROR, TECO_ERROR_FAILED,
- "Expected number in response (at byte %zu)",
+ "Expected number in response (at byte %" G_GSIZE_FORMAT ")",
val.start - reader.data);
return NULL;
}
@@ -919,7 +919,7 @@ teco_lsp_lookup_symbol(teco_string_t str, gboolean match_exact, GError **error)
sj_Value arr = val;
if (arr.type != SJ_NULL && arr.type != SJ_ARRAY) {
g_set_error(error, TECO_ERROR, TECO_ERROR_FAILED,
- "Expected array in response (at byte %zu)",
+ "Expected array in response (at byte %" G_GSIZE_FORMAT ")",
arr.start - reader.data);
return FALSE;
}
@@ -928,7 +928,7 @@ teco_lsp_lookup_symbol(teco_string_t str, gboolean match_exact, GError **error)
while (sj_iter_array(&reader, arr, &obj)) {
if (obj.type != SJ_OBJECT) {
g_set_error(error, TECO_ERROR, TECO_ERROR_FAILED,
- "Expected object in response (at byte %zu)",
+ "Expected object in response (at byte %" G_GSIZE_FORMAT ")",
obj.start - reader.data);
return FALSE;
}
@@ -1126,7 +1126,7 @@ teco_lsp_lookup_definition(teco_buffer_t *buffer, teco_int_t pos, GError **error
teco_stailq_insert_tail(&teco_lsp.list, &result->entry);
} else if (val.type != SJ_NULL && val.type != SJ_ARRAY) {
g_set_error(error, TECO_ERROR, TECO_ERROR_FAILED,
- "Expected array in response (at byte %zu)",
+ "Expected array in response (at byte %" G_GSIZE_FORMAT ")",
val.start - reader.data);
return FALSE;
}
@@ -1196,7 +1196,7 @@ teco_lsp_lookup_references(teco_buffer_t *buffer, teco_int_t pos, GError **error
sj_Value arr = val;
if (arr.type != SJ_NULL && arr.type != SJ_ARRAY) {
g_set_error(error, TECO_ERROR, TECO_ERROR_FAILED,
- "Expected array in response (at byte %zu)",
+ "Expected array in response (at byte %" G_GSIZE_FORMAT ")",
arr.start - reader.data);
return FALSE;
}
diff --git a/src/parser.c b/src/parser.c
index 28f6fd8..3a5508a 100644
--- a/src/parser.c
+++ b/src/parser.c
@@ -123,7 +123,7 @@ teco_machine_main_step(teco_machine_main_t *ctx, const gchar *macro, gsize stop_
gunichar chr = g_utf8_get_char(macro+ctx->macro_pc);
#ifdef DEBUG
- g_printf("EXEC(%zu): input='%C' (U+%04" G_GINT32_MODIFIER "X), state=%p, mode=%d\n",
+ g_printf("EXEC(%" G_GSIZE_FORMAT "): input='%C' (U+%04" G_GINT32_MODIFIER "X), state=%p, mode=%d\n",
ctx->macro_pc, chr, chr, ctx->parent.current, ctx->flags.mode);
#endif
diff --git a/src/symbols.c b/src/symbols.c
index 5feaba0..bd0c077 100644
--- a/src/symbols.c
+++ b/src/symbols.c
@@ -58,7 +58,7 @@ teco_symbol_list_init(teco_symbol_list_t *ctx, const teco_symbol_entry_t *entrie
memset(ctx, 0, sizeof(*ctx));
ctx->entries = entries;
ctx->size = size;
- ctx->cmp_fnc = case_sensitive ? strncmp : g_ascii_strncasecmp;
+ ctx->cmp_fnc = case_sensitive ? strncmp : strncasecmp;
}
/**