Commit Graph

238 Commits

Author SHA1 Message Date
John Cupitt cbfbeb6e2d don't parse floats with scanf
since scanf uses the current locale, duh

see https://github.com/libvips/libvips/issues/3191
2022-11-28 08:51:13 +00:00
John Cupitt f8003bda67
Add tiffsave target (#2798)
* compiles, but untested

* works, but libtiff needs seek for write

next: add seek methods to target

* add target seek and read

seem to work

next: disc temps for disc output

* add libnsgif COPYING

oops, we were missing the COPYING file

see https://github.com/libvips/libvips/issues/2800

thanks mika-fischer

* tiffsave uses a disc temp if it can

* revise temp target rules

only make a disc temp if we are writing to a filesystem target

* add new target methods to targetcustom
2022-05-20 18:38:17 +01:00
John Cupitt 9d841e848f more init check to libvips base class
helps introspection run correctly if there's no vips_init()
2022-02-27 18:48:37 +00:00
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
Corentin Noël 69bf2be12b
Enhance the introspection support by fixing annotations (#2657)
Also refine the .metadata file
2022-02-15 10:54:40 +00:00
John Cupitt 362adae8c6
Revert "Enhance the introspection support by fixing annotations (#2655)" (#2656)
This reverts commit 47796dcda0.
2022-02-15 10:08:07 +00:00
Corentin Noël 47796dcda0
Enhance the introspection support by fixing annotations (#2655)
* Ensure that double asterisk characters are only used for gtk-doc comments

This triggers warnings when parsing the files with the introspection scanner
and gtk-doc

* Enhance the introspection support by fixing annotations

Also refine the .metadata file

Co-authored-by: John Cupitt <jcupitt@gmail.com>
2022-02-15 09:54:32 +00:00
John Cupitt 1f4f975e7d make leak test exit with an error code
and run the libvips leak test in CI
2021-02-08 11:25:56 +00:00
John Cupitt 8d95f9db2b tiny fixes 2021-02-05 16:56:44 +00:00
John Cupitt 2585565b3e better test for output to target
We used to enable write to stdout if the first character of an output filename
was ".", eg.:

	vips copy x.jpg .png

But this will also enable write to stdout for things like:

	vips copy x.jpg ./y.png

This patch also tests that the rightmost "." in a filename is also the
first character.

Thanks barryspearce

See https://github.com/libvips/libvips/issues/1906
2020-11-29 13:59:30 +00: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 4c5873809f experiment with renaming stream
rename as VipsConnection, VipsSource, VipsTarget etc.

see https://github.com/libvips/libvips/issues/1494#issuecomment-569498619

renamed with this script:

```

set -e

edit() {
        sed -i -E "$1" rename
}

for i in $*; do
        cp $i rename

        edit s/VIPS_STREAMOU/VIPS_TARGET_CUSTOM/g
        edit s/VIPS_STREAMO/VIPS_TARGET/g
        edit s/VIPS_STREAMIU/VIPS_SOURCE_CUSTOM/g
        edit s/VIPS_STREAMI/VIPS_SOURCE/g
        edit s/VIPS_STREAM/VIPS_CONNECTION/g

        edit s/vips_streamou/vips_target_custom/g
        edit s/vips_streamo/vips_target/g
        edit s/vips_streamiu/vips_source_custom/g
        edit s/vips_streami/vips_source/g
        edit s/vips_stream/vips_connection/g

        edit s/VipsStreamou/VipsTargetCustom/g
        edit s/VipsStreamo/VipsTarget/g
        edit s/VipsStreamiu/VipsSourceCustom/g
        edit s/VipsStreami/VipsSource/g
        edit s/VipsStream/VipsConnection/g

        # eg. VIPS_TYPE_STREAM or VIPS_IS_STREAM
        edit "s/VIPS_([A-Z]+)_STREAMOU/VIPS_\1_TARGET_CUSTOM/g"
        edit "s/VIPS_([A-Z]+)_STREAMO/VIPS_\1_TARGET/g"
        edit "s/VIPS_([A-Z]+)_STREAMIU/VIPS_\1_SOURCE_CUSTOM/g"
        edit "s/VIPS_([A-Z]+)_STREAMI/VIPS_\1_SOURCE/g"
        edit "s/VIPS_([A-Z]+)_STREAM/VIPS_\1_CONNECTION/g"

        edit s/streamou/target_custom/g
        edit s/streamo/target/g
        edit s/streamiu/source_custom/g
        edit s/streami/source/g

        # various identifiers which also change
        edit s/is_a_stream/is_a_source/g
        edit s/find_load_stream/find_load_source/g
        edit s/find_save_stream/find_save_target/g
        edit s/new_from_stream/new_from_source/g
        edit s/write_to_stream/write_to_target/g
        edit s/vips_thumbnail_stream/vips_thumbnail_source/g

        # eg. vips_webpload_stream
        edit "s/vips_([a-z]+)load_stream/vips_\1load_source/g"

        # eg. vips_webpsave_stream
        edit "s/vips_([a-z]+)save_stream/vips_\1save_target/g"

        mv rename $i
done
```
2019-12-29 21:40:21 +00:00
John Cupitt ae7aaea077 doc polish 2019-12-01 15:29:28 +00:00
John Cupitt f5a4f41edf rename VipsStream* variables
The convention is now:

	VipStreami *streami;

We had `input` in many places, a left-over from the old VipStreamInput
name.
2019-11-11 09:09:34 +00:00
John Cupitt 53f73881f7 rename streamo constructors
Was vips_streamo_new_from_filename(), renamed as
vips_streamo_new_to_filename(). Same for descriptor and memory.
2019-11-07 16:20:12 +00:00
John Cupitt 60ce52512c builds
now needs testing
2019-10-22 17:37:05 +01:00
John Cupitt 5f6911d516 add thumbnail_stream
this works:

	$ cat k2.jpg | vips thumbnail_stream [descriptor=0] x.jpg 200
	$ vipsheader x.jpg
	temp-0: 141x200 uchar, 3 bands, srgb, jpegload
2019-10-12 17:37:31 +01:00
John Cupitt 4d3f66fe33 add stdout write
this now works:

	$ vips invert k2.jpg .jpg | vips invert stdin x.jpg

"stdin" means read from stdin, ".jpg" means write to stdout in JPG
format
2019-10-12 14:12:01 +01:00
John Cupitt 442720a0a1 add magic "-" stdin filename
this almost works!

$ vips invert - x.jpg < k2.jpg
2019-10-11 05:38:58 +01:00
John Cupitt 27195cc92c add vips_foreign_get_suffixes()
Add vips_foreign_get_suffixes(), get an array of all the filename suffixes that
libvips recognises.

See https://github.com/libvips/ruby-vips/issues/186
2019-02-23 13:50:10 +00: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 aaf26765f2 warn about default TRUE bool args
to stop anyone making one again, hopefully
2018-10-31 12:45:17 +00:00
John Cupitt fec2f5f869 make vips_object_get_args() return an int
since malloc can fail
2018-08-20 08:45:46 +01:00
Kleis Auke Wolthuizen b5b756b817 Add vips_object_get_args
Handy for language bindings.
2018-08-19 22:42:26 +02:00
John Cupitt d251b37d92 add vips_argument_get_id()
We had a global we incremented to allocate property ids, but of course that
won't work with DLLs. Instead, add vips_argument_get_id() and call that to
allocate new prop ids.

See:

https://github.com/jcupitt/libvips/issues/985
2018-05-29 16:49:20 +01:00
John Cupitt c5139a0e50 doc fixups
various small things; fix the docs for composite, reduceh and reducev
2017-12-04 13:42:31 +00:00
John Cupitt f9f717a843 add VIPS_ONCE and use it everywhere
Lovell's idea: save the function call in the most common case
2017-11-23 08:43:08 +00:00
John Cupitt a16de7e667 get the python binding working again
remove three (method) annotations that seem to shift some object methods
about

see https://github.com/jcupitt/libvips/issues/741
2017-10-06 16:32:22 +01:00
Alistair Thomas 7452d046ca Update GObject introspection annotations for libvips/iofuncs directory 2017-09-30 13:31:00 +01:00
John Cupitt 34970d0cf2 remove some casts
and use VIPS_AREA instead
2017-07-26 14:57:27 +01:00
John Cupitt 73c370e7e9 small fixes to make helgrind pass
nothing significant, but watermark.c now passes helgrind cleanly
2017-03-27 09:59:04 +01:00
John Cupitt 507212e3d8 Merge branch 'master' into remove-seq-stalling 2017-03-08 09:30:48 +00:00
John Cupitt 205fb817e8 change three C API funcs to match Python/C++/CLI
vips_math2_const(), vips_boolean_const() and vips_relational_const() had
the const and oper args reversed from the Python/CLI/C++ API

add something to check for arg priority conflicts and resolve the
conflicts it found
2017-03-07 14:28:31 +00:00
John Cupitt 362c7efdfc argh reapply seq removal 2017-03-06 11:55:38 +00:00
John Cupitt e6b20cbd0f Revert "remove stalling"
This reverts commit 959f412380.
2017-02-27 10:26:32 +00:00
John Cupitt e7ae10ef68 Revert "more UNBUF fixes"
This reverts commit a4d3c2a754.
2017-02-27 10:25:41 +00:00
John Cupitt a4d3c2a754 more UNBUF fixes
try to keep compat better, remove the single-thread-first-tile idea
2017-02-21 16:53:48 +00:00
John Cupitt 959f412380 remove stalling 2017-02-21 15:03:15 +00:00
John Cupitt b814baa78c fix various small doc problems 2016-07-13 17:07:26 +01:00
John Cupitt db11d3b973 allow nested [] in CLI args
this now works:

	vips copy x y.dz[suffix=.jpg[Q=90]]
2016-05-16 11:09:47 +01:00
John Cupitt ee1874c5ca much better handling of arrayimage cli args
we were not setting the access hint on arrayimage args, so

arrayjoin "$(echo *.jpg)" x.tif[bigtiff] --across 10

would open all the jpg images to memory, usually, in random mode

now arrayimage args see the operation's access hint (seq in this case),
for much better behaviour

also, we allow any whitespace as an arg separator in arrayimage from
string
2016-02-27 20:37:20 +00:00
John Cupitt 07a1903390 use g_assert_not_reached()
we were using g_assert(0) ... g_assert_not_reached() makes the
intention clearer
2016-01-24 13:21:53 +00:00
John Cupitt d73d7e6e18 type 2015-10-27 12:08:43 +00:00
John Cupitt 64d081e726 return default value for unset props
we used to issue a warning and return early, but this can leave garbage
in the *value pointer, I think

ruby gobject-introspection will walk object props during GC and can see
state inbetween init and build when not all objects have been given a
value ... we don't want these warnings
2015-10-16 14:50:44 +01:00
John Cupitt e62df8c573 fix more cppcheck warnings
cppcheck now passes, with a few false positives

see https://github.com/jcupitt/libvips/issues/331
2015-09-29 09:23:01 +01:00
John Cupitt 01025328da fix some cppcheck warnings
try:

$ cppcheck -f --enable=warning,performance,portability -j4 . 2> err.txt

there are still some left, see:

see https://github.com/jcupitt/libvips/issues/331
2015-09-28 22:01:15 +01:00
John Cupitt bfeeb3eb27 better leak reporting
Vips::print_all now shows VipsArea leaks as well
2015-05-01 16:42:23 +01:00
John Cupitt a00db6c8f1 doc cleanups 2015-04-24 12:49:50 +01:00
John Cupitt e9707bcafd better cache trace 2015-04-14 13:18:37 +01:00
John Cupitt 46c655caf0 add gtk-doc comment for vips_type_find() 2015-02-12 11:33:26 +00:00