Hugh McMaster hugh.mcmaster@outlook.com wrote:
- INT start,end;
- unsigned short start, end;
This can't work.
On Thursday, 17 Dec 2015 18:55:23 +0800, Dmitry Timoshkov wrote:
Hugh McMaster wrote:
- INT start,end;
- unsigned short start, end;
This can't work.
In this case it does - but it is a technicality.
MSDN says typedef unsigned short WORD; but I should have used unsigned int here, as we cast to WPARAM / UINT_PTR.
Hugh McMaster hugh.mcmaster@outlook.com wrote:
Hugh McMaster wrote:
- INT start,end;
- unsigned short start, end;
This can't work.
In this case it does - but it is a technicality.
MSDN says typedef unsigned short WORD; but I should have used unsigned int here, as we cast to WPARAM / UINT_PTR.
It doesn't matter what MSDN says or to what the code does the cast to. What matters is what the other side does with the passed in pointers.
On Thursday, 17 Dec 2015 19:26:53 +0800, Dmitry Timoshkov wrote:
Hugh McMaster wrote:
Hugh McMaster wrote:
- INT start,end;
- unsigned short start, end;
This can't work.
In this case it does - but it is a technicality.
MSDN says typedef unsigned short WORD; but I should have used unsigned int here, as we cast to WPARAM / UINT_PTR.
It doesn't matter what MSDN says or to what the code does the cast to. What matters is what the other side does with the passed in pointers.
Perhaps I'm misunderstanding your point.
+ok(LOWORD(len)==start, "Unexpected start position for selection; got %u, expected 0\n", LOWORD(len));
It is a comparison between an unsigned short and unsigned int. Do you want the change to unsigned int or not?
Hugh McMaster hugh.mcmaster@outlook.com wrote:
Hugh McMaster wrote:
- INT start,end;
- unsigned short start, end;
This can't work.
In this case it does - but it is a technicality.
MSDN says typedef unsigned short WORD; but I should have used unsigned int here, as we cast to WPARAM / UINT_PTR.
It doesn't matter what MSDN says or to what the code does the cast to. What matters is what the other side does with the passed in pointers.
Perhaps I'm misunderstanding your point.
My point is that if you use 'short' the user32 code will corrupt local variables when it writes to a passed in pointer.
+ok(LOWORD(len)==start, "Unexpected start position for selection; got %u, expected 0\n", LOWORD(len));
It is a comparison between an unsigned short and unsigned int. Do you want the change to unsigned int or not?
Personally I don't see any point in changing existing types. Win32 API is full of wrong or mismatching signed/unsigned types used by the callee and the caller sides.