better win32 compatibility
try to fold the patches @tumagonx maintains into libvips master, see: https://github.com/tumagonx/pygi-mingw-patches/blob/master/vips-8.4.x.patch still missing the bindtextdomain() patch though
This commit is contained in:
parent
636c6ede81
commit
ba129fceb3
@ -237,7 +237,8 @@ if test x"$vips_os_darwin" = x"yes"; then
|
||||
profile_dir="/Library/ColorSync/Profiles"
|
||||
elif test x"$vips_os_win32" = x"yes"; then
|
||||
# need double escapes since this will get pasted into a #define in a C
|
||||
# header
|
||||
# header ... the C:\Windows is usually overrwritten with the result of
|
||||
# GetWindowsDirectoryW()
|
||||
profile_dir="C:\\\\Windows\\\\System32\\\\spool\\\\drivers\\\\color"
|
||||
else
|
||||
profile_dir="/usr/share/color/icc"
|
||||
|
@ -109,7 +109,7 @@ INTROSPECTION_GIRS += Vips-8.0.gir
|
||||
# --warn-all --verbose
|
||||
# too annoying
|
||||
Vips_8_0_gir_SCANNERFLAGS = \
|
||||
--program=./introspect \
|
||||
--program=./introspect$(EXEEXT) \
|
||||
--identifier-prefix=Vips \
|
||||
--identifier-prefix=vips \
|
||||
--symbol-prefix=vips
|
||||
|
@ -261,7 +261,7 @@ vips_colour_attach_profile( VipsImage *im, const char *filename )
|
||||
char *data;
|
||||
size_t data_length;
|
||||
|
||||
if( !(data = vips__file_read_name( filename, VIPS_ICC_DIR,
|
||||
if( !(data = vips__file_read_name( filename, vips__icc_dir(),
|
||||
&data_length )) )
|
||||
return( -1 );
|
||||
vips_image_set_blob( im, VIPS_META_ICC_NAME,
|
||||
|
@ -357,7 +357,7 @@ static int
|
||||
write_profile_file( Write *write, const char *profile )
|
||||
{
|
||||
if( !(write->profile_bytes =
|
||||
vips__file_read_name( profile, VIPS_ICC_DIR,
|
||||
vips__file_read_name( profile, vips__icc_dir(),
|
||||
&write->profile_length )) )
|
||||
return( -1 );
|
||||
write_profile_data( &write->cinfo,
|
||||
|
@ -325,7 +325,8 @@ embed_profile_file( TIFF *tif, const char *profile )
|
||||
char *buffer;
|
||||
size_t length;
|
||||
|
||||
if( !(buffer = vips__file_read_name( profile, VIPS_ICC_DIR, &length )) )
|
||||
if( !(buffer = vips__file_read_name( profile,
|
||||
vips__icc_dir(), &length )) )
|
||||
return( -1 );
|
||||
TIFFSetField( tif, TIFFTAG_ICCPROFILE, length, buffer );
|
||||
vips_free( buffer );
|
||||
|
@ -954,7 +954,7 @@ write_vips( Write *write,
|
||||
size_t length;
|
||||
|
||||
if( !(data = vips__file_read_name( profile,
|
||||
VIPS_ICC_DIR, &length )) )
|
||||
vips__icc_dir(), &length )) )
|
||||
return( -1 );
|
||||
|
||||
#ifdef DEBUG
|
||||
|
@ -331,6 +331,8 @@ char *vips_realpath( const char *path );
|
||||
guint32 vips__random( guint32 seed );
|
||||
guint32 vips__random_add( guint32 seed, int value );
|
||||
|
||||
const char *vips__icc_dir( void );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /*__cplusplus*/
|
||||
|
@ -1929,3 +1929,43 @@ vips__random_add( guint32 seed, int value )
|
||||
|
||||
return( vips__random( seed ) );
|
||||
}
|
||||
|
||||
static void *
|
||||
vips_icc_dir_once( void *null )
|
||||
{
|
||||
#ifdef OS_WIN32
|
||||
/* From glib get_windows_directory_root()
|
||||
*/
|
||||
wchar_t wwindowsdir[MAX_PATH];
|
||||
|
||||
if( GetWindowsDirectoryW( wwindowsdir, G_N_ELEMENTS( wwindowsdir ) ) ) {
|
||||
/* Usually X:\Windows, but in terminal server environments
|
||||
* might be an UNC path, AFAIK.
|
||||
*/
|
||||
char *windowsdir;
|
||||
|
||||
if( (windowsdir = g_utf16_to_utf8( wwindowsdir,
|
||||
-1, NULL, NULL, NULL)) ) {
|
||||
gchar *full_path;
|
||||
|
||||
full_path = g_build_filename( windowsdir,
|
||||
"system32", "spool", "drivers", "color", NULL );
|
||||
g_free( windowsdir );
|
||||
|
||||
return( (void *) full_path );
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return( (void *) VIPS_ICC_DIR );
|
||||
}
|
||||
|
||||
const char *
|
||||
vips__icc_dir( void )
|
||||
{
|
||||
static GOnce once = G_ONCE_INIT;
|
||||
|
||||
return( (const char *) g_once( &once,
|
||||
(GThreadFunc) vips_icc_dir_once, NULL ) );
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user