Commit Graph

147 Commits

Author SHA1 Message Date
Kleis Auke Wolthuizen 0337c09700
Cleanup gettext handling (#2695)
Use GLib's i18n support instead of copying and pasting that
logic into its own header. This deprecates the vips/intl.h
header in favour of glib/gi18n.h.
2022-02-27 15:27:28 +00:00
Kleis Auke Wolthuizen d80185060d
Various improvements to the build systems (#2675)
* Meson: remove space before colon

Since key-value pairs in Python are usually delimited as
colon+space instead of space+colon+space.

* Meson: disable modules by default when building static libraries

Corresponds to autotools. See: #2323.

* Meson: make modules a feature option

Corresponds to autotools, where modules are built
automatically if enabled and supported.

* Meson: specify minimum required GLib version

* Meson: fix indentation

* Remove unused function checks

* Simplify GLib configure checks

* Meson: ensure modules doesn't include enumtypes sources

Since that would cause duplicate symbols.

(`soname_header` can also be safely removed here,
since that is already included in `libvips_headers_dep`)
2022-02-22 14:33:42 +00:00
John Cupitt 8c668303f8 improve the pixel rng
see https://github.com/libvips/libvips/issues/2642
2022-02-02 18:15:26 +00:00
John Cupitt cd80b5ae94 note win fd change in changelog 2021-12-06 13:58:46 +00:00
Lovell Fuller b28ee777ab
Windows: don't set create time for invalid/stream fd (#2571) 2021-12-06 13:52:02 +00:00
Kleis Auke Wolthuizen a5bdcd77e0
Include vips.h before checking for G_OS_WIN32 (#2502)
Since this definition originates from GLib, it is necessary to
include vips/vips.h prior to using it.
2021-10-29 11:05:21 +01:00
John Cupitt e815e8ad95
Move the filemode ifdefs to a private header (#2498)
The filemode ifdefs had grown to 30 lines of code duplicated in four
source files. Move to a single copy in a private header (not part of the
public API).
2021-10-27 11:37:51 +01:00
Kleis Auke Wolthuizen 5d6e9851ba
Ensure newly created file descriptors are non-inheritable (#2497)
* Cleanup unused defines

* win32: do not inherit open file handles in child processes

`O_NOINHERIT` and the `N` flag of `fopen` is available in all
supported Windows versions.

* unix: ensure any open file handles are closed on exec

`O_CLOEXEC` is available since Linux 2.6.23 and is ignored on
earlier versions. `e` flag of `fopen` is available since glibc 2.7.
2021-10-26 12:20:03 +01:00
Kleis Auke Wolthuizen 1562ba695a Ensure compatibility with Cygwin
G_PLATFORM_WIN32 is no longer defined for Cygwin.
2021-05-17 11:54:46 +02:00
John Cupitt 6d9308d93c fix a couple of compiler warnings 2021-05-08 19:51:01 +01:00
Kleis Auke Wolthuizen 3ed50e0427 Cleanup configure.ac and #ifdef's 2021-03-06 15:47:07 +01:00
John Cupitt df3b80fa40 add vipssave_target() 2021-01-02 15:49:32 +00:00
Kleis Auke Wolthuizen 77de1c473a Determine endianness at compile time 2020-11-23 14:39:06 +01:00
John Cupitt 58b6d73a70 deprecate vips_popen()
it didn't work well on win, and we no longer use it anyway
2020-07-27 15:21:59 +01:00
John Cupitt 5117c1a980 remove mode_t from headers
it seems to fail with MSVC.

int works fine, and is what g_open() uses.
2020-07-04 18:28:44 +01:00
Kleis Auke Wolthuizen 9246094033 Fix function pointer cast issues
It is undefined behavior in C and C++ to cast a function pointer
to another type and call it that way. This does work in most native
platforms, however, despite it being UB, but in WASM it can fail.

See:
https://emscripten.org/docs/porting/guidelines/function_pointer_issues.html
2020-06-30 13:35:41 +02:00
John Cupitt 383be359e8
Merge pull request #1626 from kleisauke/remove-varargs-open
Remove use of varargs in vips_*_open
2020-04-30 14:02:37 +01:00
Kleis Auke Wolthuizen cdf0269871 Ensure vips__temp_name creates unique filenames
There was a possible chance that vips__temp_name could generate the
same filename twice if it is called concurrently.

This commit ensures that the serial increment is an atomic operation,
similar to #1211.
2020-04-27 15:27:33 +02:00
Kleis Auke Wolthuizen 6fc2015783 Remove use of varargs in vips_*_open
This matches the declaration of g_open and helps tools (such as ASan) when
running on non-native platforms.
2020-04-27 11:56:32 +02:00
John Cupitt a592d99bb2 add dir detector
useful for blocking open for read of directories
2020-03-06 18:05:16 +00:00
John Cupitt d13c0a69fd Merge branch 'master' of github.com:libvips/libvips 2020-03-06 13:05:38 +00:00
John Cupitt 6117310c18 improve file open error handling
better behaviour if you try to open a directory as an image
2020-03-05 15:30:37 +00:00
John Cupitt 68f766b482 Merge branch '8.9' 2020-03-05 15:03:00 +00:00
John Cupitt b3a7929247 detect read errors in sniff correctly
we has a signed/unsigned mixup :(
2020-03-05 15:02:16 +00:00
John Cupitt 9ef8b55218 better handling of short files in vips7 compat
the sniffer could read beyond the end of the file sometimes
2020-03-04 17:38:41 +00:00
John Cupitt ce240b1ca2 revise matrixload for source API 2020-02-22 15:02:12 +00:00
John Cupitt f8c7f9dac9 interpret \ as an escape char in break_token
So:

	vips_break_token( "hello\ world", " " )

Sees a single token, `"hello world"`.

This means you can now do things like:

	$ vips arrayjoin "k\ 2.jpg" x.png

Where "k 2.jpg" is a filename containing a space.

See https://github.com/libvips/libvips/issues/1493
2020-01-26 13:59:04 +00:00
John Cupitt 9c6bfc7462 better error handling in vips__seek
Now that we are using the poxis API on win32, we don't need to check
GetLastError()
2019-12-28 12:54:44 +00:00
John Cupitt 32d3ba2a50 fix vips__ftruncate
We'd forgotton to update this for the new vips__seek return.

See https://github.com/libvips/libvips/issues/1494#issuecomment-569413267
2019-12-28 12:47:50 +00:00
John Cupitt 1a2a4a41f1 remove dbg code now travis is fixed 2019-11-27 22:20:33 +00:00
John Cupitt 9f6ea7b799 more dbg code to help travis 2019-11-27 20:09:04 +00:00
John Cupitt b003b36d7a Merge branch '8.8' 2019-11-27 15:30:33 +00:00
John Cupitt 0bc49a485e remove use of realpath
It won't work on linux systems with grsec.
2019-11-27 15:14:42 +00:00
John Cupitt 17b994419b move ppm save into the class
no separate save function now
2019-11-15 10:23:45 +00:00
John Cupitt c383614c28 more cleaning up 2019-11-06 21:34:42 +00:00
John Cupitt 40d679f299 fix lseek() wrapper error handling 2019-10-28 13:02:36 +00:00
John Cupitt ed6b26fcb1 paste in various fixes from Kleis 2019-10-28 08:51:47 +00:00
John Cupitt b7ad0da20c more reworking 2019-10-24 14:14:52 +01:00
John Cupitt 0e29e1c41e start reworking again 2019-10-24 10:57:52 +01:00
John Cupitt bdb5e39efa just the test suite now 2019-10-23 14:51:29 +01:00
John Cupitt f99f3d3f57 revise seek() behaviour
fuzz tests fail though ... we need to split StreamInput up
2019-10-17 17:18:45 +01:00
John Cupitt 9ea5e902b6 test descriptor properties 2019-10-14 12:02:59 +01:00
Lovell Fuller 02c42fdeba Silence a couple of GCC compiler warnings 2019-09-20 17:08:25 +01:00
John Cupitt 5855321638 improve realpath() compat on older libc
older libc didn't allow a NULL for the second param
2019-05-24 15:24:18 +01:00
John Cupitt 4af242b599 fix travis compiler warnings
- older libpng don't have consts decls for some set/get funcs
- use g_ascii_strcasecmp() on program text strings (instead of strcasecmp)
2019-02-20 12:49:59 +00:00
John Cupitt d48f80130b switch to g_open()/g_fopen()
Might help with files being left open, perhaps. It's certainly neater.

See https://github.com/kleisauke/net-vips/issues/12
2018-08-15 14:58:12 +01:00
John Cupitt e9aaedc60a fix some compiler warnings
from the msvc patch
2018-06-01 19:44:43 +01:00
Angel Sánchez 256cf494a3 use VIPS_PI instead of M_PI as the former is already defined, added missing includes with their macro protection 2018-05-31 13:50:50 +02:00
John Cupitt 6952c57ca0 better temp filename handling
- make access() fail only if we are certain the file does not exist
- remove the g_mkstemp() from vips__temp_name()

should help selinux

see https://github.com/jcupitt/libvips/pull/930
2018-04-26 16:14:12 +01:00
John Cupitt 5176b4a17e better header sniffing for small files
vips__get_bytes() used to fail if the file was too small for the
allocated buffer, which was a problem for svg, since files can be extremely
small.

This change makes vips__get_bytes() return the number of bytes read, so
the is_a testers can work on files smaller than the max header size.
2018-03-22 12:08:39 +00:00