Merge pull request #988 from angelmixu/vs2017
Fixes for being able to build libvips in Visual Studio 2017 with an external project
This commit is contained in:
commit
364a5daafc
@ -47,7 +47,11 @@
|
|||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#if _MSC_VER
|
||||||
|
#include <cstdlib>
|
||||||
|
#else
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#endif
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
#include <vips/vips.h>
|
#include <vips/vips.h>
|
||||||
|
@ -267,7 +267,7 @@ vips_perlin_make_tables( void *client )
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
for( i = 0; i < 256; i++ ) {
|
for( i = 0; i < 256; i++ ) {
|
||||||
double angle = 2 * M_PI * i / 256.0;
|
double angle = 2 * VIPS_PI * i / 256.0;
|
||||||
|
|
||||||
vips_perlin_cos[i] = cos( angle );
|
vips_perlin_cos[i] = cos( angle );
|
||||||
vips_perlin_sin[i] = sin( angle );
|
vips_perlin_sin[i] = sin( angle );
|
||||||
|
@ -57,7 +57,9 @@
|
|||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#ifdef HAVE_UNISTD_H
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#endif
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include <vips/vips.h>
|
#include <vips/vips.h>
|
||||||
|
@ -1843,7 +1843,7 @@ rtiff_stripwise_generate( VipsRegion *or,
|
|||||||
|
|
||||||
/* Do any repacking to generate pixels in vips layout.
|
/* Do any repacking to generate pixels in vips layout.
|
||||||
*/
|
*/
|
||||||
p = rtiff->contig_buf +
|
p = (char*)(rtiff->contig_buf) +
|
||||||
(hit.top - strip.top) * scanline_size;
|
(hit.top - strip.top) * scanline_size;
|
||||||
q = VIPS_REGION_ADDR( or, 0, r->top + y );
|
q = VIPS_REGION_ADDR( or, 0, r->top + y );
|
||||||
for( z = 0; z < hit.height; z++ ) {
|
for( z = 0; z < hit.height; z++ ) {
|
||||||
|
@ -700,7 +700,7 @@ vips_png_read_buffer( png_structp pPng, png_bytep data, png_size_t length )
|
|||||||
if( read->read_pos + length > read->length )
|
if( read->read_pos + length > read->length )
|
||||||
png_error( pPng, "not enough data in buffer" );
|
png_error( pPng, "not enough data in buffer" );
|
||||||
|
|
||||||
memcpy( data, read->buffer + read->read_pos, length );
|
memcpy( data, (const char*)(read->buffer) + read->read_pos, length );
|
||||||
read->read_pos += length;
|
read->read_pos += length;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,7 +100,7 @@ void *vips_area_get_data( VipsArea *area,
|
|||||||
#ifdef VIPS_DEBUG
|
#ifdef VIPS_DEBUG
|
||||||
#define VIPS_ARRAY_ADDR( X, I ) \
|
#define VIPS_ARRAY_ADDR( X, I ) \
|
||||||
(((I) >= 0 && (I) < VIPS_AREA( X )->n) ? \
|
(((I) >= 0 && (I) < VIPS_AREA( X )->n) ? \
|
||||||
(VIPS_AREA( X )->data + VIPS_AREA( X )->sizeof_type * (I)) : \
|
((char*)(VIPS_AREA( X )->data) + VIPS_AREA( X )->sizeof_type * (I)) : \
|
||||||
(fprintf( stderr, \
|
(fprintf( stderr, \
|
||||||
"VIPS_ARRAY_ADDR: index out of bounds, " \
|
"VIPS_ARRAY_ADDR: index out of bounds, " \
|
||||||
"file \"%s\", line %d\n" \
|
"file \"%s\", line %d\n" \
|
||||||
@ -109,7 +109,7 @@ void *vips_area_get_data( VipsArea *area,
|
|||||||
(I), VIPS_AREA( X )->n ), NULL ))
|
(I), VIPS_AREA( X )->n ), NULL ))
|
||||||
#else /*!VIPS_DEBUG*/
|
#else /*!VIPS_DEBUG*/
|
||||||
#define VIPS_ARRAY_ADDR( X, I ) \
|
#define VIPS_ARRAY_ADDR( X, I ) \
|
||||||
(VIPS_AREA( X )->data + VIPS_AREA( X )->sizeof_type * (I))
|
((char*)(VIPS_AREA( X )->data) + VIPS_AREA( X )->sizeof_type * (I))
|
||||||
#endif /*VIPS_DEBUG*/
|
#endif /*VIPS_DEBUG*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -79,7 +79,7 @@ extern "C" {
|
|||||||
#define VIPS_ISINF( V ) isinf( V )
|
#define VIPS_ISINF( V ) isinf( V )
|
||||||
#define VIPS_FLOOR( V ) floor( V )
|
#define VIPS_FLOOR( V ) floor( V )
|
||||||
#define VIPS_CEIL( V ) ceil( V )
|
#define VIPS_CEIL( V ) ceil( V )
|
||||||
#define VIPS_RINT( R ) rint( V )
|
#define VIPS_RINT( V ) rint( V )
|
||||||
#define VIPS_ROUND( V ) round( V )
|
#define VIPS_ROUND( V ) round( V )
|
||||||
#define VIPS_FABS( V ) VIPS_ABS( V )
|
#define VIPS_FABS( V ) VIPS_ABS( V )
|
||||||
#define VIPS_FMAX( A, B ) VIPS_MAX( A, B )
|
#define VIPS_FMAX( A, B ) VIPS_MAX( A, B )
|
||||||
|
@ -102,6 +102,9 @@
|
|||||||
#ifdef HAVE_UNISTD_H
|
#ifdef HAVE_UNISTD_H
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif /*HAVE_UNISTD_H*/
|
#endif /*HAVE_UNISTD_H*/
|
||||||
|
#ifdef HAVE_IO_H
|
||||||
|
#include <io.h>
|
||||||
|
#endif /*HAVE_IO_H*/
|
||||||
|
|
||||||
#include <vips/vips.h>
|
#include <vips/vips.h>
|
||||||
#include <vips/internal.h>
|
#include <vips/internal.h>
|
||||||
|
@ -3269,7 +3269,7 @@ vips_image_wio_input( VipsImage *image )
|
|||||||
*/
|
*/
|
||||||
if( vips_mapfile( image ) )
|
if( vips_mapfile( image ) )
|
||||||
return( -1 );
|
return( -1 );
|
||||||
image->data = image->baseaddr + image->sizeof_header;
|
image->data = ((char*)image->baseaddr) + image->sizeof_header;
|
||||||
image->dtype = VIPS_IMAGE_MMAPIN;
|
image->dtype = VIPS_IMAGE_MMAPIN;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@ -87,6 +87,7 @@
|
|||||||
|
|
||||||
#ifdef OS_WIN32
|
#ifdef OS_WIN32
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
#include <io.h>
|
||||||
#endif /*OS_WIN32*/
|
#endif /*OS_WIN32*/
|
||||||
|
|
||||||
void *
|
void *
|
||||||
|
@ -59,7 +59,12 @@
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
#ifdef HAVE_UNISTD_H
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_IO_H
|
||||||
|
#include <io.h>
|
||||||
|
#endif /*HAVE_IO_H*/
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
@ -48,6 +48,9 @@
|
|||||||
#ifdef HAVE_UNISTD_H
|
#ifdef HAVE_UNISTD_H
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif /*HAVE_UNISTD_H*/
|
#endif /*HAVE_UNISTD_H*/
|
||||||
|
#ifdef HAVE_IO_H
|
||||||
|
#include <io.h>
|
||||||
|
#endif /*HAVE_IO_H*/
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
|
||||||
#ifdef OS_WIN32
|
#ifdef OS_WIN32
|
||||||
|
@ -165,7 +165,7 @@ im__make_blend_luts( void )
|
|||||||
return( -1 );
|
return( -1 );
|
||||||
|
|
||||||
for( x = 0; x < BLEND_SIZE; x++ ) {
|
for( x = 0; x < BLEND_SIZE; x++ ) {
|
||||||
double a = IM_PI * x / (BLEND_SIZE - 1.0);
|
double a = VIPS_PI * x / (BLEND_SIZE - 1.0);
|
||||||
|
|
||||||
im__coef1[x] = (cos( a ) + 1.0) / 2.0;
|
im__coef1[x] = (cos( a ) + 1.0) / 2.0;
|
||||||
im__coef2[x] = 1.0 - im__coef1[x];
|
im__coef2[x] = 1.0 - im__coef1[x];
|
||||||
|
@ -52,7 +52,7 @@ extern "C" {
|
|||||||
VIPS_NAMESPACE_START
|
VIPS_NAMESPACE_START
|
||||||
|
|
||||||
// Wrapper over im_col_display with ref counting
|
// Wrapper over im_col_display with ref counting
|
||||||
class VDisplay {
|
class VIPS_CC_API VDisplay {
|
||||||
struct refblock {
|
struct refblock {
|
||||||
im_col_display *disp; // im_col_display struct
|
im_col_display *disp; // im_col_display struct
|
||||||
im_col_tab_disp *luts; // luts built from this display
|
im_col_tab_disp *luts; // luts built from this display
|
||||||
|
@ -49,7 +49,7 @@
|
|||||||
VIPS_NAMESPACE_START
|
VIPS_NAMESPACE_START
|
||||||
|
|
||||||
// Error type
|
// Error type
|
||||||
class VError : public std::exception {
|
class VIPS_CC_API VError : public std::exception {
|
||||||
std::string _what;
|
std::string _what;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -76,7 +76,7 @@ inline std::ostream &operator<<( std::ostream &file, const VError &err )
|
|||||||
return( file );
|
return( file );
|
||||||
}
|
}
|
||||||
|
|
||||||
void verror( std::string str = "" );
|
void VIPS_CC_API verror( std::string str = "" );
|
||||||
|
|
||||||
VIPS_NAMESPACE_END
|
VIPS_NAMESPACE_END
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@ typedef int (*VCallback)( void *, void * );
|
|||||||
* and several other refblocks can have IMAGEs which depend upon this IMAGE
|
* and several other refblocks can have IMAGEs which depend upon this IMAGE
|
||||||
* for their result.
|
* for their result.
|
||||||
*/
|
*/
|
||||||
class VImage {
|
class VIPS_CC_API VImage {
|
||||||
/* We'd like this to be protected so that user subclasses can define
|
/* We'd like this to be protected so that user subclasses can define
|
||||||
* their own member wrappers. But sadly C++ doesn't work like that:
|
* their own member wrappers. But sadly C++ doesn't work like that:
|
||||||
* subclasses of VImage can only refer to protected members via
|
* subclasses of VImage can only refer to protected members via
|
||||||
@ -89,7 +89,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
#ifndef SWIG
|
#ifndef SWIG
|
||||||
// Count ref etc. in one of these. One for each open VIPS image.
|
// Count ref etc. in one of these. One for each open VIPS image.
|
||||||
struct refblock {
|
VIPS_CC_API struct refblock {
|
||||||
_VipsImage *im; // IMAGE pointer
|
_VipsImage *im; // IMAGE pointer
|
||||||
int close_on_delete; // Set if we must im_close()
|
int close_on_delete; // Set if we must im_close()
|
||||||
int nrefs; // Number of refs to us
|
int nrefs; // Number of refs to us
|
||||||
@ -100,7 +100,7 @@ public:
|
|||||||
virtual ~refblock();
|
virtual ~refblock();
|
||||||
|
|
||||||
// Add a ref - this (output image) depends upon IMAGE in
|
// Add a ref - this (output image) depends upon IMAGE in
|
||||||
void addref( refblock *in );
|
VIPS_CC_API void addref( refblock *in );
|
||||||
|
|
||||||
// Remove a ref
|
// Remove a ref
|
||||||
void removeref();
|
void removeref();
|
||||||
@ -420,7 +420,7 @@ public:
|
|||||||
* be part of the public API in case people subclass VImage and add their own
|
* be part of the public API in case people subclass VImage and add their own
|
||||||
* members.
|
* members.
|
||||||
*/
|
*/
|
||||||
class Vargv {
|
class VIPS_CC_API Vargv {
|
||||||
// Function we are args to
|
// Function we are args to
|
||||||
im__function *fn;
|
im__function *fn;
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ union MASKUNION {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Private wrapper over *MASK - user does not see this
|
// Private wrapper over *MASK - user does not see this
|
||||||
class VPMask {
|
class VIPS_CC_API VPMask {
|
||||||
friend class VMask;
|
friend class VMask;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -102,7 +102,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Specialise for INTMASK
|
// Specialise for INTMASK
|
||||||
class VPIMask : public VPMask {
|
class VIPS_CC_API VPIMask : public VPMask {
|
||||||
public:
|
public:
|
||||||
VPIMask( int xsize, int ysize );
|
VPIMask( int xsize, int ysize );
|
||||||
VPIMask( int xsize, int ysize, int scale, int offset,
|
VPIMask( int xsize, int ysize, int scale, int offset,
|
||||||
@ -129,7 +129,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Specialise for DOUBLEMASK
|
// Specialise for DOUBLEMASK
|
||||||
class VPDMask : public VPMask {
|
class VIPS_CC_API VPDMask : public VPMask {
|
||||||
public:
|
public:
|
||||||
VPDMask( int xsize, int ysize );
|
VPDMask( int xsize, int ysize );
|
||||||
VPDMask( int xsize, int ysize,
|
VPDMask( int xsize, int ysize,
|
||||||
@ -167,7 +167,7 @@ inline std::ostream &operator<<( std::ostream &file,
|
|||||||
#endif /*!SWIG*/
|
#endif /*!SWIG*/
|
||||||
|
|
||||||
// Wrapper over VP?Mask with ref counting
|
// Wrapper over VP?Mask with ref counting
|
||||||
class VMask {
|
class VIPS_CC_API VMask {
|
||||||
protected:
|
protected:
|
||||||
struct refblock {
|
struct refblock {
|
||||||
_private_detail::VPMask *pmask; // Mask: double or int
|
_private_detail::VPMask *pmask; // Mask: double or int
|
||||||
@ -221,11 +221,11 @@ inline std::ostream &operator<<( std::ostream &file, const VMask &msk )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Need to forward ref these
|
// Need to forward ref these
|
||||||
class VDMask;
|
class VIPS_CC_API VDMask;
|
||||||
class VImage;
|
class VIPS_CC_API VImage;
|
||||||
|
|
||||||
// Wrapper over _private_detail::VPIMask with ref counting
|
// Wrapper over _private_detail::VPIMask with ref counting
|
||||||
class VIMask : public VMask {
|
class VIPS_CC_API VIMask : public VMask {
|
||||||
public:
|
public:
|
||||||
VIMask( int xsize, int ysize )
|
VIMask( int xsize, int ysize )
|
||||||
{
|
{
|
||||||
@ -314,7 +314,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Wrapper over _private_detail::VPDMask with ref counting
|
// Wrapper over _private_detail::VPDMask with ref counting
|
||||||
class VDMask : public VMask {
|
class VIPS_CC_API VDMask : public VMask {
|
||||||
public:
|
public:
|
||||||
VDMask( int xsize, int ysize )
|
VDMask( int xsize, int ysize )
|
||||||
{
|
{
|
||||||
|
@ -35,6 +35,18 @@
|
|||||||
// VImage.h uses GValue for metadata
|
// VImage.h uses GValue for metadata
|
||||||
#include <glib-object.h>
|
#include <glib-object.h>
|
||||||
|
|
||||||
|
/* Define VIPS_CC_EXPORTS to build a DLL using MSVC.
|
||||||
|
*/
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
# ifdef VIPS_CC_EXPORTS
|
||||||
|
# define VIPS_CC_API __declspec(dllexport)
|
||||||
|
# else
|
||||||
|
# define VIPS_CC_API __declspec(dllimport)
|
||||||
|
# endif
|
||||||
|
#else
|
||||||
|
# define VIPS_CC_API
|
||||||
|
#endif
|
||||||
|
|
||||||
// If we have already #included the C vips headers, we have to undef a load of
|
// If we have already #included the C vips headers, we have to undef a load of
|
||||||
// stuff to stop vips's stupid macros messing up our enums
|
// stuff to stop vips's stupid macros messing up our enums
|
||||||
#ifdef IM_VIPS_H
|
#ifdef IM_VIPS_H
|
||||||
|
Loading…
Reference in New Issue
Block a user