From c6553564a858a65a74c8727f08ae737c35b81a08 Mon Sep 17 00:00:00 2001 From: Jan-Marek Glogowski Date: Fri, 29 Nov 2019 16:07:55 +0100 Subject: WIN map ERROR_DIRECTORY to osl_File_E_NOTDIR The open_004 unit test fails on Windows with E_NOENT. I think the assert is correct, and it's better change the ERROR_DIRECTORY mapping, as FindFirstFileW returns ERROR_PATH_NOT_FOUND, if the path doesn't exists at all. The description of that error code in the MS API docs is "The directory name is invalid.". And obviously there is no way to tell, if this is actually a better mapping. Change-Id: Id122ce39e90f3562e70c96a06752e5b32ed55b41 Reviewed-on: https://gerrit.libreoffice.org/84070 Tested-by: Jenkins Reviewed-by: Mike Kaganski Reviewed-by: Jan-Marek Glogowski --- sal/osl/w32/file_error.cxx | 2 +- sal/qa/osl/file/osl_File.cxx | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) (limited to 'sal') diff --git a/sal/osl/w32/file_error.cxx b/sal/osl/w32/file_error.cxx index 5336c17fd970..27b0f90cbd2d 100644 --- a/sal/osl/w32/file_error.cxx +++ b/sal/osl/w32/file_error.cxx @@ -77,7 +77,7 @@ static const struct osl_file_error_entry errtable[] = { { ERROR_FILENAME_EXCED_RANGE, osl_File_E_NOENT }, /* 206 */ { ERROR_NESTING_NOT_ALLOWED, osl_File_E_AGAIN }, /* 215 */ { ERROR_FILE_CHECKED_OUT, osl_File_E_ACCES }, /* 220 */ - { ERROR_DIRECTORY, osl_File_E_NOENT }, /* 267 */ + { ERROR_DIRECTORY, osl_File_E_NOTDIR }, /* 267 */ { ERROR_NOT_ENOUGH_QUOTA, osl_File_E_NOMEM }, /* 1816 */ { ERROR_CANT_ACCESS_FILE, osl_File_E_ACCES }, /* 1920 */ { ERROR_UNEXP_NET_ERR, osl_File_E_NETWORK } /* 59 */ diff --git a/sal/qa/osl/file/osl_File.cxx b/sal/qa/osl/file/osl_File.cxx index 28f63b3055c3..31f15bc6a41f 100644 --- a/sal/qa/osl/file/osl_File.cxx +++ b/sal/qa/osl/file/osl_File.cxx @@ -4142,10 +4142,8 @@ namespace osl_Directory CPPUNIT_ASSERT_EQUAL(osl::FileBase::E_None, nError2); } -#ifndef _WIN32 // returns E_NOENT on Windows CPPUNIT_ASSERT_MESSAGE("test for open function: open a file instead of a directory", (osl::FileBase::E_NOTDIR == nError1) || (osl::FileBase::E_ACCES == nError1)); -#endif } CPPUNIT_TEST_SUITE(open); -- cgit