1From 366930ccc1a261c3eb883da2bf3c655162ccd75f Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Wed, 1 Mar 2023 22:58:37 -0800
4Subject: [PATCH] Match prototypes of callbacks with libgphoto
5
6In https://github.com/gphoto/gphoto2/pull/535/commits/ccc4c1f092bd21ebc713f4d7b9be85be49f92f1e
7we tried to fix by using pthread_t but it also needs to make changes in
8libgphoto and these changes can be invasive, therefore lets revert to
9older types and to fix musl problem fix it via type casts
10
11Upstream-Status: Submitted [https://github.com/gphoto/gphoto2/pull/569]
12Signed-off-by: Khem Raj <raj.khem@gmail.com>
13---
14 gphoto2/main.c | 8 ++++----
15 1 file changed, 4 insertions(+), 4 deletions(-)
16
17diff --git a/gphoto2/main.c b/gphoto2/main.c
18index 0dac947..cd3c990 100644
19--- a/gphoto2/main.c
20+++ b/gphoto2/main.c
21@@ -1198,7 +1198,7 @@ thread_func (void *data)
22 	pthread_cleanup_pop (1);
23 }
24
25-static pthread_t
26+static unsigned int
27 start_timeout_func (Camera *camera, unsigned int timeout,
28 		    CameraTimeoutFunc func, void __unused__ *data)
29 {
30@@ -1215,14 +1215,14 @@ start_timeout_func (Camera *camera, unsigned int timeout,
31
32 	pthread_create (&tid, NULL, thread_func, td);
33
34-	return (tid);
35+	return (unsigned int)tid;
36 }
37
38 static void
39-stop_timeout_func (Camera __unused__ *camera, pthread_t id,
40+stop_timeout_func (Camera __unused__ *camera, unsigned int id,
41 		   void __unused__ *data)
42 {
43-	pthread_t tid = id;
44+	pthread_t tid = (pthread_t)id;
45
46 	pthread_cancel (tid);
47 	pthread_join (tid, NULL);
48--
492.39.2
50
51