"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "libvips/iofuncs/source.c" between
vips-8.10.6.tar.gz and vips-8.11.0.tar.gz

About: VIPS is a free image processing system (see also the GUI nip2).

source.c  (vips-8.10.6):source.c  (vips-8.11.0)
skipping to change at line 68 skipping to change at line 68
#include <stdlib.h> #include <stdlib.h>
#ifdef HAVE_UNISTD_H #ifdef HAVE_UNISTD_H
#include <unistd.h> #include <unistd.h>
#endif /*HAVE_UNISTD_H*/ #endif /*HAVE_UNISTD_H*/
#include <string.h> #include <string.h>
#include <errno.h> #include <errno.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <fcntl.h> #include <fcntl.h>
#include <unistd.h> #include <unistd.h>
#ifdef OS_WIN32
#include <io.h>
#endif /*OS_WIN32*/
#include <vips/vips.h> #include <vips/vips.h>
#include <vips/internal.h> #include <vips/internal.h>
#include <vips/debug.h> #include <vips/debug.h>
#ifdef G_OS_WIN32
#include <io.h>
#endif /*G_OS_WIN32*/
/* Try to make an O_BINARY ... sometimes need the leading '_'. /* Try to make an O_BINARY ... sometimes need the leading '_'.
*/ */
#ifdef BINARY_OPEN #if defined(G_PLATFORM_WIN32) || defined(G_WITH_CYGWIN)
#ifndef O_BINARY #ifndef O_BINARY
#ifdef _O_BINARY #ifdef _O_BINARY
#define O_BINARY _O_BINARY #define O_BINARY _O_BINARY
#endif /*_O_BINARY*/ #endif /*_O_BINARY*/
#endif /*!O_BINARY*/ #endif /*!O_BINARY*/
#endif /*BINARY_OPEN*/ #endif /*defined(G_PLATFORM_WIN32) || defined(G_WITH_CYGWIN)*/
/* If we have O_BINARY, add it to a mode flags set. /* If we have O_BINARY, add it to a mode flags set.
*/ */
#ifdef O_BINARY #ifdef O_BINARY
#define BINARYIZE(M) ((M) | O_BINARY) #define BINARYIZE(M) ((M) | O_BINARY)
#else /*!O_BINARY*/ #else /*!O_BINARY*/
#define BINARYIZE(M) (M) #define BINARYIZE(M) (M)
#endif /*O_BINARY*/ #endif /*O_BINARY*/
#define MODE_READ BINARYIZE (O_RDONLY) #define MODE_READ BINARYIZE (O_RDONLY)
skipping to change at line 310 skipping to change at line 311
/* unminimise will open the filename. /* unminimise will open the filename.
*/ */
if( vips_object_argument_isset( object, "filename" ) && if( vips_object_argument_isset( object, "filename" ) &&
vips_source_unminimise( source ) ) vips_source_unminimise( source ) )
return( -1 ); return( -1 );
if( vips_object_argument_isset( object, "descriptor" ) ) { if( vips_object_argument_isset( object, "descriptor" ) ) {
connection->descriptor = dup( connection->descriptor ); connection->descriptor = dup( connection->descriptor );
connection->close_descriptor = connection->descriptor; connection->close_descriptor = connection->descriptor;
#ifdef OS_WIN32 #ifdef G_OS_WIN32
/* Windows will create eg. stdin and stdout in text mode. /* Windows will create eg. stdin and stdout in text mode.
* We always read in binary mode. * We always read in binary mode.
*/ */
_setmode( connection->descriptor, _O_BINARY ); _setmode( connection->descriptor, _O_BINARY );
#endif /*OS_WIN32*/ #endif /*G_OS_WIN32*/
} }
if( vips_object_argument_isset( object, "blob" ) ) { if( vips_object_argument_isset( object, "blob" ) ) {
size_t length; size_t length;
if( !(source->data = vips_blob_get( source->blob, &length )) ) if( !(source->data = vips_blob_get( source->blob, &length )) )
return( -1 ); return( -1 );
source->length = VIPS_MIN( length, G_MAXSSIZE ); source->length = VIPS_MIN( length, G_MAXSSIZE );
} }
skipping to change at line 357 skipping to change at line 358
vips_source_seek_real( VipsSource *source, gint64 offset, int whence ) vips_source_seek_real( VipsSource *source, gint64 offset, int whence )
{ {
VipsConnection *connection = VIPS_CONNECTION( source ); VipsConnection *connection = VIPS_CONNECTION( source );
VIPS_DEBUG_MSG( "vips_source_seek_real:\n" ); VIPS_DEBUG_MSG( "vips_source_seek_real:\n" );
/* Like _read_real(), we must not set a vips_error. We need to use the /* Like _read_real(), we must not set a vips_error. We need to use the
* vips__seek() wrapper so we can seek long files on Windows. * vips__seek() wrapper so we can seek long files on Windows.
*/ */
if( connection->descriptor != -1 ) if( connection->descriptor != -1 )
return( vips__seek_no_error( connection->descriptor, offset, when return( vips__seek_no_error( connection->descriptor,
ce ) ); offset, whence ) );
return( -1 ); return( -1 );
} }
static void static void
vips_source_class_init( VipsSourceClass *class ) vips_source_class_init( VipsSourceClass *class )
{ {
GObjectClass *gobject_class = G_OBJECT_CLASS( class ); GObjectClass *gobject_class = G_OBJECT_CLASS( class );
VipsObjectClass *object_class = VIPS_OBJECT_CLASS( class ); VipsObjectClass *object_class = VIPS_OBJECT_CLASS( class );
skipping to change at line 566 skipping to change at line 568
/** /**
* vips_source_minimise: * vips_source_minimise:
* @source: source to operate on * @source: source to operate on
* *
* Minimise the source. As many resources as can be safely removed are * Minimise the source. As many resources as can be safely removed are
* removed. Use vips_source_unminimise() to restore the source if you wish to * removed. Use vips_source_unminimise() to restore the source if you wish to
* use it again. * use it again.
* *
* Loaders should call this in response to the minimise signal on their output * Loaders should call this in response to the minimise signal on their output
* image. * image.
*
* Returns: 0 on success, or -1 on error.
*/ */
void void
vips_source_minimise( VipsSource *source ) vips_source_minimise( VipsSource *source )
{ {
VipsConnection *connection = VIPS_CONNECTION( source ); VipsConnection *connection = VIPS_CONNECTION( source );
SANITY( source ); SANITY( source );
(void) vips_source_test_features( source ); (void) vips_source_test_features( source );
skipping to change at line 1161 skipping to change at line 1161
VIPS_DEBUG_MSG( " new_pos = %" G_GINT64_FORMAT "\n", new_pos ); VIPS_DEBUG_MSG( " new_pos = %" G_GINT64_FORMAT "\n", new_pos );
return( new_pos ); return( new_pos );
} }
/** /**
* vips_source_rewind: * vips_source_rewind:
* @source: source to operate on * @source: source to operate on
* *
* Rewind the source to the start. You can't do this after pixel decode phase * Rewind the source to the start.
* starts. *
* You can't always do this after the pixel decode phase starts -- for
* example, pipe-like sources can't be rewound.
* *
* Returns: 0 on success, or -1 on error. * Returns: 0 on success, or -1 on error.
*/ */
int int
vips_source_rewind( VipsSource *source ) vips_source_rewind( VipsSource *source )
{ {
VIPS_DEBUG_MSG( "vips_source_rewind:\n" ); VIPS_DEBUG_MSG( "vips_source_rewind:\n" );
SANITY( source ); SANITY( source );
if( vips_source_test_features( source ) || if( vips_source_test_features( source ) ||
vips_source_seek( source, 0, SEEK_SET ) != 0 ) vips_source_seek( source, 0, SEEK_SET ) != 0 )
return( -1 ); return( -1 );
/* Back into sniff + header decode state.
*/
source->decode = FALSE;
if( !source->sniff )
source->sniff = g_byte_array_new();
SANITY( source ); SANITY( source );
return( 0 ); return( 0 );
} }
/** /**
* vips_source_length: * vips_source_length:
* @source: source to operate on * @source: source to operate on
* *
* Return the length in bytes of the source. Unseekable sources, for * Return the length in bytes of the source. Unseekable sources, for
 End of changes. 10 change blocks. 
13 lines changed or deleted 20 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)