*** cairo-1.10.2/test/cairo-test.c 2010-07-12 01:57:03.000000000 -0700 --- cairo-1.10.2.new/test/cairo-test.c 2011-02-08 12:36:44.682423300 -0800 *************** *** 73,78 **** --- 73,79 ---- #ifdef _MSC_VER #include + #include #define vsnprintf _vsnprintf #define access _access #define F_OK 0 *************** *** 322,330 **** --- 323,355 ---- static void _xunlink (const cairo_test_context_t *ctx, const char *pathname) { + #ifdef _WIN32 + if (!DeleteFileA (pathname)) { + void *lpMsgBuf; + DWORD last_error = GetLastError (); + if (ERROR_FILE_NOT_FOUND == last_error) + return; + + if (!FormatMessageW (FORMAT_MESSAGE_ALLOCATE_BUFFER | + FORMAT_MESSAGE_FROM_SYSTEM, + NULL, + last_error, + MAKELANGID (LANG_NEUTRAL, SUBLANG_DEFAULT), + (LPWSTR) &lpMsgBuf, + 0, NULL)) { + cairo_test_log (ctx, "Error: Cannot remove %s: %s\n", + pathname, strerror (errno)); + } else { + fwprintf (stderr, L"Error: Cannot remove %s: %S", pathname, + (wchar_t *)lpMsgBuf); + + LocalFree (lpMsgBuf); + } + #else if (unlink (pathname) < 0 && errno != ENOENT) { cairo_test_log (ctx, "Error: Cannot remove %s: %s\n", pathname, strerror (errno)); + #endif exit (1); } }