Re: [RFC] cmd: Add a space at the end of the first echo'ed batch line [try5]

2010-11-01 Thread GOUJON Alexandre

On 11/01/2010 10:47 PM, Jacek Caban wrote:

Why do you need this? AFAICS the change to compare_line should be enough.

In wine/programs/cmd/tests there are 2 files :
+ test_builtins.cmd
+ test_builtins.cmd.exp

The first one is a kind of .bat on windows.
The wine cmd read line after line and execute it.

Then, the output is compared to the content of the second one.

I know the title of my patch may be unclear but it's really what windows 
cmd does :

cmd_prompt>echo a...@space@
a

A space is added at the end of the line.
That @space@ is added in the test_builtins.cmd.exp

However, to extend tests, I added several lines in test_builtins.cmd 
with terminating spaces.

There, AJ warned me that git will ignore them as they are trailing spaces.
He tolds me to find a way to add these spaces.
I first tried ^z (an ASCII char meaning substitute) but he replied me it 
is considered as a new line on windows.

He advise me then to use, as in test_bultins.cmd.exp "@space@"

And that's why I have to "parse" the input cmd_data to find and replace 
@space@ occurences with "real" spaces.


I hope it's now clearer.




Re: [5/5] msxml3: Fix node_get_text() whitespace handling

2010-11-01 Thread Marvin
Hi,

While running your changed tests on Windows, I think I found new failures.
Being a bot and all I'm not very good at pattern recognition, so I might be
wrong, but could you please double-check?
Full results can be found at
http://testbot.winehq.org/JobDetails.pl?Key=6694

Your paranoid android.


=== WINEBUILD (build) ===
Patch failed to apply




DDRAW: New implementation of SetCooperativeLevel (a new try)

2010-11-01 Thread paulo lesgaz
Hello,

In waiting for my last patch of test for SetCooperativeLevel being accepted, I 
send  to the list my attempt to fix this function. With the attached patch,all 
the already implemented and all the forecoming tests succeded.

I tried to implement Henri's idea about the logic of this function (see 
http://www.winehq.org/pipermail/wine-devel/2010-August/086201.html )

Any feedback of this patch would be welcomed.

Thanks in advance.

A+

David



  From 788d46ae9fe32a38494ae7a0d084de0237013b79 Mon Sep 17 00:00:00 2001
From: David Adam 
Date: Tue, 2 Nov 2010 04:33:17 +0100
Subject: Exclusive mode is the central case of SetcooperativeLevel, not Normal mode

---
 dlls/ddraw/ddraw.c |   95 +---
 1 files changed, 31 insertions(+), 64 deletions(-)

diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c
index fd87071..318611a 100644
--- a/dlls/ddraw/ddraw.c
+++ b/dlls/ddraw/ddraw.c
@@ -602,7 +602,7 @@ static HRESULT WINAPI ddraw7_SetCooperativeLevel(IDirectDraw7 *iface, HWND hwnd,
 return DDERR_INVALIDPARAMS;
 }
 
-if( (This->cooperative_level & DDSCL_FULLSCREEN) && window )
+if( (This->cooperative_level & DDSCL_EXCLUSIVE) && window )
 {
 TRACE("Setting DDSCL_SETFOCUSWINDOW with an already set window, returning DDERR_HWNDALREADYSET\n");
 LeaveCriticalSection(&ddraw_cs);
@@ -626,76 +626,43 @@ static HRESULT WINAPI ddraw7_SetCooperativeLevel(IDirectDraw7 *iface, HWND hwnd,
 LeaveCriticalSection(&ddraw_cs);
 return DD_OK;
 }
-/* DDSCL_NORMAL or DDSCL_FULLSCREEN | DDSCL_EXCLUSIVE */
-if(cooplevel & DDSCL_NORMAL)
-{
-/* Can't coexist with fullscreen or exclusive */
-if(cooplevel & (DDSCL_FULLSCREEN | DDSCL_EXCLUSIVE) )
-{
-TRACE("(%p) DDSCL_NORMAL is not compative with DDSCL_FULLSCREEN or DDSCL_EXCLUSIVE\n", This);
-LeaveCriticalSection(&ddraw_cs);
-return DDERR_INVALIDPARAMS;
-}
-
-/* Switching from fullscreen? */
-if(This->cooperative_level & DDSCL_FULLSCREEN)
-{
-This->cooperative_level &= ~DDSCL_FULLSCREEN;
-This->cooperative_level &= ~DDSCL_EXCLUSIVE;
-This->cooperative_level &= ~DDSCL_ALLOWMODEX;
 
-IWineD3DDevice_ReleaseFocusWindow(This->wineD3DDevice);
-}
-
-/* Don't override focus windows or private device windows */
-if( hwnd &&
-!(This->focuswindow) &&
-!(This->devicewindow) &&
-(hwnd != window) )
-{
-This->dest_window = hwnd;
-}
-}
-else if(cooplevel & DDSCL_FULLSCREEN)
+if(cooplevel & DDSCL_EXCLUSIVE)
 {
-/* Needs DDSCL_EXCLUSIVE */
-if(!(cooplevel & DDSCL_EXCLUSIVE) )
+if( !(cooplevel & DDSCL_FULLSCREEN) || !hwnd )
 {
-TRACE("(%p) DDSCL_FULLSCREEN needs DDSCL_EXCLUSIVE\n", This);
+TRACE("(%p) DDSCL_EXCLUSIVE needs DDSCL_FULLSCREEN and a window\n", This);
 LeaveCriticalSection(&ddraw_cs);
 return DDERR_INVALIDPARAMS;
 }
-/* Need a HWND
-if(hwnd == 0)
-{
-TRACE("(%p) DDSCL_FULLSCREEN needs a HWND\n", This);
-return DDERR_INVALIDPARAMS;
-}
-*/
-
-This->cooperative_level &= ~DDSCL_NORMAL;
-
-/* Don't override focus windows or private device windows */
-if( hwnd &&
-!(This->focuswindow) &&
-!(This->devicewindow) &&
-(hwnd != window) )
-{
-HRESULT hr = IWineD3DDevice_AcquireFocusWindow(This->wineD3DDevice, hwnd);
-if (FAILED(hr))
-{
-ERR("Failed to acquire focus window, hr %#x.\n", hr);
-LeaveCriticalSection(&ddraw_cs);
-return hr;
-}
-This->dest_window = hwnd;
-}
 }
-else if(cooplevel & DDSCL_EXCLUSIVE)
-{
-TRACE("(%p) DDSCL_EXCLUSIVE needs DDSCL_FULLSCREEN\n", This);
-LeaveCriticalSection(&ddraw_cs);
-return DDERR_INVALIDPARAMS;
+else if( !(cooplevel & DDSCL_NORMAL) )
+ {
+ TRACE("(%p) SetCooperativeLevel needs at least SetFocusWindow or Exclusive or Normal mode\n", This);
+ LeaveCriticalSection(&ddraw_cs);
+ return DDERR_INVALIDPARAMS;
+ }
+
+if( !(cooplevel & DDSCL_FULLSCREEN) && (This->cooperative_level & DDSCL_FULLSCREEN) )
+IWineD3DDevice_ReleaseFocusWindow(This->wineD3DDevice);
+
+/* Don't override focus windows or private device windows */
+if( hwnd &&
+!(This->focuswindow) &&
+!(This->devicewindow) &&
+(hwnd != window)  )
+{
+ if( cooplevel & DDSCL_FULLSCREEN )
+ {
+ HRESULT hr = IWineD3DDevice_AcquireFocusWindow(This->wineD3DDevice, hwnd);
+ if (FAILED(hr))
+ {
+ ERR(

Re: [4/4] msxml3: Implement domdoc schema validation (resend)

2010-11-01 Thread Marvin
Hi,

While running your changed tests on Windows, I think I found new failures.
Being a bot and all I'm not very good at pattern recognition, so I might be
wrong, but could you please double-check?
Full results can be found at
http://testbot.winehq.org/JobDetails.pl?Key=6691

Your paranoid android.


=== WINEBUILD (build) ===
Make of import library failed
Make of import library failed




Re: [3/4] msxml3: Add error code defines (resend)

2010-11-01 Thread Marvin
Hi,

While running your changed tests on Windows, I think I found new failures.
Being a bot and all I'm not very good at pattern recognition, so I might be
wrong, but could you please double-check?
Full results can be found at
http://testbot.winehq.org/JobDetails.pl?Key=6690

Your paranoid android.


=== WINEBUILD (build) ===
Make of import library failed
Make of import library failed




Re: cmd: Add a space at the end of the first echo'ed batch line [try6]

2010-11-01 Thread Marvin
Hi,

While running your changed tests on Windows, I think I found new failures.
Being a bot and all I'm not very good at pattern recognition, so I might be
wrong, but could you please double-check?
Full results can be found at
http://testbot.winehq.org/JobDetails.pl?Key=6689

Your paranoid android.


=== WNT4WSSP6 (32 bit batch) ===
batch.c:173: Test failed: expected space
batch.c:173: Test failed: expected space
batch.c:173: Test failed: expected space
batch.c:173: Test failed: expected space
batch.c:173: Test failed: expected space
batch.c:173: Test failed: expected space
batch.c:173: Test failed: expected space
batch.c:173: Test failed: expected space
batch.c:173: Test failed: expected space
batch.c:173: Test failed: expected space
batch.c:173: Test failed: expected space

=== W2KPROSP4 (32 bit batch) ===
batch.c:173: Test failed: expected space
batch.c:173: Test failed: expected space
batch.c:173: Test failed: expected space
batch.c:173: Test failed: expected space
batch.c:173: Test failed: expected space
batch.c:173: Test failed: expected space
batch.c:173: Test failed: expected space
batch.c:173: Test failed: expected space
batch.c:173: Test failed: expected space
batch.c:173: Test failed: expected space
batch.c:173: Test failed: expected space

=== WXPPROSP3 (32 bit batch) ===
batch.c:173: Test failed: expected space
batch.c:173: Test failed: expected space
batch.c:173: Test failed: expected space
batch.c:173: Test failed: expected space
batch.c:173: Test failed: expected space
batch.c:173: Test failed: expected space
batch.c:173: Test failed: expected space
batch.c:173: Test failed: expected space
batch.c:173: Test failed: expected space
batch.c:173: Test failed: expected space
batch.c:173: Test failed: expected space

=== W2K3R2SESP2 (32 bit batch) ===
batch.c:173: Test failed: expected space
batch.c:173: Test failed: expected space
batch.c:173: Test failed: expected space
batch.c:173: Test failed: expected space
batch.c:173: Test failed: expected space
batch.c:173: Test failed: expected space
batch.c:173: Test failed: expected space
batch.c:173: Test failed: expected space
batch.c:173: Test failed: expected space
batch.c:173: Test failed: expected space
batch.c:173: Test failed: expected space

=== WVISTAADM (32 bit batch) ===
batch.c:173: Test failed: expected space
batch.c:173: Test failed: expected space
batch.c:173: Test failed: expected space
batch.c:173: Test failed: expected space
batch.c:173: Test failed: expected space
batch.c:173: Test failed: expected space
batch.c:173: Test failed: expected space
batch.c:173: Test failed: expected space
batch.c:173: Test failed: expected space
batch.c:173: Test failed: expected space
batch.c:173: Test failed: expected space

=== W2K8SE (32 bit batch) ===
batch.c:173: Test failed: expected space
batch.c:173: Test failed: expected space
batch.c:173: Test failed: expected space
batch.c:173: Test failed: expected space
batch.c:173: Test failed: expected space
batch.c:173: Test failed: expected space
batch.c:173: Test failed: expected space
batch.c:173: Test failed: expected space
batch.c:173: Test failed: expected space
batch.c:173: Test failed: expected space
batch.c:173: Test failed: expected space

=== W7PRO (32 bit batch) ===
batch.c:173: Test failed: expected space
batch.c:173: Test failed: expected space
batch.c:173: Test failed: expected space
batch.c:173: Test failed: expected space
batch.c:173: Test failed: expected space
batch.c:173: Test failed: expected space
batch.c:173: Test failed: expected space
batch.c:173: Test failed: expected space
batch.c:173: Test failed: expected space
batch.c:173: Test failed: expected space
batch.c:173: Test failed: expected space

=== W7PROX64 (32 bit batch) ===
batch.c:173: Test failed: expected space
batch.c:173: Test failed: expected space
batch.c:173: Test failed: expected space
batch.c:173: Test failed: expected space
batch.c:173: Test failed: expected space
batch.c:173: Test failed: expected space
batch.c:173: Test failed: expected space
batch.c:173: Test failed: expected space
batch.c:173: Test failed: expected space
batch.c:173: Test failed: expected space
batch.c:173: Test failed: expected space

=== W7PROX64 (64 bit batch) ===
batch.c:173: Test failed: expected space
batch.c:173: Test failed: expected space
batch.c:173: Test failed: expected space
batch.c:173: Test failed: expected space
batch.c:173: Test failed: expected space
batch.c:173: Test failed: expected space
batch.c:173: Test failed: expected space
batch.c:173: Test failed: expected space
batch.c:173: Test failed: expected space
batch.c:173: Test failed: expected space
batch.c:173: Test failed: expected space




Re: ddraw: Add tests for SetCooperativeLevel with a NULL window

2010-11-01 Thread Marvin
Hi,

While running your changed tests on Windows, I think I found new failures.
Being a bot and all I'm not very good at pattern recognition, so I might be
wrong, but could you please double-check?
Full results can be found at
http://testbot.winehq.org/JobDetails.pl?Key=6682

Your paranoid android.


=== W98SE (32 bit ddrawmodes) ===
ddrawmodes: unhandled exception c005 at 004122E8

=== W7PROX64 (64 bit ddrawmodes) ===
Timeout




Re: [PATCH 1/3] winmm: mciSendString always returns a response string (albeit empty). [resend]

2010-11-01 Thread Marvin
Hi,

While running your changed tests on Windows, I think I found new failures.
Being a bot and all I'm not very good at pattern recognition, so I might be
wrong, but could you please double-check?
Full results can be found at
http://testbot.winehq.org/JobDetails.pl?Key=6679

Your paranoid android.


=== W98SE (32 bit mci) ===
mci.c:846: Test failed: Expect message 0001 from play to 250 wait notify
mci.c:853: Test failed: got 0004 instead of MCI_NOTIFY_xyz  from command 
after close




Re: [PATCH 2/2] hlink: Site data should only be set if the hlink has an HlinkSite

2010-11-01 Thread Marvin
Hi,

While running your changed tests on Windows, I think I found new failures.
Being a bot and all I'm not very good at pattern recognition, so I might be
wrong, but could you please double-check?
Full results can be found at
http://testbot.winehq.org/JobDetails.pl?Key=6677

Your paranoid android.


=== W2K8SE (32 bit htmldoc) ===
htmldoc.c:2241: Test failed: unexpected call UpdateUI
htmldoc.c:2466: Test failed: unexpected call Exec_UPDATECOMMANDS




Re: Transparent windows

2010-11-01 Thread Vincent Povirk
It is probably a layered window, in which case the following functions
in user32 are relevant: SetLayeredWindowAttributes,
GetLayeredWindowAttributes, UpdateLayeredWindowIndirect, and
UpdateLayeredWindow

Most of user32 is implemented based on gdi32, wineserver, and
winex11.drv. When you see USER_Driver in user32, that indicates a
function in winex11.drv. So USER_Driver->pSetLayeredWindowAttributes
is really X11DRV_SetLayeredWindowAttributes.

Wine requires a compositing window manager to implement layered
windows properly. It does not matter whether the window manager
provides any 3D effects or uses opengl.




Transparent windows

2010-11-01 Thread Vassilis Virvilis

Hi everybody,

I am trying to run a pretty complex dotnet (3.5) app which renders flash 
contents via flash in a box http://www.f-in-box.com/

I have to say that congratulations are in order to everybody involved because 
the whole thing works remarkably well for such a complex amalgam of 
technologies and platforms.

The problem I am trying to debug right now is that transparent windows comes 
out black in wine. So the question is:
1) What are the wine debug channels I have to turn on in order to understand 
what's happening?
2) Any ideas where the code responsible might be located (gdi, user32, 
wineserver)?
2a) Is it some window creation flag responsible for this?
2b) Is it X-Window dependent? Does it require OpenGL and 3D effects 
enabled?

Thanks in advance

 .bill





Re: include: Add new Button control styles

2010-11-01 Thread Nikolay Sivov

On 11/2/2010 01:45, André Hentschel wrote:

BS_TYPEMASK is already defined some lines above that
---
  include/winuser.h |6 +-
  1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/include/winuser.h b/include/winuser.h
index 4114756..e04e8ad 100644
--- a/include/winuser.h
+++ b/include/winuser.h
@@ -712,8 +712,12 @@ typedef struct tagWINDOWPLACEMENT
  #define BS_GROUPBOX0x0007L
  #define BS_USERBUTTON  0x0008L
  #define BS_AUTORADIOBUTTON 0x0009L
+#define BS_PUSHBOX 0x000AL
  #define BS_OWNERDRAW   0x000BL
-#define BS_TYPEMASK0x000FL
+#define BS_SPLITBUTTON 0x000CL
+#define BS_DEFSPLITBUTTON  0x000DL
+#define BS_COMMANDLINK 0x000EL
+#define BS_DEFCOMMANDLINK  0x000FL
  #define BS_LEFTTEXT0x0020L
  #define BS_RIGHTBUTTON BS_LEFTTEXT


New styles should go to commctrl.h, and you can't remove BS_TYPEMASK.




Re: [RFC] cmd: Add a space at the end of the first echo'ed batch line [try5]

2010-11-01 Thread Jacek Caban

Hi Alexandre,

On 11/1/10 4:23 PM, GOUJON Alexandre wrote:

+/* Substitute escaped spaces with real ones */
+static char* replace_escaped_spaces(const char *data, DWORD size, DWORD 
*new_size)


Why do you need this? AFAICS the change to compare_line should be enough.

Jacek




Re: [PATCH 1/3] winmm: mciSendString always returns a response string (albeit empty).

2010-11-01 Thread Marvin
Hi,

While running your changed tests on Windows, I think I found new failures.
Being a bot and all I'm not very good at pattern recognition, so I might be
wrong, but could you please double-check?
Full results can be found at
http://testbot.winehq.org/JobDetails.pl?Key=

Your paranoid android.


=== WINEBUILD (build) ===
Patch failed to apply

=== W98SE (32 bit mci) ===
mci.c:903: Test failed: not enough time elapsed 58ms
mci.c:959: Test failed: mci status position: 58
mci.c:1006: Test failed: mci pause wait returned MMSYSERR 5
mci.c:1020: Test failed: mci pause (space) wait returned MMSYSERR 5
mci.c:1023: Test failed: mci pause wait returned MMSYSERR 5
mci.c:1037: Test failed: Expect message 0004 from play (aborted by close)




Re: [PATCH 2/3] winmm: MCI_SYSINFO doesn't change the output buffer in case of error.

2010-11-01 Thread Marvin
Hi,

While running your changed tests on Windows, I think I found new failures.
Being a bot and all I'm not very good at pattern recognition, so I might be
wrong, but could you please double-check?
Full results can be found at
http://testbot.winehq.org/JobDetails.pl?Key=6667

Your paranoid android.


=== WINEBUILD (build) ===
Patch failed to apply

=== W98SE (32 bit mci) ===
mci.c:959: Test failed: mci status position: 70
mci.c:1006: Test failed: mci pause wait returned MMSYSERR 5
mci.c:1020: Test failed: mci pause (space) wait returned MMSYSERR 5
mci.c:1023: Test failed: mci pause wait returned MMSYSERR 5
mci.c:1037: Test failed: Expect message 0004 from play (aborted by close)




Re: [PATCH 3/3] winmm: MCI_INFO doesn't change the output buffer in case of error.

2010-11-01 Thread Marvin
Hi,

While running your changed tests on Windows, I think I found new failures.
Being a bot and all I'm not very good at pattern recognition, so I might be
wrong, but could you please double-check?
Full results can be found at
http://testbot.winehq.org/JobDetails.pl?Key=6668

Your paranoid android.


=== WINEBUILD (build) ===
Patch failed to apply

=== W98SE (32 bit mci) ===
mci.c:835: Test failed: Expect message 0001 from play to 250 wait notify
mci.c:842: Test failed: got 0004 instead of MCI_NOTIFY_xyz  from command 
after close
mci.c:903: Test failed: not enough time elapsed 58ms




Re: Problems with Test

2010-11-01 Thread Hin-Tak Leung

--- On Mon, 1/11/10, James Mckenzie  wrote:

> From: James Mckenzie 
> Subject: Re: Problems with Test
> To: "Charles Davis" 
> Cc: "wine-devel@winehq.org" 
> Date: Monday, 1 November, 2010, 14:26
> Charles Davis 
> wrote:
> >
> >On 10/31/10 9:23 PM, James McKenzie wrote:
> >> All:
> >> 
> >> I'm trying to convert one integer number using a
> float number factor. 
> >> Here is the code:
> >> 
> >> int ry = 125;
> >> double ryf;
> >> 
> >> ryf = ry/1440;


> Got it.  I tried to cast ry to double, but that did
> not work.  Guess my version of gcc has a problem or I
> did it wrong.


 - ryf = ((double) ry)/1440; - should work#
 - ryf = (double) ry/1440;   - does not work, because it is equivalent to
   "(double) (ry/1440) " (still integer division). 

So it depends on how you did cast, really.








  




Re: [RFC] cmd: Add a space at the end of the first echo'ed batch line [try5]

2010-11-01 Thread Dmitry Timoshkov
GOUJON Alexandre  wrote:

> On 11/01/2010 03:12 PM, Vitaliy Margolen wrote:
> >> +static const char escaped_space[] = "@space@";
> >> +DWORD len_space = strlen(escaped_space);
> > The better way to calculate size of a static string, which is a 
> > compile time calculation. strlen() call is a runtime.
> The better way is ... ?
> In compare_line(), sizeof(space_cmd) is used but I guess 
> sizeof(space_cmd/space_cmd[0]) is more portable, isn't it ?
> I thought strlen() was optimized in that case because used with a const 
> string.

Only if you expect that a compiler knows what strlen() is. Better to not rely
on internal compiler knowledge.

> >> +static char* replace_escaped_spaces(const char *data, DWORD size, 
> >> DWORD *new_size)
> >> +char *a, *b, *new_data;
> >> +a = b = (char*)data;
> > a, b should be "const char*" as well.
> Unfortunately, I can't do that : strncpy and HeapFree complains about 
> const strings.

In general never cast away const. I don't see where you are using 'a' or 'b'
in strncpy() or HeapFree() as a target pointer that prevents making them const,
only 'new_data' needs to be non-const.

> +a = b += len_space;

This is absolutely unreadable.

Also if you could add some spaces around '+'/'-'/'=' in the cases below it 
would improve
readability as well:

> +*new_size=0;

> +strncpy(new_data+*new_size, a, b-a+1);
> +*new_size += b-a +1;
> +new_data[*new_size-1] = ' ';

> +strncpy(new_data+*new_size, a, strlen(a)+1);

etc.

-- 
Dmitry.




Re: [RFC] cmd: Add a space at the end of the first echo'ed batch line [try5]

2010-11-01 Thread GOUJON Alexandre

On 11/01/2010 03:12 PM, Vitaliy Margolen wrote:

+static const char escaped_space[] = "@space@";
+DWORD len_space = strlen(escaped_space);
The better way to calculate size of a static string, which is a 
compile time calculation. strlen() call is a runtime.

The better way is ... ?
In compare_line(), sizeof(space_cmd) is used but I guess 
sizeof(space_cmd/space_cmd[0]) is more portable, isn't it ?
I thought strlen() was optimized in that case because used with a const 
string.


+static char* replace_escaped_spaces(const char *data, DWORD size, 
DWORD *new_size)

+char *a, *b, *new_data;
+a = b = (char*)data;

a, b should be "const char*" as well.
Unfortunately, I can't do that : strncpy and HeapFree complains about 
const strings.



+new_data = (char*)malloc(size*sizeof(char));

Don't use malloc in Wine. Use HeapAlloc & co.
This is not c++, don't need to typecast (void*) pointer.

Got it.
I'll remember this for next times.

I modified my patch according to your suggestions.
I also changed the way I update new_data to simply return it (more 
understandable, I think).

Can you review it again, please ?


Vitaliy.

Many thanks, I'm avoiding try[6-9] with your advices !!

diff --git a/programs/cmd/tests/batch.c b/programs/cmd/tests/batch.c
index cc8c020..977cf29 100644
--- a/programs/cmd/tests/batch.c
+++ b/programs/cmd/tests/batch.c
@@ -25,6 +25,35 @@
 static char workdir[MAX_PATH];
 static DWORD workdir_len;
 
+/* Substitute escaped spaces with real ones */
+static char* replace_escaped_spaces(const char *data, DWORD size, DWORD *new_size)
+{
+static const char escaped_space[] = {'@','s','p','a','c','e','@'};
+char *a, *b, *new_data;
+DWORD len_space = sizeof(escaped_space);
+
+a = b = (char *)data;
+*new_size=0;
+
+new_data = HeapAlloc(GetProcessHeap(), 0, size*sizeof(char));
+ok(new_data != NULL, "malloc failed\n");
+if(!new_data)
+return NULL;
+
+while( (b = strstr(a, escaped_space)) )
+{
+strncpy(new_data+*new_size, a, b-a+1);
+*new_size += b-a +1;
+new_data[*new_size-1] = ' ';
+a = b += len_space;
+}
+
+strncpy(new_data+*new_size, a, strlen(a)+1);
+*new_size += strlen(a);
+
+return new_data;
+}
+
 static BOOL run_cmd(const char *cmd_data, DWORD cmd_size)
 {
 SECURITY_ATTRIBUTES sa = {sizeof(sa), 0, TRUE};
@@ -113,6 +142,7 @@ static const char *compare_line(const char *out_line, const char *out_end, const
 
 static const char pwd_cmd[] = {'@','p','w','d','@'};
 static const char todo_space_cmd[] = {'@','t','o','d','o','_','s','p','a','c','e','@'};
+static const char space_cmd[] = {'@','s','p','a','c','e','@'};
 static const char or_broken_cmd[] = {'@','o','r','_','b','r','o','k','e','n','@'};
 
 while(exp_ptr < exp_end) {
@@ -135,6 +165,13 @@ static const char *compare_line(const char *out_line, const char *out_end, const
 if(out_ptr < out_end && *out_ptr == ' ')
 out_ptr++;
 continue;
+}else if(exp_ptr+sizeof(space_cmd) <= exp_end
+&& !memcmp(exp_ptr, space_cmd, sizeof(space_cmd))) {
+exp_ptr += sizeof(space_cmd);
+ok(*out_ptr == ' ', "expected space\n");
+if(out_ptr < out_end && *out_ptr == ' ')
+out_ptr++;
+continue;
 }else if(exp_ptr+sizeof(or_broken_cmd) <= exp_end
  && !memcmp(exp_ptr, or_broken_cmd, sizeof(or_broken_cmd))) {
 exp_ptr = exp_end;
@@ -200,10 +237,15 @@ static void test_output(const char *out_data, DWORD out_size, const char *exp_da
 static void run_test(const char *cmd_data, DWORD cmd_size, const char *exp_data, DWORD exp_size)
 {
 const char *out_data;
-DWORD out_size;
+char *actual_cmd_data;
+DWORD out_size, actual_cmd_size;
 
-if(!run_cmd(cmd_data, cmd_size))
-return;
+actual_cmd_data = replace_escaped_spaces(cmd_data, cmd_size, &actual_cmd_size);
+if(!actual_cmd_size || !actual_cmd_data)
+goto cleanup;
+
+if(!run_cmd(actual_cmd_data, actual_cmd_size))
+goto cleanup;
 
 out_size = map_file("test.out", &out_data);
 if(out_size) {
@@ -212,6 +254,9 @@ static void run_test(const char *cmd_data, DWORD cmd_size, const char *exp_data,
 }
 DeleteFileA("test.out");
 DeleteFileA("test.err");
+
+cleanup:
+HeapFree(GetProcessHeap(), 0, actual_cmd_data);
 }
 
 static void run_from_file(char *file_name)
diff --git a/programs/cmd/tests/test_builtins.cmd b/programs/cmd/tests/test_builtins.cmd
index d9f5cf7..375b7a1 100644
--- a/programs/cmd/tests/test_builtins.cmd
+++ b/programs/cmd/tests/test_builtins.cmd
@@ -1,7 +1,21 @@
 echo Tests for cmd's builtin commands
-...@echo off
 
-echo  Testing 'echo' --
+...@echo on
+echo  Testing 'echo' [ON] --
+echo word
+echo 'singlequotedword'
+echo "doublequotedword"
+...@echo at-ec

Re: Problems with Test

2010-11-01 Thread James Mckenzie
Charles Davis  wrote:
>
>On 10/31/10 9:23 PM, James McKenzie wrote:
>> All:
>> 
>> I'm trying to convert one integer number using a float number factor. 
>> Here is the code:
>> 
>> int ry = 125;
>> double ryf;
>> 
>> ryf = ry/1440;
>> 
>> The result is 0 and should be 0.067 (or even more sixes.)
>And why should it be? None of the values in the expression 'ry/1440' are
>of type 'double'. They're both 'int's, so the compiler sees it as
>integer division instead of FP division. The C language spec doesn't
>require the compiler to infer that you wanted FP division when you
>assign to a variable of FP type.

Ah, the wonders of 'c'.  Thank you for the reminder that this is what happens 
during this division process.  Been a long time since I've tried this.
>
>> What am I doing 'incorrectly'?
>Now, if your assignment looked like this:
>
>ryf = ry/1440.0;
>
>then it would work correctly. Now the 1440 is of type 'double', so the
>compiler emits a floating-point division.
>
Got it.  I tried to cast ry to double, but that did not work.  Guess my version 
of gcc has a problem or I did it wrong.

Will try changing the division this evening and see what happens.

James McKenzie





Re: [RFC] cmd: Add a space at the end of the first echo'ed batch line [try5]

2010-11-01 Thread Vitaliy Margolen

On 11/01/2010 07:37 AM, GOUJON Alexandre wrote:

Hi everyone,

I'm trying to fix the wine cmd behavior but as this 5th try differs greatly
with the previous one, I'd like to have some feedback before submitting it.

If you have any question, just let me know.
Thanks is advance.




+static const char escaped_space[] = "@space@";
+DWORD len_space = strlen(escaped_space);
The better way to calculate size of a static string, which is a compile time 
calculation. strlen() call is a runtime.

You should move declaration from compare_line() and use it instead here.


+static char* replace_escaped_spaces(const char *data, DWORD size, DWORD 
*new_size)
+char *a, *b, *new_data;
+a = b = (char*)data;

a, b should be "const char*" as well.


+new_data = (char*)malloc(size*sizeof(char));

Don't use malloc in Wine. Use HeapAlloc & co.
This is not c++, don't need to typecast (void*) pointer.


+new_size += b-a +1;

You are modifying the new_size pointer instead of value it points to.



+if(!run_cmd(actual_cmd_data, actual_cmd_size))
 return;

You leaking actual_cmd_data here.


+if(actual_cmd_data)
+free(actual_cmd_data);
Don't need to check if pointer is NULL before freeing it. free() and 
HeapFree() do that already.


Vitaliy.




[RFC] cmd: Add a space at the end of the first echo'ed batch line [try5]

2010-11-01 Thread GOUJON Alexandre

Hi everyone,

I'm trying to fix the wine cmd behavior but as this 5th try differs 
greatly with the previous one, I'd like to have some feedback before 
submitting it.


If you have any question, just let me know.
Thanks is advance.
diff --git a/programs/cmd/tests/batch.c b/programs/cmd/tests/batch.c
index cc8c020..7d598fd 100644
--- a/programs/cmd/tests/batch.c
+++ b/programs/cmd/tests/batch.c
@@ -25,6 +25,36 @@
 static char workdir[MAX_PATH];
 static DWORD workdir_len;
 
+/* Substitute escaped spaces with real ones */
+static char* replace_escaped_spaces(const char *data, DWORD size, DWORD *new_size)
+{
+static const char escaped_space[] = "@space@";
+char *a, *b, *new_data;
+DWORD len_space = strlen(escaped_space);
+
+a = b = (char*)data;
+*new_size=0;
+
+new_data = (char*)malloc(size*sizeof(char));
+ok(new_data != NULL, "malloc failed\n");
+if(!new_data)
+return NULL;
+
+while( (b = strstr(a, escaped_space)) )
+{
+new_size += b-a +1;
+strncpy(new_data, a, b-a+1);
+new_data[b-a] = ' ';
+new_data += b-a+1;
+a = b += len_space;
+}
+
+*new_size += strlen(a);
+strncpy(new_data, a, strlen(a)+1);
+
+return new_data-*new_size+strlen(a);
+}
+
 static BOOL run_cmd(const char *cmd_data, DWORD cmd_size)
 {
 SECURITY_ATTRIBUTES sa = {sizeof(sa), 0, TRUE};
@@ -113,6 +143,7 @@ static const char *compare_line(const char *out_line, const char *out_end, const
 
 static const char pwd_cmd[] = {'@','p','w','d','@'};
 static const char todo_space_cmd[] = {'@','t','o','d','o','_','s','p','a','c','e','@'};
+static const char space_cmd[] = {'@','s','p','a','c','e','@'};
 static const char or_broken_cmd[] = {'@','o','r','_','b','r','o','k','e','n','@'};
 
 while(exp_ptr < exp_end) {
@@ -135,6 +166,13 @@ static const char *compare_line(const char *out_line, const char *out_end, const
 if(out_ptr < out_end && *out_ptr == ' ')
 out_ptr++;
 continue;
+}else if(exp_ptr+sizeof(space_cmd) <= exp_end
+&& !memcmp(exp_ptr, space_cmd, sizeof(space_cmd))) {
+exp_ptr += sizeof(space_cmd);
+ok(*out_ptr == ' ', "expected space\n");
+if(out_ptr < out_end && *out_ptr == ' ')
+out_ptr++;
+continue;
 }else if(exp_ptr+sizeof(or_broken_cmd) <= exp_end
  && !memcmp(exp_ptr, or_broken_cmd, sizeof(or_broken_cmd))) {
 exp_ptr = exp_end;
@@ -200,9 +238,14 @@ static void test_output(const char *out_data, DWORD out_size, const char *exp_da
 static void run_test(const char *cmd_data, DWORD cmd_size, const char *exp_data, DWORD exp_size)
 {
 const char *out_data;
-DWORD out_size;
+char *actual_cmd_data;
+DWORD out_size, actual_cmd_size;
 
-if(!run_cmd(cmd_data, cmd_size))
+actual_cmd_data = replace_escaped_spaces(cmd_data, cmd_size, &actual_cmd_size);
+if(!actual_cmd_size || !actual_cmd_data)
+goto cleanup;
+
+if(!run_cmd(actual_cmd_data, actual_cmd_size))
 return;
 
 out_size = map_file("test.out", &out_data);
@@ -212,6 +255,10 @@ static void run_test(const char *cmd_data, DWORD cmd_size, const char *exp_data,
 }
 DeleteFileA("test.out");
 DeleteFileA("test.err");
+
+cleanup:
+if(actual_cmd_data)
+free(actual_cmd_data);
 }
 
 static void run_from_file(char *file_name)
diff --git a/programs/cmd/tests/test_builtins.cmd b/programs/cmd/tests/test_builtins.cmd
index d9f5cf7..375b7a1 100644
--- a/programs/cmd/tests/test_builtins.cmd
+++ b/programs/cmd/tests/test_builtins.cmd
@@ -1,7 +1,21 @@
 echo Tests for cmd's builtin commands
-...@echo off
 
-echo  Testing 'echo' --
+...@echo on
+echo  Testing 'echo' [ON] --
+echo word
+echo 'singlequotedword'
+echo "doublequotedword"
+...@echo at-echoed-word
+echo "/?"
+echo.
+echo .
+echo.word
+echo .word
+echo w...@space@
+echo w...@space@@space@
+
+...@echo off
+echo  Testing 'echo' [OFF] --
 echo word
 echo 'singlequotedword'
 echo "doublequotedword"
@@ -11,6 +25,8 @@ echo.
 echo .
 echo.word
 echo .word
+echo w...@space@
+echo w...@space@@space@
 
 echo  Testing 'set' --
 echo set "FOO=bar" should not include the quotes in the variable value
diff --git a/programs/cmd/tests/test_builtins.cmd.exp b/programs/cmd/tests/test_builtins.cmd.exp
index 8942cb3..dee2c5b 100644
--- a/programs/cmd/tests/test_builtins.cmd.exp
+++ b/programs/cmd/tests/test_builtins.cmd.exp
@@ -1,7 +1,41 @@
 
-...@pwd@>echo Tests for cmd's builtin comma...@todo_space@
+...@pwd@>echo Tests for cmd's builtin comma...@space@
 Tests for cmd's builtin commands
- Testing 'echo' --
+
+...@pwd@>echo  Testing 'echo' [ON] ---...@space@
+ Testing 'echo' [ON] --
+
+...@pwd@>echo w...@spac

Re: [try 2] crypt32/tests: Add tests for enveloped messages.

2010-11-01 Thread Marvin
Hi,

While running your changed tests on Windows, I think I found new failures.
Being a bot and all I'm not very good at pattern recognition, so I might be
wrong, but could you please double-check?
Full results can be found at
http://testbot.winehq.org/JobDetails.pl?Key=6658

Your paranoid android.


=== WNT4WSSP6 (32 bit msg) ===
msg: unhandled exception c005 at 5CF308F4




[do not apply] Re: crypt32/tests: Add tests for enveloped messages.

2010-11-01 Thread Alexander Morozov
Please do not apply this patch. Use [try 2]




Re: [PATCH 2/2] comdlg32/tests: Add GetSaveFileName extension tests.

2010-11-01 Thread Marvin
Hi,

While running your changed tests on Windows, I think I found new failures.
Being a bot and all I'm not very good at pattern recognition, so I might be
wrong, but could you please double-check?
Full results can be found at
http://testbot.winehq.org/JobDetails.pl?Key=6657

Your paranoid android.


=== W98SE (32 bit filedlg) ===
filedlg.c:1094: Test failed: Filename is beef.txt, expected deadbeef

=== WNT4WSSP6 (32 bit filedlg) ===
filedlg.c:1094: Test failed: Filename is beef.txt, expected deadbeef

=== W2KPROSP4 (32 bit filedlg) ===
filedlg.c:1094: Test failed: Filename is beef.txt, expected deadbeef

=== WXPPROSP3 (32 bit filedlg) ===
filedlg.c:1094: Test failed: Filename is beef.txt, expected deadbeef

=== W2K3R2SESP2 (32 bit filedlg) ===
filedlg.c:1094: Test failed: Filename is beef.txt, expected deadbeef

=== WVISTAADM (32 bit filedlg) ===
filedlg.c:1094: Test failed: Filename is beef.txt, expected deadbeef

=== W2K8SE (32 bit filedlg) ===
filedlg.c:1094: Test failed: Filename is beef.txt, expected deadbeef

=== W7PRO (32 bit filedlg) ===
filedlg.c:1094: Test failed: Filename is beef.txt, expected deadbeef

=== W7PROX64 (32 bit filedlg) ===
filedlg: unhandled exception c005 at 750B4C19

=== W7PROX64 (64 bit filedlg) ===
filedlg.c:1094: Test failed: Filename is beef.txt, expected deadbeef




Re: [4/4] d3d9: Add a sRGB format test

2010-11-01 Thread Henri Verbeet
On 1 November 2010 11:41, Stefan Dösinger  wrote:
>
> Am 01.11.2010 um 10:41 schrieb Henri Verbeet:
>
>> On 31 October 2010 22:53, Stefan Dösinger  wrote:
>>> +    static const struct
>>> +    {
>>> +        float x, y, z;
>>> +        float u, v;
>>> +    }
>>> +    quad[] =
>>> +    {
>>> +        {-1.0,   -1.0,   0.1,    0.0,    0.0},
>>> +        {-1.0,    1.0,   0.1,    1.0,    0.0},
>>> +        { 1.0,   -1.0,   0.1,    0.0,    1.0},
>>> +        { 1.0,    1.0,   0.1,    1.0,    1.0}
>>> +    };
>> Not that I care all that much, but notice that those literals are
>> actually doubles.
> Now that I've fixed a number of those I guess we should stick to caring about 
> that.
You should probably do the Clear()'s too then.




Re: [PATCH 2/4] include: Add macros for retrieving control message headers.

2010-11-01 Thread Alexandre Julliard
Erich Hoover  writes:

> @@ -185,6 +185,25 @@ VOID WINAPI GetAcceptExSockaddrs(PVOID, DWORD, DWORD, 
> DWORD, struct WS(sockaddr)
>  BOOL WINAPI TransmitFile(SOCKET, HANDLE, DWORD, DWORD, LPOVERLAPPED, 
> LPTRANSMIT_FILE_BUFFERS, DWORD);
>  INT  WINAPI WSARecvEx(SOCKET, char *, INT, INT *);
>  
> +/*
> + * Macros for retrieving control message data returned by WSARecvMsg()
> + */
> +#define WSA_CMSG_DATA(cmsg) ((UCHAR*)((WSACMSGHDR*)(cmsg)+1))
> +#define WSA_CMSG_FIRSTHDR(mhdr) \
> +((size_t) (mhdr)->Control.len >= sizeof(WSACMSGHDR)\
> + ? (WSACMSGHDR *) (mhdr)->Control.buf : (WSACMSGHDR *) 0)
> +#define WSA_CMSG_ALIGN(len) (((len) + sizeof (size_t) - 1) \
> + & (size_t) ~(sizeof (size_t) - 1))
> +static inline WSACMSGHDR *WSA_CMSG_NXTHDR(WSAMSG *msg, WSACMSGHDR *cmsg)
> +{
> +if ((size_t)(msg)->Control.len +cmsg = (WSACMSGHDR*)((unsigned char*)cmsg + 
> WSA_CMSG_ALIGN(cmsg->cmsg_len));
> +if ((unsigned char*)(cmsg+1) > ((unsigned char*)msg->Control.buf + 
> msg->Control.len)
> +|| ((unsigned char*)cmsg + WSA_CMSG_ALIGN(cmsg->cmsg_len) > 
> ((unsigned char *)msg->Control.buf + msg->Control.len)) )
> +return 0;
> +return cmsg;
> +}

This should go into ws2def.h. Also WSA_CMSG_NXTHDR is supposed to be a
macro, not an inline function.

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




Re: [4/4] d3d9: Add a sRGB format test

2010-11-01 Thread Henri Verbeet
On 31 October 2010 22:53, Stefan Dösinger  wrote:
> +static const struct
> +{
> +float x, y, z;
> +float u, v;
> +}
> +quad[] =
> +{
> +{-1.0,   -1.0,   0.1,0.0,0.0},
> +{-1.0,1.0,   0.1,1.0,0.0},
> +{ 1.0,   -1.0,   0.1,0.0,1.0},
> +{ 1.0,1.0,   0.1,1.0,1.0}
> +};
Not that I care all that much, but notice that those literals are
actually doubles.

> +hr = IDirect3DDevice9_DrawPrimitiveUP(device, 
> D3DPT_TRIANGLESTRIP, 2, quad, sizeof(float) * 5);
Now that you're using a proper structure for "quad", "sizeof(float) *
5" is really just the same as "sizeof(*quad)".