From 7f574273180ac940c57da0f28c26a5274c165e48 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sun, 4 Oct 2020 17:14:48 +0200 Subject: file: use size_t for position and pointer The bufsz variable is used to store the size of the buf memory region and pos is used to index a position in this memory. Use size_t for these variables in the internal handling instaed of int to not break with big files. Signed-off-by: Hauke Mehrtens --- uci_internal.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'uci_internal.h') diff --git a/uci_internal.h b/uci_internal.h index f00b394..3a94dbb 100644 --- a/uci_internal.h +++ b/uci_internal.h @@ -23,7 +23,7 @@ struct uci_parse_context /* error context */ const char *reason; int line; - int byte; + size_t byte; /* private: */ struct uci_package *package; @@ -32,8 +32,8 @@ struct uci_parse_context FILE *file; const char *name; char *buf; - int bufsz; - int pos; + size_t bufsz; + size_t pos; }; #define pctx_pos(pctx) ((pctx)->pos) #define pctx_str(pctx, i) (&(pctx)->buf[(i)]) @@ -54,7 +54,7 @@ __private struct uci_package *uci_alloc_package(struct uci_context *ctx, const c __private FILE *uci_open_stream(struct uci_context *ctx, const char *filename, const char *origfilename, int pos, bool write, bool create); __private void uci_close_stream(FILE *stream); -__private void uci_getln(struct uci_context *ctx, int offset); +__private void uci_getln(struct uci_context *ctx, size_t offset); __private void uci_parse_error(struct uci_context *ctx, char *reason); __private void uci_alloc_parse_context(struct uci_context *ctx); -- cgit v1.2.1