From 1e3bc7c0699ff005c35f8f66412b9a6c63383577 Mon Sep 17 00:00:00 2001 From: Mathieu Malaterre Date: Mon, 26 Mar 2012 08:51:12 +0000 Subject: [PATCH] [trunk] Fix a potential issue with truncation of pointers diff --- libopenjpeg/bio.c | 2 +- libopenjpeg/bio.h | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/libopenjpeg/bio.c b/libopenjpeg/bio.c index ca79695d..9b6d694c 100644 --- a/libopenjpeg/bio.c +++ b/libopenjpeg/bio.c @@ -125,7 +125,7 @@ void bio_destroy(opj_bio_t *bio) { } } -int bio_numbytes(opj_bio_t *bio) { +ptrdiff_t bio_numbytes(opj_bio_t *bio) { return (bio->bp - bio->start); } diff --git a/libopenjpeg/bio.h b/libopenjpeg/bio.h index 764d7cb2..cb3f37de 100644 --- a/libopenjpeg/bio.h +++ b/libopenjpeg/bio.h @@ -31,6 +31,9 @@ #ifndef __BIO_H #define __BIO_H + +#include /* ptrdiff_t */ + /** @file bio.h @brief Implementation of an individual bit input-output (BIO) @@ -75,7 +78,7 @@ Number of bytes written. @param bio BIO handle @return Returns the number of bytes written */ -int bio_numbytes(opj_bio_t *bio); +ptrdiff_t bio_numbytes(opj_bio_t *bio); /** Init encoder @param bio BIO handle -- 2.40.0