No return in non-void function in scan/sane/hpaio.c

Bug #1017496 reported by Philipp Wagner
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
HPLIP
Fix Released
Undecided
Sarbeswar Meher

Bug Description

I tried to package hplip 3.12.6 for openSUSE and got the following error from rpmlint:

E: hplip no-return-in-nonvoid-function scan/sane/hpaio.c:429, 413, 398, 383, 368, 340

The functions in the corresponding lines use some if-constructs to return a different return status depending on some parameters, but don't return anything if no if-clause matches. This is what rpmlint complains about. I don't know enough about the source code to submit a patch with a sane default return value, so could you please look into this? I would like to avoid disabling this error for indefinite amounts of time.

Revision history for this message
Philipp Wagner (imphil) wrote :

I found out that it is not possible to disable the error when doing the RPM packing, so I needed to try a patch. I attached it for you to have a look at it. Does this look ok?

Revision history for this message
Sarbeswar Meher (sarbeswar-meher) wrote :

The patch looks fine. We will add the patch in the next release.

Changed in hplip:
assignee: nobody → Sarbeswar Meher (sarbeswar-meher)
Changed in hplip:
status: New → Fix Committed
Revision history for this message
Johannes Meixner (jsmeix) wrote :

The original patch was o.k. (except a useless return in a void function)
but what you actually added in HPLIP is not the original patch
but something different and that is not 64-bit safe
(pointer and integer mixed up).

Therefore one still needs to apply the patch below
to make at least the compiler plus build-system checks
on the openSUSE build system happy
(last line shortened here):
-----------------------------------------------------------------------------------------
--- scan/sane/hpaio.c.orig 2012-09-04 14:32:55.000000000 +0200
+++ scan/sane/hpaio.c 2012-09-28 14:20:24.595427330 +0200
@@ -368,7 +368,7 @@ extern const SANE_Option_Descriptor * sa
     if (strcmp(*((char **)handle), "SCL-PML") == 0)
        return sclpml_get_option_descriptor(handle, option);
     else
- return SANE_STATUS_UNSUPPORTED;
+ return NULL;
 } /* sane_hpaio_get_option_descriptor() */

 extern SANE_Status sane_hpaio_control_option(...
-----------------------------------------------------------------------------------------
because SANE_STATUS_UNSUPPORTED is of
"typedef enum {...} SANE_Status", see /usr/include/sane/sane.h (i.e. integer)
but those function returns type "SANE_Option_Descriptor * ..." (i.e. pointer)

Please fix scan/sane/hpaio.c accordingly to make it 64-bit safe.

Changed in hplip:
status: Fix Committed → New
Revision history for this message
Sarbeswar Meher (sarbeswar-meher) wrote :

 The fix will be incorporated in the next release. Thanks.

Changed in hplip:
status: New → Fix Committed
Changed in hplip:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.