diff --git a/ChangeLog b/ChangeLog index 6b820278..8010bb02 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +26/11/09 started 7.20.3 +- updated en_GB.po translation +- file_length is gint64 to avoid win32 breakage + 23/11/09 started 7.20.2 - GETTEXT_PACKAGE now includes lib version number (thanks Jay) diff --git a/configure.in b/configure.in index 0b43ed14..ab963985 100644 --- a/configure.in +++ b/configure.in @@ -6,7 +6,7 @@ AC_CONFIG_MACRO_DIR(m4) # user-visible library versioning IM_MAJOR_VERSION=7 IM_MINOR_VERSION=20 -IM_MICRO_VERSION=2 +IM_MICRO_VERSION=3 IM_VERSION=$IM_MAJOR_VERSION.$IM_MINOR_VERSION.$IM_MICRO_VERSION IM_VERSION_STRING=$IM_VERSION-`date` diff --git a/libvips/include/vips/image.h b/libvips/include/vips/image.h index fbac3aaf..39ad77cc 100644 --- a/libvips/include/vips/image.h +++ b/libvips/include/vips/image.h @@ -227,8 +227,11 @@ typedef struct _VipsImage { /* Record the file length here. We use this to stop ourselves mapping * things beyond the end of the file in the case that the file has * been truncated. + * + * gint64 so that we can guarantee to work even on systems with + * strange ideas about large files. */ - size_t file_length; + gint64 file_length; /* Set this when im_demand_hint_array() is called, and check in any * operation that will demand pixels from the image. diff --git a/libvips/iofuncs/im_binfile.c b/libvips/iofuncs/im_binfile.c index 6869ef97..bab0d631 100644 --- a/libvips/iofuncs/im_binfile.c +++ b/libvips/iofuncs/im_binfile.c @@ -128,7 +128,7 @@ im_binfile( const char *name, int xsize, int ysize, int bands, int offset ) im_close( im ); return( NULL ); } - im->file_length = (size_t) rsize; + im->file_length = rsize; /* Very common, so special message. */ diff --git a/libvips/iofuncs/im_mapfile.c b/libvips/iofuncs/im_mapfile.c index f7bb389a..00d334af 100644 --- a/libvips/iofuncs/im_mapfile.c +++ b/libvips/iofuncs/im_mapfile.c @@ -107,24 +107,26 @@ im__mmap( int fd, int writeable, size_t length, gint64 offset ) void *baseaddr; #ifdef DEBUG - printf( "im__mmap: length = %d, offset = %lld\n", length, offset ); + printf( "im__mmap: length = 0x%zx, offset = 0x%lx\n", length, offset ); #endif /*DEBUG*/ + printf( "** start\n" ); + printf( "length = 0x%zx\n", length ); + printf( "offset = 0x%lx\n", (guint64) offset ); + #ifdef OS_WIN32 { HANDLE hFile = (HANDLE) _get_osfhandle( fd ); - HANDLE hMMFile; + DWORD flProtect; DWORD dwDesiredAccess; + + HANDLE hMMFile; + + ULARGE_INTEGER quad; DWORD dwFileOffsetHigh; DWORD dwFileOffsetLow; - /* woah, slightly gross - */ - int dws = sizeof( DWORD ); - int shift = 8 * dws; - gint64 mask = ((gint64) -1) >> shift; - if( writeable ) { flProtect = PAGE_READWRITE; dwDesiredAccess = FILE_MAP_WRITE; @@ -134,20 +136,29 @@ im__mmap( int fd, int writeable, size_t length, gint64 offset ) dwDesiredAccess = FILE_MAP_READ; } + quad.QuadPart = offset; + dwFileOffsetLow = quad.LowPart; + dwFileOffsetHigh = quad.HighPart; + + printf( "flProtect = 0x%x\n", flProtect ); + printf( "flProtect = 0x%x\n", flProtect ); + printf( "dwDesiredAccess = 0x%x\n", dwDesiredAccess ); + printf( "dwFileOffsetHigh = 0x%x\n", dwFileOffsetHigh ); + printf( "dwFileOffsetLow = 0x%x\n", dwFileOffsetLow ); + if( !(hMMFile = CreateFileMapping( hFile, NULL, flProtect, 0, 0, NULL )) ) { im_error_system( GetLastError(), "im_mapfile", "%s", _( "unable to CreateFileMapping" ) ); + printf( "CreateFileMapping failed: %s\n", im_error_buffer() ); return( NULL ); } - dwFileOffsetHigh = (offset >> shift) & mask; - dwFileOffsetLow = offset & mask; - if( !(baseaddr = (char *)MapViewOfFile( hMMFile, dwDesiredAccess, dwFileOffsetHigh, dwFileOffsetLow, length )) ) { im_error_system( GetLastError(), "im_mapfile", "%s", _( "unable to MapViewOfFile" ) ); + printf( "MapViewOfFile failed: %s\n", im_error_buffer() ); CloseHandle( hMMFile ); return( NULL ); } @@ -184,6 +195,8 @@ im__mmap( int fd, int writeable, size_t length, gint64 offset ) } #endif /*OS_WIN32*/ + printf( "** success\n" ); + return( baseaddr ); } @@ -219,17 +232,17 @@ im_mapfile( IMAGE *im ) * an error. */ g_assert( im->file_length > 0 ); + if( im->file_length < 64 ) { + im_error( "im_mapfile", + "%s", _( "file is less than 64 bytes" ) ); + return( -1 ); + } if( fstat( im->fd, &st ) == -1 ) { im_error( "im_mapfile", "%s", _( "unable to get file status" ) ); return( -1 ); } m = (mode_t) st.st_mode; - if( im->file_length < 64 ) { - im_error( "im_mapfile", - "%s", _( "file is less than 64 bytes" ) ); - return( -1 ); - } if( !S_ISREG( m ) ) { im_error( "im_mapfile", "%s", _( "not a regular file" ) ); diff --git a/libvips/iofuncs/im_open_vips.c b/libvips/iofuncs/im_open_vips.c index b30a7239..3b0e4731 100644 --- a/libvips/iofuncs/im_open_vips.c +++ b/libvips/iofuncs/im_open_vips.c @@ -1203,8 +1203,7 @@ im_openin( IMAGE *image ) */ size = (gint64) IM_IMAGE_SIZEOF_LINE( image ) * image->Ysize + image->sizeof_header; - if( size < im__mmap_limit && - (gint64) image->file_length >= size ) { + if( size < im__mmap_limit && image->file_length >= size ) { if( im_mapfile( image ) ) return( -1 ); image->data = image->baseaddr + image->sizeof_header; diff --git a/libvips/iofuncs/window.c b/libvips/iofuncs/window.c index 3da2a90f..b2bfc556 100644 --- a/libvips/iofuncs/window.c +++ b/libvips/iofuncs/window.c @@ -225,13 +225,17 @@ im_window_set( im_window_t *window, int top, int height ) (gint64) IM_IMAGE_SIZEOF_LINE( window->im ) * top; length = (size_t) IM_IMAGE_SIZEOF_LINE( window->im ) * height; + printf( "start = 0x%lx\n", (guint64) start ); + pagestart = start - start % pagesize; end = start + length; pagelength = end - pagestart; + printf( "pagestart = 0x%lx\n", (guint64) pagestart ); + /* Make sure we have enough file. */ - if( end > (gint64) window->im->file_length ) { + if( end > window->im->file_length ) { im_error( "im_window_set", _( "unable to read data for \"%s\", %s" ), window->im->filename, _( "file has been truncated" ) ); diff --git a/po/README b/po/README index 3b44e594..55ccb085 100644 --- a/po/README +++ b/po/README @@ -28,7 +28,7 @@ cd vips-7.x.x ; find */* -name "*.h" >> po/POTFILES.in intltool-update --pot - make a new vips7.pot translation template from the sources + make a new vips-7.20.pot translation template from the sources :%s/msgstr ""/msgstr "Malkovich"/ :%s/msgstr\[0\] ""/msgstr[0] "Malkovich"/ diff --git a/po/en_GB.gmo b/po/en_GB.gmo index 22b74a9d..cbd2ce8a 100644 Binary files a/po/en_GB.gmo and b/po/en_GB.gmo differ diff --git a/po/en_GB.po b/po/en_GB.po index 4101feaa..2e03244e 100644 --- a/po/en_GB.po +++ b/po/en_GB.po @@ -1,11 +1,12 @@ -# test translation file +# en_GB translations for vips +# just swap color for colour # msgid "" msgstr "" -"Project-Id-Version: vips 7.16.0\n" +"Project-Id-Version: vips 7.20.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2009-11-23 21:24+0000\n" -"PO-Revision-Date: Fri Sep 5 10:27:43 BST 2008\n" +"POT-Creation-Date: 2009-11-26 16:43+0000\n" +"PO-Revision-Date: Thu Nov 26 12:08:20 GMT 2009\n" "Last-Translator: john \n" "Language-Team: \n" "MIME-Version: 1.0\n" @@ -416,7 +417,7 @@ msgid "display unknown" msgstr "" #: libvips/conversion/im_zoom.c:332 libvips/format/im_vips2tiff.c:1589 -#: libvips/format/im_file2vips.c:761 libvips/iofuncs/im_open_vips.c:1321 +#: libvips/format/im_file2vips.c:761 libvips/iofuncs/im_open_vips.c:1320 #: libvips/mosaicing/im_tbmerge.c:634 libvips/mosaicing/im_lrmerge.c:812 #: libvips/resample/im_shrink.c:318 libvips/resample/im_affine.c:442 msgid "unknown coding type" @@ -493,9 +494,8 @@ msgid "vectors not same length" msgstr "" #: libvips/conversion/im_black.c:87 libvips/conversion/im_gaussnoise.c:124 -#, fuzzy msgid "bad parameter" -msgstr "bad colourmap" +msgstr "" #: libvips/conversion/im_bandjoin.c:127 msgid "images not same size" @@ -709,9 +709,8 @@ msgid "im_setupout failed" msgstr "" #: libvips/deprecated/im_slice.c:151 libvips/deprecated/im_thresh.c:127 -#, fuzzy msgid "Unknown input format" -msgstr "unsupported colourspace %d" +msgstr "" #. Name #: libvips/deprecated/deprecated_dispatch.c:127 @@ -747,14 +746,12 @@ msgid "input must be uncoded" msgstr "" #: libvips/deprecated/im_printlines.c:85 -#, fuzzy msgid "unsuitable image type" -msgstr "unsupported colourspace %d" +msgstr "" #: libvips/deprecated/im_printlines.c:144 libvips/deprecated/im_debugim.c:133 -#, fuzzy msgid "unknown input format" -msgstr "unsupported colourspace %d" +msgstr "" #: libvips/deprecated/im_convsub.c:82 msgid "calloc failed (1)" @@ -1069,9 +1066,9 @@ msgid "file \"%s\" not a known format" msgstr "" #: libvips/format/format.c:320 -#, fuzzy, c-format +#, c-format msgid "\"%s\" is not a supported image format." -msgstr "unsupported colourspace %d" +msgstr "" #: libvips/format/im_analyze2vips.c:371 #, c-format @@ -1170,7 +1167,7 @@ msgstr "" msgid "unable to read header for \"%s\", %s" msgstr "" -#: libvips/format/im_file2vips.c:644 libvips/iofuncs/window.c:237 +#: libvips/format/im_file2vips.c:644 libvips/iofuncs/window.c:241 #: libvips/iofuncs/im_open_vips.c:965 libvips/iofuncs/im_open_vips.c:1160 msgid "file has been truncated" msgstr "" @@ -1346,9 +1343,8 @@ msgid "mask sizes power of 2 only" msgstr "" #: libvips/freq_filt/im_freq_mask.c:194 -#, fuzzy msgid "unimplemented mask type" -msgstr "unsupported colourspace %d" +msgstr "" #: libvips/freq_filt/fmaskcir.c:163 libvips/freq_filt/fmaskcir.c:308 #: libvips/freq_filt/fmaskcir.c:399 libvips/freq_filt/fmaskcir.c:481 @@ -1571,9 +1567,8 @@ msgid "not uncoded" msgstr "" #: libvips/histograms_lut/im_histspec.c:97 -#, fuzzy msgid "bad band format" -msgstr "bad colourmap" +msgstr "" #: libvips/histograms_lut/im_histspec.c:102 msgid "input histograms differ in number of bands" @@ -1681,7 +1676,7 @@ msgstr "" msgid "unable to output to a %s image" msgstr "" -#: libvips/iofuncs/window.c:236 libvips/iofuncs/im_open_vips.c:1159 +#: libvips/iofuncs/window.c:240 libvips/iofuncs/im_open_vips.c:1159 #, c-format msgid "unable to read data for \"%s\", %s" msgstr "" @@ -1974,7 +1969,7 @@ msgstr "" msgid "xml save error" msgstr "" -#: libvips/iofuncs/im_open_vips.c:1271 +#: libvips/iofuncs/im_open_vips.c:1270 msgid "open for read-write for native format images only" msgstr "" @@ -2152,54 +2147,54 @@ msgstr "" msgid "bad format" msgstr "bad colourmap" -#: libvips/iofuncs/im_mapfile.c:140 libvips/iofuncs/im_mapfile.c:297 +#: libvips/iofuncs/im_mapfile.c:152 libvips/iofuncs/im_mapfile.c:310 msgid "unable to CreateFileMapping" msgstr "" -#: libvips/iofuncs/im_mapfile.c:150 libvips/iofuncs/im_mapfile.c:309 +#: libvips/iofuncs/im_mapfile.c:160 libvips/iofuncs/im_mapfile.c:322 msgid "unable to MapViewOfFile" msgstr "" -#: libvips/iofuncs/im_mapfile.c:178 +#: libvips/iofuncs/im_mapfile.c:189 msgid "unable to mmap" msgstr "" -#: libvips/iofuncs/im_mapfile.c:179 +#: libvips/iofuncs/im_mapfile.c:190 #, c-format msgid "" "map failed (%s), running very low on system resources, expect a crash soon" msgstr "" -#: libvips/iofuncs/im_mapfile.c:196 libvips/iofuncs/im_mapfile.c:303 +#: libvips/iofuncs/im_mapfile.c:209 libvips/iofuncs/im_mapfile.c:316 msgid "unable to UnmapViewOfFile" msgstr "" -#: libvips/iofuncs/im_mapfile.c:202 +#: libvips/iofuncs/im_mapfile.c:215 msgid "unable to munmap file" msgstr "" -#: libvips/iofuncs/im_mapfile.c:224 libvips/iofuncs/im_mapfile.c:263 -msgid "unable to get file status" -msgstr "" - -#: libvips/iofuncs/im_mapfile.c:230 +#: libvips/iofuncs/im_mapfile.c:237 msgid "file is less than 64 bytes" msgstr "" -#: libvips/iofuncs/im_mapfile.c:235 +#: libvips/iofuncs/im_mapfile.c:242 libvips/iofuncs/im_mapfile.c:276 +msgid "unable to get file status" +msgstr "" + +#: libvips/iofuncs/im_mapfile.c:248 msgid "not a regular file" msgstr "" -#: libvips/iofuncs/im_mapfile.c:269 +#: libvips/iofuncs/im_mapfile.c:282 msgid "unable to read data" msgstr "" -#: libvips/iofuncs/im_mapfile.c:329 +#: libvips/iofuncs/im_mapfile.c:342 #, c-format msgid "unable to mmap: \"%s\" - %s" msgstr "" -#: libvips/iofuncs/im_mapfile.c:339 +#: libvips/iofuncs/im_mapfile.c:352 #, c-format msgid "unable to mmap \"%s\" to same address" msgstr "" @@ -2858,9 +2853,9 @@ msgstr "" #: tools/mosaicing/mergeup.c:269 tools/mosaicing/mergeup.c:279 #: tools/mosaicing/mergeup.c:288 tools/mosaicing/mergeup.c:309 #: tools/mosaicing/mergeup.c:319 tools/mosaicing/mergeup.c:328 -#, fuzzy, c-format +#, c-format msgid "bad file name format '%s'" -msgstr "bad colourmap" +msgstr "" #: tools/mosaicing/mergeup.c:380 msgid "allocation failure in mergeup"