Re: [PATCH] comctl32: Fixed strncpy (Coverity)

2011-06-28 Thread Michael Stefaniuc
Hello Marcus,

On 06/28/2011 09:15 AM, Marcus Meissner wrote:
 This is a 2 CHAR buffer, and we copy in 1 CHAR and \0. So just do that
 via strcpy() and dont confuse the static checker.
 
 CID 1194
 
 Ciao, Marcus
 ---
  dlls/comctl32/tests/treeview.c |2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)
 
 diff --git a/dlls/comctl32/tests/treeview.c b/dlls/comctl32/tests/treeview.c
 index 324473d..faa9553 100644
 --- a/dlls/comctl32/tests/treeview.c
 +++ b/dlls/comctl32/tests/treeview.c
 @@ -1225,7 +1225,7 @@ static void test_itemedit(void)
  r = TreeView_SelectItem(hTree, NULL);
  expect(TRUE, r);
  /* alter text */
 -strncpy(buff, x, sizeof(buff)/sizeof(CHAR));
 +strcpy(buff, x);
  r = SendMessage(edit, WM_SETTEXT, 0, (LPARAM)buff);
What about
   r = SendMessage(edit, WM_SETTEXT, 0, (LPARAM)x);
No strcpy involved.

  expect(TRUE, r);
  r = SendMessage(hTree, WM_COMMAND, MAKEWPARAM(0, EN_KILLFOCUS), 
 (LPARAM)edit);

bye
michael




Re: d3dx9/tests: Fix comparison that expects NAN, since NAN != NAN.

2011-06-28 Thread Tijl Coosemans
On Tuesday 28 June 2011 00:40:09 Alexandre Julliard wrote:
 Dylan Smith dylan.ah.sm...@gmail.com writes:
 @@ -4834,7 +4834,7 @@ static void test_create_skin_info(void)
  for (i = 0; i  num_influences; i++) {
  ok(exp_vertices[i] == vertices[i],
 influence[%d]: expected vertex %u, got %u\n, i, 
 exp_vertices[i], vertices[i]);
 -ok(exp_weights[i] == weights[i],
 +ok((isnan(exp_weights[i])  isnan(weights[i])) || 
 exp_weights[i] == weights[i],
 
 I put this in for now to fix the tests, but isnan() isn't really
 portable, we should try to find a better way.

You can replace isnan(x) with (x != x), but isnan is specified by the
ISO C99 standard, so it should be portable.


signature.asc
Description: This is a digitally signed message part.



Re: d3dx9/tests: Fix comparison that expects NAN, since NAN != NAN.

2011-06-28 Thread GOUJON Alexandre

On 06/28/2011 10:59 AM, Tijl Coosemans wrote:

On Tuesday 28 June 2011 00:40:09 Alexandre Julliard wrote:

Dylan Smithdylan.ah.sm...@gmail.com  writes:

@@ -4834,7 +4834,7 @@ static void test_create_skin_info(void)
  for (i = 0; i  num_influences; i++) {
  ok(exp_vertices[i] == vertices[i],
 influence[%d]: expected vertex %u, got %u\n, i, 
exp_vertices[i], vertices[i]);
-ok(exp_weights[i] == weights[i],
+ok((isnan(exp_weights[i])  isnan(weights[i])) || 
exp_weights[i] == weights[i],

I put this in for now to fix the tests, but isnan() isn't really
portable, we should try to find a better way.

You can replace isnan(x) with (x != x), but isnan is specified by the
ISO C99 standard, so it should be portable.
Wine adheres to standard C89/C90. Code should be written so that it 
works with as many compilers as possible, so you should avoid 
compiler-specific constructs, C99 and C++. 

from http://wiki.winehq.org/SubmittingPatches.




Re: [PATCH 3/6] dinput: SetActionMap setting the device buffer (try 2)

2011-06-28 Thread Alexandre Julliard
Lucas Fialho Zawacki lfzawa...@gmail.com writes:

 +FIXME((%p)-(%p,%s,%08x): semi-stub !\n, iface, lpdiaf, lpszUserName, 
 dwFlags);
 +
 +diafW.rgoAction = HeapAlloc(GetProcessHeap(), 0, 
 sizeof(DIACTIONW)*lpdiaf-dwNumActions);
 +_copy_diactionformatAtoW(diafW, lpdiaf);
 +
 +hr = 
 IDirectInputDevice8WImpl_SetActionMap(This-IDirectInputDevice8W_iface, 
 diafW, NULL, dwFlags);
 +
 +_copy_diactionformatWtoA(lpdiaf, diafW);

Do you really need to copy it back?  It looks like an input parameter.

-- 
Alexandre Julliard
julli...@winehq.org




Re: [PATCH 3/6] dinput: SetActionMap setting the device buffer (try 2)

2011-06-28 Thread Lucas Zawacki
 Do you really need to copy it back?  It looks like an input parameter.

Yes, you're right. In SetActionMap this copy should not be necessary.
I'll take this code out and roll a new version of the patches.




Re: gcc 4.6 warning report

2011-06-28 Thread Vincent Povirk
 ../../../../dlls/gdiplus/tests/image.c: In function ‘test_palette’:
 ../../../../dlls/gdiplus/tests/image.c:1773:104: warning: array subscript is 
 above array bounds [-Warray-bounds]

This is because the ColorPalette structure has an array of length 1 at
the end, which is really a variable-length array. We'd need a way to
let gcc know of this fact, without breaking compatibility with Windows
headers that declare it as an array of length 1.

On Sat, Jun 18, 2011 at 9:55 AM, Jerome Leclanche adys...@gmail.com wrote:
 Had to check a few warnings earlier and there hasn't been a warning
 report in a while, thought I'd share it. It's also still impossible to
 configure with -Werror because of warnings in configure scripts.

 Wine version
  wine-1.3.22-203-gac90c1b ac90c1bd1878599710605fa5b4e2fe8ce224b280

 Enabled packages
  alsa freetype gstreamer jpeg ldap openal opengl openssl png x
 xinerama xinput2 xml xrandr

 Disabled packages
  capi cms cups curses esd fontconfig gettextpo gnutls gphoto gsm hal
 jack mpg123 nas opencl oss sane tiff v4l xslt xxf86vm

 CFLAGS
  -msse4 -O3 -Wall

 Built on
  Linux azura 3.0-0-generic #1-Ubuntu SMP Thu Jun 9 16:32:10 UTC 2011
 x86_64 x86_64 x86_64 GNU/Linux


 J. Leclanche








Re: [PATCH 3/6] dinput: SetActionMap setting the device buffer (try 2)

2011-06-28 Thread Lucas Zawacki
The new patches address this issue, make some little corrections that
are pointed in the comments. Also I organized them better, with the
tests first.


2011/6/28 Lucas Zawacki lfzawa...@gmail.com:
 Do you really need to copy it back?  It looks like an input parameter.

 Yes, you're right. In SetActionMap this copy should not be necessary.
 I'll take this code out and roll a new version of the patches.





Re: [PATCH] comctl32: Fixed strncpy (Coverity)

2011-06-28 Thread David Laight
On Tue, Jun 28, 2011 at 09:37:39AM +0200, Michael Stefaniuc wrote:
 Hello Marcus,
 
 On 06/28/2011 09:15 AM, Marcus Meissner wrote:
  This is a 2 CHAR buffer, and we copy in 1 CHAR and \0. So just do that
  via strcpy() and dont confuse the static checker.
...
  -strncpy(buff, x, sizeof(buff)/sizeof(CHAR));
  +strcpy(buff, x);

What is wrong with:
buff[0] = 'x';
buff[1] = 0;

David

-- 
David Laight: da...@l8s.co.uk




Re: [PATCH] comctl32: Fixed strncpy (Coverity)

2011-06-28 Thread GOUJON Alexandre

...

What is wrong with:
buff[0] = 'x';
buff[1] = 0;

David

and why not
buff = { 'x', '\0' };




Re: gcc 4.6 warning report

2011-06-28 Thread Juan Lang
../../../dlls/netapi32/nbt.c:580:30: warning: cast from pointer to
integer of different size [-Wpointer-to-int-cast]

This is a false positive.  h_addr_list is declared as a char **, and
technically it is, but gethostbyname only returns IPv4 addresses, i.e.
ones that can fit in a DWORD.
--Juan




wine bug 27600

2011-06-28 Thread wylda

Hi Vincas, i wanted to give bug 27600 a try. So on top of
wine-1.3.23-50-g2497a91 i applied patches:

1. 75818
2. 75819
3. 75831
4. 75830
5. 75829
6. 75820
7. 75821
8. 75822
9. 75823

but i end up with failure during the buildup:

gcc -c -I. -I. -I../../include -I../../include  -D__WINESRC__
-D_USER32_ -D_WINABLE_ -D_REENTRANT -fPIC -Wall -pipe -fno-stric
t-aliasing -Wdeclaration-after-statement -Wempty-body
-Wstrict-prototypes -Wtype-limits -Wwrite-strings -Wpointer-arith
-Wlogi
cal-op  -g -O0  -o input.o input.c

input.c: In function ‘GetRawInputDeviceList’:

input.c:495: error: ‘union generic_request’ has no member named
‘get_raw_input_device_list_request’

input.c:495: error: ‘union generic_reply’ has no member named
‘get_raw_input_device_list_reply’


Regards,
W.



-- 
IHNED.cz je nový, přehlednější a rychlejší. Přesvědčte se na:
www.ihned.cz





Re: wine bug 27600

2011-06-28 Thread Austin English
On Tue, Jun 28, 2011 at 13:16,  wy...@volny.cz wrote:

 Hi Vincas, i wanted to give bug 27600 a try. So on top of
 wine-1.3.23-50-g2497a91 i applied patches:

 1. 75818
 2. 75819
 3. 75831
 4. 75830
 5. 75829
 6. 75820
 7. 75821
 8. 75822
 9. 75823

 but i end up with failure during the buildup:

 gcc -c -I. -I. -I../../include -I../../include  -D__WINESRC__
 -D_USER32_ -D_WINABLE_ -D_REENTRANT -fPIC -Wall -pipe -fno-stric
 t-aliasing -Wdeclaration-after-statement -Wempty-body
 -Wstrict-prototypes -Wtype-limits -Wwrite-strings -Wpointer-arith
 -Wlogi
 cal-op  -g -O0  -o input.o input.c

 input.c: In function ‘GetRawInputDeviceList’:

 input.c:495: error: ‘union generic_request’ has no member named
 ‘get_raw_input_device_list_request’

 input.c:495: error: ‘union generic_reply’ has no member named
 ‘get_raw_input_device_list_reply’


 Regards,
 W.

Did you run ./tools/make_requests ?

-- 
-Austin




Re: wine bug 27600

2011-06-28 Thread wylda
 
 Did you run ./tools/make_requests ?
 
 -- 
 -Austin
 

Nope. So i did:

./tools/make_requests
make distclean
./configure followed by make and got (-O0 issue??):


gcc -c -I. -I. -I../include -I../include  -D__WINESRC__  -Wall -pipe
-fno-strict-aliasing -Wdeclaration-after-statement -Wempt
y-body -Wstrict-prototypes -Wtype-limits -Wwrite-strings
-Wpointer-arith -Wlogical-op  -g -O0  -o raw_input.o raw_input.c

In file included from raw_input.c:28:
../include/winternl.h:2359: error: expected declaration specifiers
or ‘...’ before ‘va_list’
../include/winternl.h:2529: error: expected declaration specifiers
or ‘...’ before ‘va_list’
../include/winternl.h:2530: error: expected declaration specifiers
or ‘...’ before ‘va_list’

In file included from raw_input.c:29:
../include/winbase.h:1578: error: expected declaration specifiers or
‘...’ before ‘va_list’
../include/winbase.h:1579: error: expected declaration specifiers or
‘...’ before ‘va_list’

make[1]: *** [raw_input.o] Error 1

make[1]: Leaving directory `/build/wine-git_build/server'

make: *** [server] Error 2



-- 
IHNED.cz je nový, přehlednější a rychlejší. Přesvědčte se na:
www.ihned.cz





Re: wine bug 27600

2011-06-28 Thread wylda
So i another try:
* rm -rf * in my git tree.
* git checkout -f 2497a91f6b1326988dd5ea56dc4052cbcc2e521d
* applied all nine patches
* ./tools/make_requests
* configure + make with -O2 and got again:

 
 In file included from raw_input.c:28:
 ../include/winternl.h:2359: error: expected
 declaration specifiers
 or ‘...’ before ‘va_list’
 ../include/winternl.h:2529: error: expected
 declaration specifiers
 or ‘...’ before ‘va_list’
 ../include/winternl.h:2530: error: expected
 declaration specifiers
 or ‘...’ before ‘va_list’
 




-- 
IHNED.cz je nový, přehlednější a rychlejší. Přesvědčte se na:
www.ihned.cz





Re: wine bug 27600

2011-06-28 Thread Vincas Miliūnas
On 06/29/2011 12:10 AM, wy...@volny.cz wrote:
 So i another try:
 * rm -rf * in my git tree.
 * git checkout -f 2497a91f6b1326988dd5ea56dc4052cbcc2e521d
 * applied all nine patches
 * ./tools/make_requests
 * configure + make with -O2 and got again:

 In file included from raw_input.c:28:
 ../include/winternl.h:2359: error: expected
 declaration specifiers
 or ‘...’ before ‘va_list’
 ../include/winternl.h:2529: error: expected
 declaration specifiers
 or ‘...’ before ‘va_list’
 ../include/winternl.h:2530: error: expected
 declaration specifiers
 or ‘...’ before ‘va_list’




Looks like there is some external interference, try compiling in a clean
bash environment; some googling suggests that LIBRARY_PATH variable
should be unset - https://bbs.archlinux.org/viewtopic.php?id=30418

First be sure it can compile the original master branch without issues.

Compilation with the patch after make distclean works for me.





Re: wine bug 27600

2011-06-28 Thread wylda
 Looks like there is some external interference,
 try compiling in a clean
 bash environment; some googling suggests that
 LIBRARY_PATH variable
 should be unset -
 https://bbs.archlinux.org/viewtopic.php?id=30418

 First be sure it can compile the original master
 branch without issues.


Still fails here :-/

* succesfully compiled vanilla wine-1.3.23-50-g2497a91
* make distclean
* applied all nine patches
* unset LIBRARY_PATH
* ./tools/make_requests //3 files updated
* ./configure
* make -j 16

Debian 32 squeeze, gcc v4.4.5, no CFLAGS override.



-- 
IHNED.cz je nový, přehlednější a rychlejší. Přesvědčte se na:
www.ihned.cz







Re: gcc 4.6 warning report

2011-06-28 Thread David Laight
On Tue, Jun 28, 2011 at 12:51:02PM -0700, Juan Lang wrote:
 ../../../dlls/netapi32/nbt.c:580:30: warning: cast from pointer to
 integer of different size [-Wpointer-to-int-cast]
 
 This is a false positive.  h_addr_list is declared as a char **, and
 technically it is, but gethostbyname only returns IPv4 addresses, i.e.
 ones that can fit in a DWORD.

That doesn't sound like a problem that would give that warning.

David

-- 
David Laight: da...@l8s.co.uk




Re: wine bug 27600

2011-06-28 Thread Vincas Miliūnas
On 06/29/2011 12:28 AM, wy...@volny.cz wrote:
 Looks like there is some external interference,
 try compiling in a clean
 bash environment; some googling suggests that
 LIBRARY_PATH variable
 should be unset -
 https://bbs.archlinux.org/viewtopic.php?id=30418
 First be sure it can compile the original master
 branch without issues.

 Still fails here :-/

 * succesfully compiled vanilla wine-1.3.23-50-g2497a91
 * make distclean
 * applied all nine patches
 * unset LIBRARY_PATH
 * ./tools/make_requests //3 files updated
 * ./configure
 * make -j 16

 Debian 32 squeeze, gcc v4.4.5, no CFLAGS override.



It fails on the #include winternl.h line and these are standard
includes, you can try to replace

[code]
#include stdarg.h
#include stdio.h
[/code]

code fragment with

[code]
#include config.h
#include wine/port.h

#include assert.h
#include stdarg.h
#include stdio.h
[/code]

maybe that will change something.

Others that have successfully built with the patch applied are WINE's
testbot and two persons from http://bugs.winehq.org/show_bug.cgi?id=20395





Re: gcc 4.6 warning report

2011-06-28 Thread Juan Lang
 This is a false positive.  h_addr_list is declared as a char **, and
 technically it is, but gethostbyname only returns IPv4 addresses, i.e.
 ones that can fit in a DWORD.

 That doesn't sound like a problem that would give that warning.

Why not?  A cast of a pointer to a DWORD with 64-bit pointers would
cause truncation, if it were indeed a pointer that were being cast.
It isn't, even though it's declared that way.
--Juan




Re: wine bug 27600

2011-06-28 Thread wylda

 It fails on the #include winternl.h line and
 these are standard
 includes, you can try to replace
 
 [code]
 #include stdarg.h
 #include stdio.h
 [/code]
 
 code fragment with
 
 [code]
 #include config.h
 #include wine/port.h
 
 #include assert.h
 #include stdarg.h
 #include stdio.h
 [/code]
 
 maybe that will change something.

Unfortunately that's too generic for me (i can't handle code) :-( I
would need it in more detail way or a patch. But i'm not asking you
from that. I do not want to waste developers time ;)


 Others that have successfully built with the patch
 applied are WINE's
 testbot and two persons from
 http://bugs.winehq.org/show_bug.cgi?id=20395


Maybe gcc 4.4.5 is too old or i'm extremly dumb today :-/

Regards,
W.



-- 
IHNED.cz je nový, přehlednější a rychlejší. Přesvědčte se na:
www.ihned.cz







Re: wine bug 27600

2011-06-28 Thread Vincas Miliūnas
On 06/29/2011 01:25 AM, wy...@volny.cz wrote:
 It fails on the #include winternl.h line and
 these are standard
 includes, you can try to replace

 [code]
 #include stdarg.h
 #include stdio.h
 [/code]

 code fragment with

 [code]
 #include config.h
 #include wine/port.h

 #include assert.h
 #include stdarg.h
 #include stdio.h
 [/code]

 maybe that will change something.
 Unfortunately that's too generic for me (i can't handle code) :-( I
 would need it in more detail way or a patch. But i'm not asking you
 from that. I do not want to waste developers time ;)


 Others that have successfully built with the patch
 applied are WINE's
 testbot and two persons from
 http://bugs.winehq.org/show_bug.cgi?id=20395

 Maybe gcc 4.4.5 is too old or i'm extremly dumb today :-/

 Regards,
 W.



I'm not a WINE developer, just scratching my own itch :)

I have the same gcc version. Well, this might be a legitimate issue,
another important thing would be to see the ./configure output log.

I've merged the patch with the include lines modified, so they would be
identical to the include files mostly used in the other wineserver c files.
This is just a guess, I have no idea why it doesn't work. There is also
today's commit, that changed include/winternl.h: ntdll: Encode the
function pointers in the vectored handler list, but it's not related.

The patch is rebased against today's commits -
http://dl.dropbox.com/u/6901628/raw.patch

There are some paranormal stuff in wineserver, like in the first
revision of this patch (I haven't tried since then), if I removed the
user.h include (which is not used), some magical force was preventing
from successfully copying lParam value in the peek_message function (it
had the correct value from the source, but the target was reset back to
some constant) for each WM_INPUT message I posted, while other messages
where working just fine.