Commit Graph

102 Commits

Author SHA1 Message Date
Hans Ulrich Niedermann
6b595a34ad Define main function as "int main(void)" (with void) 2022-11-11 09:55:40 +01:00
Ingvar Stepanyan
51d5d4a083 Fix GP_UNKNOWN_EVENT leaks in examples (#833)
Most of the examples give wrong impression that `GP_UNKNOWN_EVENT` data does not need to be freed / is not heap allocated, however it's not the case - those messages are always `malloc`'d by corresponding drivers.
2022-09-21 09:28:25 +02:00
Hans Ulrich Niedermann
919671c89b CI: build automake based example project
Add automake based example project using libgphoto2 to have
the CI builds ensure that building a libgphoto2 frontend
with this libgphoto2 is possible.
2022-01-23 15:41:05 +01:00
Marcus Meissner
e43230ef45 avoid crash on freed memory 2021-11-28 15:28:37 +01:00
Hans Ulrich Niedermann
06714b364e examples: Force #include beginning with "libgphoto2/" 2021-10-25 03:34:16 +02:00
Hans Ulrich Niedermann
3730b4cf9b example: include <unistd.h> for close(2), unlink(2), getpid(2) 2021-10-25 00:13:03 +02:00
Hans Ulrich Niedermann
0dbeaf7cbf Use consistently named non-reserved CPP macros for header files
C preprocessor macros beginning/ending with underscores are
reserved for system use as well as macros containing a double
underscore anywhere, so application software macros are
supposed to be named differently.

For a header file gphoto2-abilities-list.h, this
consistently uses a macro name
LIBGPHOTO2_GPHOTO2_ABILITIES_LIST_H
for the usual

    #ifndef LIBGPHOTO2_GPHOTO2_ABILITIES_LIST_H
    #define LIBGPHOTO2_GPHOTO2_ABILITIES_LIST_H
    ... content of the header file ...
    #endif /* !defined(LIBGPHOTO2_GPHOTO2_ABILITIES_LIST_H) */

Found using "clang -Weverything".

This should work, unless when run with an ancient C preprocessor
which might only the first 8 or 10 characters to distinguish
macro names and ignores the remainder of the name.
2021-10-05 16:07:20 +02:00
Marcus Meissner
ab33b92159 report file info 2021-10-03 14:54:05 +02:00
Marcus Meissner
dc8cbddac4 report only if flag set 2021-10-02 13:26:40 +02:00
Marcus Meissner
409dfcedf4 report file info for debugging 2021-10-02 13:23:36 +02:00
Marcus Meissner
6a8a41e7a5 better comments 2021-10-02 12:02:18 +02:00
Hans Ulrich Niedermann
0f5195cc89 use the proper word
libraries are also binaries. What this comment talks about is
executables (the stuff with main() functions).
2021-09-30 18:06:29 +02:00
Marcus Meissner
cf20840d73 added comment how to build fuzzer, and current problems 2021-09-28 11:09:14 +02:00
Marcus Meissner
e9548fd45e added sample-libfuzz ... semi-uable for libfuzzer 2021-09-27 13:48:44 +02:00
Marcus Meissner
c0d4de1eca start a sample for libfuzz 2021-09-26 14:03:32 +02:00
Marcus Meissner
402a43d9af remove memory leaks 2021-08-10 16:28:04 +02:00
Rafał Hirsz
fde666be12 Add _DARWIN_C_SOURCE to most files that use string.h (#615)
This change makes it possible to build libgphoto2 on macOS.
2021-01-29 07:54:08 +01:00
Siim Meerits
4d161b4647 Fix examples compilation warnings.
* best-iso.c: Remove or comment out unused variables.
* sample-afl.c: Remove or comment out unused variables.
* sample-capture.c: Fix signed-unsigned compare issue.
* sample-trigger-capture.c: Fix signed-unsigned compare issue.
2020-08-03 08:50:12 +02:00
Siim Meerits
456a1d598b Remove trailing whitespace from all *.h and *.c files. 2020-07-27 17:37:00 +03:00
Marcus Meissner
55b7b003c6 Revert "also test for usbscsi, usbdiskdirect and serial"
This reverts commit dcb34f94e5.

(fixes travis)
2020-05-26 08:16:18 +02:00
Sijawusz Pur Rahnama
fd0be84db5 Fix typos throughout the codebase 2020-05-25 17:55:09 +02:00
Marcus Meissner
dcb34f94e5 also test for usbscsi, usbdiskdirect and serial 2020-03-29 16:12:38 +02:00
Hans Ulrich Niedermann
fb75d3632d examples: Remove unused TESTS= instance
Any TESTS definition causes "make check" to run a test suite,
even if no tests are actually defined.

So we remove the empty TESTS= from examples/Makefile.am, and
keep on using the TESTS in the tests/Makefile.am file.
2020-02-18 18:56:09 +01:00
Marcus Meissner
8cfca5b2dd fix gp_file reference count usage, its a bit weird 2020-01-25 18:14:16 +01:00
Marcus Meissner
560e15d3f4 let the sample-afl do autodetection to allow fuzzing all USB cameras 2019-04-23 11:48:13 +02:00
Marcus Meissner
88df661051 added unistd.h include for older systems 2019-03-09 14:12:25 +01:00
Marcus Meissner
9ae48976c5 disable capture fuzzing 2019-01-20 17:34:53 +01:00
Marcus Meissner
2799307539 try more calls 2019-01-20 17:13:03 +01:00
Marcus Meissner
79e7fdb455 unref the context in afl sample 2018-12-21 10:30:15 +01:00
Marcus Meissner
663401e3c4 c++ protect 2018-10-14 09:21:13 +02:00
Marcus Meissner
76bfee1646 free various event data
added GP_EVENT_FILE_CHANGED
2018-04-16 19:25:28 +02:00
Marcus Meissner
2ea49c29fa also log the domain 2017-07-31 08:11:28 +02:00
Marcus Meissner
9c4aef574b various fixes to free parameters and coverity issues 2017-06-05 19:13:32 +02:00
Marcus Meissner
3ad0c48f38 recursively list directories until the first file is found,
retrieve information and MTP metadata
2017-04-29 13:07:24 +02:00
Marcus Meissner
e366d6a1f0 list folders and files too 2017-04-29 10:16:15 +02:00
Marcus Meissner
f98954b981 add event handling to afl 2016-12-23 18:46:10 +01:00
Marcus Meissner
3afe07dbfd wait_for_Event needs to be run multiple times to drain
the event queue better. otherwise e.g. Nikon DSLR will
never get to the fileadded event.
2016-12-20 08:43:11 +01:00
Marcus Meissner
eae8a13ac2 adjusted code to handled errors and use buffer and file better
fixes https://github.com/gphoto/libgphoto2/issues/118
2016-12-20 07:10:52 +01:00
Marcus Meissner
14041e1af9 trigger capture: do not use file_read, api does not handle sdram capture currently ... :/ 2016-12-18 21:25:55 +01:00
peterbud
7f00f3ba22 do not use the signals in win32 2016-11-20 00:02:48 +01:00
Marcus Meissner
29a061ce26 move gp_file_free up 2016-11-19 23:51:59 +01:00
peterbud
230e2554f8 add O_BINARY flag for open() calls to write images in binary mode on Windows 2016-11-19 23:47:21 +01:00
Marcus Meissner
0ff0f34c7a check for open return 2016-11-19 21:23:02 +01:00
Marcus Meissner
fe935d45f2 fixed reading configuration
better progress output
2016-10-11 09:20:22 +02:00
Marcus Meissner
4cb1c943f3 handle raw captures too 2016-10-11 08:54:10 +02:00
Marcus Meissner
dbcc6fea14 clear read_cofnig after reading 2016-10-11 08:44:24 +02:00
Marcus Meissner
d388199946 added configuration reading to photobooth sample 2016-10-11 08:36:18 +02:00
Marcus Meissner
45fe362730 add event polling / tethering to sample photobooth 2016-10-11 08:29:11 +02:00
Marcus Meissner
b4c961bf13 start a photobooth sample program 2016-10-10 09:43:07 +02:00
Marcus Meissner
4950324701 simplified using sample_open_camera 2016-09-25 17:52:08 +02:00