/*
* Fetch a new line from the input stream and resize buffer if necessary
*/
-__private void uci_getln(struct uci_context *ctx, int offset)
+__private void uci_getln(struct uci_context *ctx, size_t offset)
{
struct uci_parse_context *pctx = ctx->pctx;
char *p;
- int ofs;
+ size_t ofs;
if (pctx->buf == NULL) {
pctx->buf = uci_malloc(ctx, LINEBUF);
pctx->pos += 1;
}
-static inline void addc(struct uci_context *ctx, int *pos_dest, int *pos_src)
+static inline void addc(struct uci_context *ctx, size_t *pos_dest, size_t *pos_src)
{
struct uci_parse_context *pctx = ctx->pctx;
/*
* parse a double quoted string argument from the command line
*/
-static void parse_double_quote(struct uci_context *ctx, int *target)
+static void parse_double_quote(struct uci_context *ctx, size_t *target)
{
struct uci_parse_context *pctx = ctx->pctx;
char c;
/*
* parse a single quoted string argument from the command line
*/
-static void parse_single_quote(struct uci_context *ctx, int *target)
+static void parse_single_quote(struct uci_context *ctx, size_t *target)
{
struct uci_parse_context *pctx = ctx->pctx;
char c;
/*
* parse a string from the command line and detect the quoting style
*/
-static void parse_str(struct uci_context *ctx, int *target)
+static void parse_str(struct uci_context *ctx, size_t *target)
{
struct uci_parse_context *pctx = ctx->pctx;
bool next = true;
static int next_arg(struct uci_context *ctx, bool required, bool name, bool package)
{
struct uci_parse_context *pctx = ctx->pctx;
- int val, ptr;
+ size_t val, ptr;
skip_whitespace(ctx);
val = ptr = pctx_pos(pctx);
err = UCI_ERR_UNKNOWN;
if (ctx && ctx->pctx && (err == UCI_ERR_PARSE)) {
- snprintf(error_info, sizeof(error_info) - 1, " (%s) at line %d, byte %d",
+ snprintf(error_info, sizeof(error_info) - 1, " (%s) at line %d, byte %zu",
(ctx->pctx->reason ? ctx->pctx->reason : "unknown"),
ctx->pctx->line, ctx->pctx->byte);
}
/* error context */
const char *reason;
int line;
- int byte;
+ size_t byte;
/* private: */
struct uci_package *package;
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)])
__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);