roman-murashov / hedgewars

Automatically exported from code.google.com/p/hedgewars
GNU General Public License v2.0
0 stars 0 forks source link

a shared library shouldn't call exit or _exit #752

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
The shared libavwrapper shouldn't call exit, but instead return a error value
http://lintian.debian.org/tags/shlib-calls-exit.html

the change should be trivial, a little change in avwrapper.c and uVideoRec.pas 
should fix it.

I know this is internal, but I think a more robust library wrapper can avoid 
some errors difficult to spot otherwise

Original issue reported on code.google.com by costamag...@gmail.com on 2 Jan 2014 at 3:00

GoogleCodeExporter commented 8 years ago
Hi, this is the patch
http://pastebin.com/fLj7pVkF

I tried to keep avwrapper.c with the same behaviour as before, some code could 
be just dropped if you want!

for uVideoRec.pas I just changed the 
AVWrapper_Init
AVWrapper_Close
AVWrapper_WriteFrame
to functions with an integer as return value

now it is up to you, you can add if statements and exit the program, throw 
errors, ignore them...

Feel free to do whatever you want :)

Original comment by costamag...@gmail.com on 3 Jan 2014 at 8:28

GoogleCodeExporter commented 8 years ago
Also this warning can be easily solved
$: In function ‘AVWrapper_Init’:
$avwrapper.c:454:18: warning: ignoring return value of ‘fread’, declared 
with attribute warn_unused_result [-Wunused-result]
             fread(&g_Frequency, 4, 1, g_pSoundFile);
                  ^
$avwrapper.c:455:18: warning: ignoring return value of ‘fread’, declared 
with attribute warn_unused_result [-Wunused-result]
             fread(&g_Channels, 4, 1, g_pSoundFile);

Original comment by costamag...@gmail.com on 3 Jan 2014 at 9:36

GoogleCodeExporter commented 8 years ago
The patch is available here
https://github.com/hedgewars/hw/pull/8

Original comment by costamag...@gmail.com on 3 Jan 2014 at 1:29

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Fixed in
https://code.google.com/p/hedgewars/source/detail?r=e33178322a8f0454e786ca1b2efc
c7398217069d&name=0.9.20
and

https://code.google.com/p/hedgewars/source/detail?r=dae338c8c19ce83959ccf8d95b97
376ab521234f&name=0.9.20

please close this one

Original comment by costamag...@gmail.com on 6 Jan 2014 at 11:19

GoogleCodeExporter commented 8 years ago
FYI, just adding an 'r' before the hash converts it into a link.
Thanks for the patch.

Original comment by vittorio...@gmail.com on 6 Jan 2014 at 3:01

GoogleCodeExporter commented 8 years ago
yes sorry but it was already the second message, I didn't want to spam anymore 
:)

Original comment by costamag...@gmail.com on 6 Jan 2014 at 3:07