diff --git a/main/mio.c b/main/mio.c index 075b1621d1..1e924cdb4c 100644 --- a/main/mio.c +++ b/main/mio.c @@ -361,12 +361,12 @@ MIO *mio_new_memory (unsigned char *data, * @size: the length of the data copied from @base to new mio * * Creates a new #MIO object by copying data from existing #MIO (@base). - * The range for copying are given with @start and @size. + * The range for copying is given with @start and @size. * Copying data at the range from @start to the end of @base is - * done if 0 is given as @size. + * done if -1 is given as @size. * - * If @size(!= 0) is larger than the length from @start to the end of - * @base, %NULL is return. + * If @size is larger than the length from @start to the end of + * @base, %NULL is returned. * * The function doesn't move the file position of @base. * @@ -374,7 +374,7 @@ MIO *mio_new_memory (unsigned char *data, * */ -MIO *mio_new_mio (MIO *base, long start, size_t size) +MIO *mio_new_mio (MIO *base, long start, long size) { unsigned char *data; long original_pos; @@ -383,7 +383,7 @@ MIO *mio_new_mio (MIO *base, long start, size_t size) original_pos = mio_tell (base); - if (size == 0) + if (size == -1) { long end; diff --git a/main/mio.h b/main/mio.h index e78ad8962f..b9186f788b 100644 --- a/main/mio.h +++ b/main/mio.h @@ -123,7 +123,7 @@ MIO *mio_new_memory (unsigned char *data, MIOReallocFunc realloc_func, MIODestroyNotify free_func); -MIO *mio_new_mio (MIO *base, long start, size_t size); +MIO *mio_new_mio (MIO *base, long start, long size); MIO *mio_ref (MIO *mio); int mio_free (MIO *mio); diff --git a/main/parse.c b/main/parse.c index 66306dd6fc..2ac40454fe 100644 --- a/main/parse.c +++ b/main/parse.c @@ -854,7 +854,7 @@ struct getLangCtx { (mio_memory_get_data((_glc_)->input, NULL) == NULL)) \ { \ MIO *tmp_ = (_glc_)->input; \ - (_glc_)->input = mio_new_mio (tmp_, 0, 0); \ + (_glc_)->input = mio_new_mio (tmp_, 0, -1); \ mio_free (tmp_); \ if (!(_glc_)->input) { \ (_glc_)->err = true; \