diff options
author | Richard Hughes <richard@hughsie.com> | 2020-01-21 10:19:00 +0000 |
---|---|---|
committer | Richard Hughes <richard@hughsie.com> | 2020-01-21 10:33:11 +0000 |
commit | a281690f5b56faa29fe34fbce6f06813727ed503 (patch) | |
tree | 7519342ed45703e3db500fceb73e5cd7db4823f3 | |
parent | 8f5546bfc8cb45a4393123eb4df92894f9620026 (diff) | |
download | gusb-a281690f5b56faa29fe34fbce6f06813727ed503.tar.gz |
Wrap the upstream libusb_strerror()
We depend on a libusb to always define this.
-rw-r--r-- | gusb/gusb-util.c | 39 | ||||
-rw-r--r-- | gusb/gusb-util.h | 2 |
2 files changed, 2 insertions, 39 deletions
diff --git a/gusb/gusb-util.c b/gusb/gusb-util.c index c387752..f471337 100644 --- a/gusb/gusb-util.c +++ b/gusb/gusb-util.c @@ -11,45 +11,8 @@ #include "gusb-util.h" -/* libusb_strerror is not going upstream in the foreseeable future because of - i18n worries, provide our own implementation for now, later this can - hopefully became just a wrapper of the upstream version */ const gchar * g_usb_strerror (gint error_code) { - enum libusb_error error = error_code; - - switch (error) { - case LIBUSB_SUCCESS: - return "Success"; - case LIBUSB_ERROR_IO: - return "Input/output error"; - case LIBUSB_ERROR_INVALID_PARAM: - return "Invalid parameter"; - case LIBUSB_ERROR_ACCESS: - return "Access denied (insufficient permissions)"; - case LIBUSB_ERROR_NO_DEVICE: - return "No such device (it may have been disconnected)"; - case LIBUSB_ERROR_NOT_FOUND: - return "Entity not found"; - case LIBUSB_ERROR_BUSY: - return "Resource busy"; - case LIBUSB_ERROR_TIMEOUT: - return "Operation timed out"; - case LIBUSB_ERROR_OVERFLOW: - return "Overflow"; - case LIBUSB_ERROR_PIPE: - return "Pipe error"; - case LIBUSB_ERROR_INTERRUPTED: - return "System call interrupted (perhaps due to signal)"; - case LIBUSB_ERROR_NO_MEM: - return "Insufficient memory"; - case LIBUSB_ERROR_NOT_SUPPORTED: - return "Operation not supported or unimplemented on this platform"; - case LIBUSB_ERROR_OTHER: - return "Other error"; - default: - break; - } - return "Unknown error"; + return libusb_strerror (error_code); } diff --git a/gusb/gusb-util.h b/gusb/gusb-util.h index 0db697e..23664f5 100644 --- a/gusb/gusb-util.h +++ b/gusb/gusb-util.h @@ -11,6 +11,6 @@ G_BEGIN_DECLS -const gchar* g_usb_strerror(gint error_code); +const gchar *g_usb_strerror (gint error_code); G_END_DECLS |