[glib: 1/3] gstdio: Ensure w32_err_to_errno is used everywhere, add ERROR_INVALID_PARAMETER handling
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib: 1/3] gstdio: Ensure w32_err_to_errno is used everywhere, add ERROR_INVALID_PARAMETER handling
- Date: Wed, 3 Jul 2019 11:06:20 +0000 (UTC)
commit 04dcee181400228650236f17a475de42350cc6b7
Author: Jeremy Tan <jtanx outlook com>
Date: Mon Jun 17 19:13:31 2019 +1000
gstdio: Ensure w32_err_to_errno is used everywhere, add ERROR_INVALID_PARAMETER handling
case switches in w32_err_to_errno have been alphabetically sorted.
The only addition is the ERROR_INVALID_PARAMETER->EINVAL case.
glib/gstdio.c | 40 ++++++++++++++++++++--------------------
1 file changed, 20 insertions(+), 20 deletions(-)
---
diff --git a/glib/gstdio.c b/glib/gstdio.c
index 16df66bd2..16cf1805f 100644
--- a/glib/gstdio.c
+++ b/glib/gstdio.c
@@ -102,22 +102,35 @@ w32_error_to_errno (DWORD error_code)
case ERROR_ACCESS_DENIED:
return EACCES;
break;
- case ERROR_INVALID_HANDLE:
- return EBADF;
+ case ERROR_ALREADY_EXISTS:
+ case ERROR_FILE_EXISTS:
+ return EEXIST;
+ case ERROR_FILE_NOT_FOUND:
+ return ENOENT;
break;
case ERROR_INVALID_FUNCTION:
return EFAULT;
break;
- case ERROR_FILE_NOT_FOUND:
- return ENOENT;
+ case ERROR_INVALID_HANDLE:
+ return EBADF;
break;
- case ERROR_PATH_NOT_FOUND:
- return ENOENT; /* or ELOOP, or ENAMETOOLONG */
+ case ERROR_INVALID_PARAMETER:
+ return EINVAL;
+ break;
+ case ERROR_LOCK_VIOLATION:
+ case ERROR_SHARING_VIOLATION:
+ return EACCES;
break;
case ERROR_NOT_ENOUGH_MEMORY:
case ERROR_OUTOFMEMORY:
return ENOMEM;
break;
+ case ERROR_NOT_SAME_DEVICE:
+ return EXDEV;
+ break;
+ case ERROR_PATH_NOT_FOUND:
+ return ENOENT; /* or ELOOP, or ENAMETOOLONG */
+ break;
default:
return EIO;
break;
@@ -1154,20 +1167,7 @@ g_rename (const gchar *oldfilename,
else
{
retval = -1;
- switch (GetLastError ())
- {
-#define CASE(a,b) case ERROR_##a: save_errno = b; break
- CASE (FILE_NOT_FOUND, ENOENT);
- CASE (PATH_NOT_FOUND, ENOENT);
- CASE (ACCESS_DENIED, EACCES);
- CASE (NOT_SAME_DEVICE, EXDEV);
- CASE (LOCK_VIOLATION, EACCES);
- CASE (SHARING_VIOLATION, EACCES);
- CASE (FILE_EXISTS, EEXIST);
- CASE (ALREADY_EXISTS, EEXIST);
-#undef CASE
- default: save_errno = EIO;
- }
+ save_errno = w32_error_to_errno (GetLastError ());
}
g_free (woldfilename);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]