mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2025-07-13 19:29:53 +03:00
92 lines
2.9 KiB
Diff
92 lines
2.9 KiB
Diff
Fix -Wint-conversion, -Wreturn-mismatch and -Wincompatible-pointer-type errors
|
|
with gcc 14.
|
|
|
|
Example errors:
|
|
|
|
```
|
|
../device.c: In function 'mp_device_get_num_interfaces':
|
|
/usr/include/glib-2.0/glib/gmessages.h:671:16: error: returning 'void *' from a
|
|
function with return type 'size_t' {aka 'long unsigned i nt'} makes integer
|
|
from pointer without a cast [-Wint-conversion]
|
|
671 | return (val); \
|
|
| ^
|
|
../device.c:329:9: note: in expansion of macro 'g_return_val_if_fail'
|
|
329 | g_return_val_if_fail (device, NULL);
|
|
| ^~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
../device.c: In function 'mp_device_list_free':
|
|
/usr/include/glib-2.0/glib/gmessages.h:671:16: error: 'return' with a value, in
|
|
function returning void [-Wreturn-mismatch]
|
|
671 | return (val); \
|
|
| ^
|
|
../device.c:522:9: note: in expansion of macro 'g_return_val_if_fail'
|
|
522 | g_return_val_if_fail (device_list, NULL);
|
|
| ^~~~~~~~~~~~~~~~~~~~
|
|
../device.c:520:1: note: declared here
|
|
520 | mp_device_list_free(MPDeviceList *device_list)
|
|
| ^~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
../tools/camera_test.c: In function 'main':
|
|
../tools/camera_test.c:188:57: error: passing argument 2 of
|
|
'mp_camera_capture_image' from incompatible pointer type [-Wincompatible-pointer-types]
|
|
188 | mp_camera_capture_image(camera, on_capture, NULL);
|
|
| ^~~~~~~~~~
|
|
| |
|
|
| void (*)(MPImage, void *)
|
|
In file included from ../tools/camera_test.c:1:
|
|
../camera.h:96:64: note: expected 'enum bufstate (*)(MPImage, void *)' but
|
|
argument is of type 'void (*)(MPImage, void *)'
|
|
96 | bool mp_camera_capture_image(MPCamera *camera, enum bufstate (*callback)(MPImage, void *),
|
|
| ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
```
|
|
|
|
--- millipixels-v0.22.0-origin/device.c
|
|
+++ millipixels-v0.22.0/device.c
|
|
@@ -326,7 +326,7 @@
|
|
size_t
|
|
mp_device_get_num_interfaces(const MPDevice *device)
|
|
{
|
|
- g_return_val_if_fail (device, NULL);
|
|
+ g_return_val_if_fail (device, 0);
|
|
|
|
return device->num_interfaces;
|
|
}
|
|
@@ -368,7 +368,7 @@
|
|
size_t
|
|
mp_device_get_num_pads(const MPDevice *device)
|
|
{
|
|
- g_return_val_if_fail (device, NULL);
|
|
+ g_return_val_if_fail (device, 0);
|
|
|
|
return device->num_pads;
|
|
}
|
|
@@ -519,7 +519,7 @@
|
|
void
|
|
mp_device_list_free(MPDeviceList *device_list)
|
|
{
|
|
- g_return_val_if_fail (device_list, NULL);
|
|
+ g_return_if_fail (device_list);
|
|
|
|
while (device_list) {
|
|
MPDeviceList *tmp = device_list;
|
|
--- millipixels-v0.22.0-origin/tools/camera_test.c
|
|
+++ millipixels-v0.22.0/tools/camera_test.c
|
|
@@ -15,7 +15,7 @@
|
|
return t.tv_sec + t.tv_usec * 1e-6;
|
|
}
|
|
|
|
-void
|
|
+enum bufstate
|
|
on_capture(MPImage image, void *user_data)
|
|
{
|
|
size_t num_bytes =
|
|
@@ -27,6 +27,7 @@
|
|
printf(" first byte: %d.", data[0]);
|
|
|
|
free(data);
|
|
+ return true;
|
|
}
|
|
|
|
int
|