Re: [PATCH] vdr/config.c: memset has wrong parameters

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Am 21.12.2011 23:31, schrieb Klaus Schmidinger:
On 21.12.2011 23:18, Lars Hanisch wrote:
Hi,

The compiler gives me:

:~/src/vdr$ make config.o
g++ -g -O3 -Wall -Woverloaded-virtual -Wno-parentheses -c -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
-D_LARGEFILE64_SOURCE -DREMOTE_KBD -DLIRC_DEVICE=\"/var/run/lirc/lircd\" -DRCU_DEVICE=\"/dev/ttyS1\" -D_GNU_SOURCE
-DVIDEODIR=\"/video\" -DCONFDIR=\"/video\" -DPLUGINDIR=\"./PLUGINS/lib\"
-DLOCDIR=\"./locale\" -I/usr/include/freetype2 config.c
In file included from /usr/include/string.h:642:0,
from config.h:16,
from config.c:10:
In Funktion »void* memset(void*, int, size_t)«,
eingefügt von »cSatCableNumbers::cSatCableNumbers(int, const char*)« bei config.c:72:39:
/usr/include/x86_64-linux-gnu/bits/string3.h:82:32: Warnung: Aufruf von »__warn_memset_zero_len« mit Attributwarnung
deklariert: memset used with constant zero length parameter; this could be due to transposed parameters [standardmäßig
aktiviert]

I think, the memset arguments should be swapped:

diff --git a/config.c b/config.c
index 94f6845..53beb4b 100644
--- a/config.c
+++ b/config.c
@@ -69,7 +69,7 @@ cSatCableNumbers::cSatCableNumbers(int Size, const char *s)
{
size = Size;
array = MALLOC(int, size);
- memset(array, size * sizeof(int), 0);
+ memset(array, 0, size * sizeof(int));
FromString(s);
}

Ville Skyttä already reported this to me and I have removed that call
altogether for the next developer version, because the array is initialized
explicitly, anyway.

 Fine! :-)

Lars.


Klaus

_______________________________________________
vdr mailing list
vdr@xxxxxxxxxxx
http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr


_______________________________________________
vdr mailing list
vdr@xxxxxxxxxxx
http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr



[Index of Archives]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Util Linux NG]     [Xfree86]     [Big List of Linux Books]     [Fedora Users]     [Fedora Women]     [ALSA Devel]     [Linux USB]

  Powered by Linux