#6 Fix some -Wreturn-type warnings
Merged 2 years ago by zdohnal. Opened 2 years ago by tstellar.
rpms/ tstellar/hplip Wreturn-type-fixes  into  master

@@ -0,0 +1,111 @@ 

+ --- hplip-3.20.3/prnt/hpps/hppsfilter.c.orig	2020-03-25 01:09:51.585129957 +0000

+ +++ hplip-3.20.3/prnt/hpps/hppsfilter.c	2020-03-25 01:10:15.610058293 +0000

+ @@ -104,7 +104,7 @@ static void open_tempbookletfile(char *m

+      if(ptempbooklet_file == NULL)

+      {

+              fprintf(stderr, "ERROR: Unable to open temp file %s\n", temp_filename);

+ -            return 1;

+ +            return;

+      }  

+      chmod(temp_filename, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);

+  

+ --- hplip-3.20.3/scan/sane/hpaio.c.orig	2020-03-25 01:24:15.558732638 +0000

+ +++ hplip-3.20.3/scan/sane/hpaio.c	2020-03-25 02:48:36.097054366 +0000

+ @@ -406,20 +406,34 @@ extern SANE_Status sane_hpaio_open(SANE_

+  

+  extern void sane_hpaio_close(SANE_Handle handle)

+  {

+ -    if (strcmp(*((char **)handle), "MARVELL") == 0)

+ -       return marvell_close(handle);

+ -    if (strcmp(*((char **)handle), "SOAP") == 0)

+ -       return soap_close(handle);

+ -    if (strcmp(*((char **)handle), "SOAPHT") == 0)

+ -       return soapht_close(handle);

+ -    if (strcmp(*((char **)handle), "LEDM") == 0)

+ -       return ledm_close(handle);

+ -    if (strcmp(*((char **)handle), "SCL-PML") == 0)

+ -       return sclpml_close(handle);

+ -    if (strcmp(*((char **)handle), "ESCL") == 0)

+ -       return escl_close(handle);

+ -    if (strcmp(*((char **)handle), "ORBLITE") == 0)

+ -       return orblite_close(handle);

+ +    if (strcmp(*((char **)handle), "MARVELL") == 0) {

+ +       marvell_close(handle);

+ +       return;

+ +    }

+ +    if (strcmp(*((char **)handle), "SOAP") == 0) {

+ +       soap_close(handle);

+ +       return;

+ +    }

+ +    if (strcmp(*((char **)handle), "SOAPHT") == 0) {

+ +       soapht_close(handle);

+ +       return;

+ +    }

+ +    if (strcmp(*((char **)handle), "LEDM") == 0) {

+ +       ledm_close(handle);

+ +       return;

+ +    }

+ +    if (strcmp(*((char **)handle), "SCL-PML") == 0) {

+ +       sclpml_close(handle);

+ +       return;

+ +    }

+ +    if (strcmp(*((char **)handle), "ESCL") == 0) {

+ +       escl_close(handle);

+ +       return;

+ +    }

+ +    if (strcmp(*((char **)handle), "ORBLITE") == 0) {

+ +       orblite_close(handle);

+ +       return;

+ +    }

+  }  /* sane_hpaio_close() */

+  

+  extern const SANE_Option_Descriptor * sane_hpaio_get_option_descriptor(SANE_Handle handle, SANE_Int option)

+ @@ -539,20 +553,34 @@ extern SANE_Status sane_hpaio_read(SANE_

+  /* Note, sane_cancel is called normally not just during IO abort situations. */

+  extern void sane_hpaio_cancel( SANE_Handle handle )

+  {

+ -    if (strcmp(*((char **)handle), "MARVELL") == 0)

+ -       return marvell_cancel(handle);

+ -    if (strcmp(*((char **)handle), "SOAP") == 0)

+ -       return soap_cancel(handle);

+ -    if (strcmp(*((char **)handle), "SOAPHT") == 0)

+ -       return soapht_cancel(handle);

+ -    if (strcmp(*((char **)handle), "LEDM") == 0)

+ -       return ledm_cancel(handle);

+ -    if (strcmp(*((char **)handle), "SCL-PML") == 0)

+ -       return sclpml_cancel(handle);

+ -    if (strcmp(*((char **)handle), "ESCL") == 0)

+ -       return escl_cancel(handle);

+ -    if (strcmp(*((char **)handle), "ORBLITE") == 0)

+ -       return orblite_cancel(handle);

+ +    if (strcmp(*((char **)handle), "MARVELL") == 0) {

+ +       marvell_cancel(handle);

+ +       return;

+ +    }

+ +    if (strcmp(*((char **)handle), "SOAP") == 0) {

+ +       soap_cancel(handle);

+ +       return;

+ +    }

+ +    if (strcmp(*((char **)handle), "SOAPHT") == 0) {

+ +       soapht_cancel(handle);

+ +       return;

+ +    }

+ +    if (strcmp(*((char **)handle), "LEDM") == 0) {

+ +       ledm_cancel(handle);

+ +       return;

+ +    }

+ +    if (strcmp(*((char **)handle), "SCL-PML") == 0) {

+ +       sclpml_cancel(handle);

+ +       return;

+ +    }

+ +    if (strcmp(*((char **)handle), "ESCL") == 0) {

+ +       escl_cancel(handle);

+ +       return;

+ +    }

+ +    if (strcmp(*((char **)handle), "ORBLITE") == 0) {

+ +       orblite_cancel(handle);

+ +       return;

+ +    }

+  }  /* sane_hpaio_cancel() */

+  

+  extern SANE_Status sane_hpaio_set_io_mode(SANE_Handle handle, SANE_Bool nonBlocking)

file modified
+8 -1
@@ -7,7 +7,7 @@ 

  Summary: HP Linux Imaging and Printing Project

  Name: hplip

  Version: 3.20.3

- Release: 1%{?dist}

+ Release: 2%{?dist}

  License: GPLv2+ and MIT and BSD and IJG and Public Domain and GPLv2+ with exceptions and ISC

  

  Url: https://developers.hp.com/hp-linux-imaging-and-printing
@@ -130,6 +130,8 @@ 

  # https://bugs.launchpad.net/hplip/+bug/1863620

  Patch51: hplip-pil.patch

  

+ Patch52: hplip-fix-Wreturn-type-warning.patch

+ 

  Requires: %{name}-libs%{?_isa} = %{version}-%{release}

  Requires: python3-pillow

  Requires: cups
@@ -390,6 +392,7 @@ 

  # 1573430 - sixext.py:to_string_utf8:UnicodeDecodeError: 'utf-8' codec can't decode bytes

  %patch50 -p1 -b .unicodeerror

  %patch51 -p1 -b .pil

+ %patch52 -p1 -b .Wreturn-fix

  

  sed -i.duplex-constraints \

      -e 's,\(UIConstraints.* \*Duplex\),//\1,' \
@@ -696,6 +699,10 @@ 

  %config(noreplace) %{_sysconfdir}/sane.d/dll.d/hpaio

  

  %changelog

+ * Wed Mar 25 2020 Tom Stellard <tstellar@redhat.com> - 3.20.3-2

+ - Fix some -Wreturn-type warnings

+ - clang treates these as errors, so this fixes the build with clang.

+ 

  * Tue Mar 10 2020 Zdenek Dohnal <zdohnal@redhat.com> - 3.20.3-1

  - 3.20.3

  

clang treates these as errors, so this fixes the build with clang

Hi Tom,

thank you for fixing the warnings! I'll merge it and report it upstream (though I don't expect fixing it upstream...).

Pull-Request has been merged by zdohnal

2 years ago

Actually it is already reported by SuSE https://bugs.launchpad.net/hplip/+bug/1836735 , but IMHO your patch is better.