make radload slightly more robust

stops some valgrind warnings
This commit is contained in:
John Cupitt 2016-03-12 15:10:52 +00:00
parent acf5f5169a
commit abe4e70d02
4 changed files with 45 additions and 14 deletions

View File

@ -2,6 +2,7 @@
- fix a crash with SPARC byte-order labq vips images
- fix parsing of filenames containing brackets, thanks shilpi230
- fix hist_entropy (lovell)
- small fixes to radiance load
12/1/16 started 8.2.2
- changes to ease compiling C++ binding with MSVC [Lovell Fuller]

View File

@ -25,6 +25,7 @@ TARGET_DIR=$(HTML_DIR)/$(DOC_MODULE)
SETUP_FILES = \
$(content_files) \
$(expand_content_files) \
$(DOC_MAIN_SGML_FILE) \
$(DOC_MODULE)-sections.txt \
$(DOC_MODULE)-overrides.txt
@ -86,7 +87,7 @@ GTK_DOC_V_SETUP_0=@echo " DOC Preparing build";
setup-build.stamp:
-$(GTK_DOC_V_SETUP)if test "$(abs_srcdir)" != "$(abs_builddir)" ; then \
files=`echo $(SETUP_FILES) $(expand_content_files) $(DOC_MODULE).types`; \
files=`echo $(SETUP_FILES) $(DOC_MODULE).types`; \
if test "x$$files" != "x" ; then \
for file in $$files ; do \
destdir=`dirname $(abs_builddir)/$$file`; \
@ -118,7 +119,7 @@ scan-build.stamp: setup-build.stamp $(HFILE_GLOB) $(CFILE_GLOB)
$(GTK_DOC_V_INTROSPECT)if grep -l '^..*$$' $(DOC_MODULE).types > /dev/null 2>&1 ; then \
scanobj_options=""; \
gtkdoc-scangobj 2>&1 --help | grep >/dev/null "\-\-verbose"; \
if test "$(?)" = "0"; then \
if test "$$?" = "0"; then \
if test "x$(V)" = "x1"; then \
scanobj_options="--verbose"; \
fi; \
@ -162,17 +163,17 @@ GTK_DOC_V_XREF=$(GTK_DOC_V_XREF_$(V))
GTK_DOC_V_XREF_=$(GTK_DOC_V_XREF_$(AM_DEFAULT_VERBOSITY))
GTK_DOC_V_XREF_0=@echo " DOC Fixing cross-references";
html-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files)
html-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files) $(expand_content_files)
$(GTK_DOC_V_HTML)rm -rf html && mkdir html && \
mkhtml_options=""; \
gtkdoc-mkhtml 2>&1 --help | grep >/dev/null "\-\-verbose"; \
if test "$(?)" = "0"; then \
if test "$$?" = "0"; then \
if test "x$(V)" = "x1"; then \
mkhtml_options="$$mkhtml_options --verbose"; \
fi; \
fi; \
gtkdoc-mkhtml 2>&1 --help | grep >/dev/null "\-\-path"; \
if test "$(?)" = "0"; then \
if test "$$?" = "0"; then \
mkhtml_options="$$mkhtml_options --path=\"$(abs_srcdir)\""; \
fi; \
cd html && gtkdoc-mkhtml $$mkhtml_options $(MKHTML_OPTIONS) $(DOC_MODULE) ../$(DOC_MAIN_SGML_FILE)
@ -194,11 +195,11 @@ GTK_DOC_V_PDF=$(GTK_DOC_V_PDF_$(V))
GTK_DOC_V_PDF_=$(GTK_DOC_V_PDF_$(AM_DEFAULT_VERBOSITY))
GTK_DOC_V_PDF_0=@echo " DOC Building PDF";
pdf-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files)
pdf-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files) $(expand_content_files)
$(GTK_DOC_V_PDF)rm -f $(DOC_MODULE).pdf && \
mkpdf_options=""; \
gtkdoc-mkpdf 2>&1 --help | grep >/dev/null "\-\-verbose"; \
if test "$(?)" = "0"; then \
if test "$$?" = "0"; then \
if test "x$(V)" = "x1"; then \
mkpdf_options="$$mkpdf_options --verbose"; \
fi; \
@ -223,12 +224,15 @@ clean-local:
@if echo $(SCAN_OPTIONS) | grep -q "\-\-rebuild-types" ; then \
rm -f $(DOC_MODULE).types; \
fi
@if echo $(SCAN_OPTIONS) | grep -q "\-\-rebuild-sections" ; then \
rm -f $(DOC_MODULE)-sections.txt; \
fi
distclean-local:
@rm -rf xml html $(REPORT_FILES) $(DOC_MODULE).pdf \
$(DOC_MODULE)-decl-list.txt $(DOC_MODULE)-decl.txt
@if test "$(abs_srcdir)" != "$(abs_builddir)" ; then \
rm -f $(SETUP_FILES) $(expand_content_files) $(DOC_MODULE).types; \
rm -f $(SETUP_FILES) $(DOC_MODULE).types; \
fi
maintainer-clean-local:

View File

@ -9,7 +9,7 @@
<bookinfo>
<title>VIPS Reference Manual</title>
<releaseinfo>
For VIPS 8.2.2.
For VIPS 8.2.3.
The latest version of this documentation can be found on the
<ulink role="online-location"
url="http://www.vips.ecs.soton.ac.uk/index.php?title=Documentation">VIPS website</ulink>.

View File

@ -653,16 +653,23 @@ buffer_need( Buffer *buffer, int require )
int remaining;
g_assert( require < BUFFER_MARGIN );
g_assert( buffer->length >= 0 );
g_assert( buffer->position >= 0 );
g_assert( buffer->position <= buffer->length );
remaining = buffer->length - buffer->position;
if( remaining < require ) {
size_t len;
memcpy( buffer->text,
/* Areas can overlap.
*/
memmove( buffer->text,
buffer->text + buffer->position, remaining );
buffer->position = 0;
buffer->length = remaining;
g_assert( buffer->length < BUFFER_MARGIN );
len = fread( buffer->text + buffer->length,
1, BUFFER_SIZE, buffer->fp );
buffer->length += len;
@ -687,6 +694,10 @@ scanline_read_old( Buffer *buffer, COLR *scanline, int width )
{
int rshift;
g_assert( buffer->length >= 0 );
g_assert( buffer->position >= 0 );
g_assert( buffer->position <= buffer->length );
rshift = 0;
while( width > 0 ) {
@ -728,6 +739,10 @@ scanline_read( Buffer *buffer, COLR *scanline, int width )
{
int i, j;
g_assert( buffer->length >= 0 );
g_assert( buffer->position >= 0 );
g_assert( buffer->position <= buffer->length );
/* Detect old-style scanlines.
*/
if( width < MINELEN ||
@ -996,8 +1011,10 @@ static const char *colcor_name[3] = {
static int
rad2vips_get_header( Read *read, VipsImage *out )
{
int i, j;
VipsInterpretation interpretation;
int width;
int height;
int i, j;
if( getheader( read->fin, (gethfunc *) rad2vips_process_line, read ) ||
!fgetsresolu( &read->rs, read->fin ) ) {
@ -1013,9 +1030,17 @@ rad2vips_get_header( Read *read, VipsImage *out )
else
interpretation = VIPS_INTERPRETATION_MULTIBAND;
vips_image_init_fields( out,
scanlen( &read->rs ), numscans( &read->rs ),
4,
width = scanlen( &read->rs );
height = numscans( &read->rs );
if( width <= 0 ||
width > VIPS_MAX_COORD ||
height <= 0 ||
height > VIPS_MAX_COORD ) {
vips_error( "rad2vips", "%s", _( "image size out of bounds" ) );
return( -1 );
}
vips_image_init_fields( out, width, height, 4,
VIPS_FORMAT_UCHAR, VIPS_CODING_RAD,
interpretation,
1, read->aspect );
@ -1080,6 +1105,7 @@ rad2vips_generate( VipsRegion *or,
if( scanline_read( read->buffer, buf, or->im->Xsize ) ) {
vips_error( "rad2vips",
_( "read error line %d" ), r->top + y );
VIPS_GATE_STOP( "rad2vips_generate: work" );
return( -1 );
}
}