[Box Backup-dev] COMMIT r779 - box/chris/general/test/backupdiff

Charles Lecklider boxbackup-dev@fluffy.co.uk
Sat, 19 Aug 2006 16:13:57 +0100


subversion@fluffy.co.uk wrote:
> Author: chris
> Date: 2006-08-19 13:25:52 +0100 (Sat, 19 Aug 2006)
> New Revision: 779
> 
> Modified:
>    box/chris/general/test/backupdiff/testbackupdiff.cpp
> Log:
> * testbackupdiff.cpp
> - Added debugging for failure to create sparse file for test

OK, I know this is debug code, but....

> Modified: box/chris/general/test/backupdiff/testbackupdiff.cpp
> ===================================================================
> --- box/chris/general/test/backupdiff/testbackupdiff.cpp	2006-08-11 08:50:28 UTC (rev 778)
> +++ box/chris/general/test/backupdiff/testbackupdiff.cpp	2006-08-19 12:25:52 UTC (rev 779)
> @@ -71,7 +71,12 @@
>  	TEST_THAT(handle != INVALID_HANDLE_VALUE);
>  	SetFilePointer(handle, size, NULL, FILE_BEGIN);

Why not just check for INVALID_SET_FILE_POINTER being returned here?

>  	TEST_THAT(GetLastError() == NO_ERROR);
> -	TEST_THAT(SetEndOfFile(handle) == true);

This should always fail; TRUE != true.

> +	bool result = SetEndOfFile(handle);

No! It's a BOOL, not a bool.

> +	if (!result)
> +	{
> +		printf("Error %d\n", (int)GetLastError());

What's wrong with %u and no cast?

> +	}
> +	TEST_THAT(result == true);
>  	TEST_THAT(CloseHandle(handle)  == true);

Should always fail; TRUE != true.



The latest PSDK has "typedef int BOOL;", so there's all sorts of
implicit conversions going on here, and for no good reason that I can see.

Sorry to jump on this, but it's indicative of the first round of
compiler warnings I'm still trying to find time to trawl through and fix
before I get started on the real work. No-one likes Microsoft for
inconsistent use of INVALID_HANDLE_VALUE and NULL, or BOOL, or any
number of other things, but that's the way it is....

-C