summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGravatar Martin Szulecki2013-09-21 16:21:11 +0200
committerGravatar Martin Szulecki2013-09-21 16:21:11 +0200
commit9459204b860eb6ede4375e24fd705dd81388b1ac (patch)
tree150d642242f97b8dbb624b037920475bf0541c5c /src
parent4d8ffd7c14cafd468e92c00eae7d0aac42fbbd23 (diff)
downloadlibirecovery-9459204b860eb6ede4375e24fd705dd81388b1ac.tar.gz
libirecovery-9459204b860eb6ede4375e24fd705dd81388b1ac.tar.bz2
Silence compiler warnings by returning proper error with irecv_control_transfer
Diffstat (limited to 'src')
-rw-r--r--src/libirecovery.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/libirecovery.c b/src/libirecovery.c
index 4ed69af..c7186a0 100644
--- a/src/libirecovery.c
+++ b/src/libirecovery.c
@@ -822,16 +822,18 @@ void irecv_set_debug_level(int level) {
822} 822}
823 823
824static irecv_error_t irecv_send_command_raw(irecv_client_t client, const char* command) { 824static irecv_error_t irecv_send_command_raw(irecv_client_t client, const char* command) {
825 int ret = 0;
826
825 unsigned int length = strlen(command); 827 unsigned int length = strlen(command);
826 if (length >= 0x100) { 828 if (length >= 0x100) {
827 length = 0xFF; 829 length = 0xFF;
828 } 830 }
829 831
830 if (length > 0) { 832 if (length > 0) {
831 int ret = irecv_control_transfer(client, 0x40, 0, 0, 0, (unsigned char*) command, length + 1, USB_TIMEOUT); 833 ret = irecv_control_transfer(client, 0x40, 0, 0, 0, (unsigned char*) command, length + 1, USB_TIMEOUT);
832 } 834 }
833 835
834 return IRECV_E_SUCCESS; 836 return ((unsigned)ret == (length + 1) ? IRECV_E_SUCCESS: IRECV_E_UNKNOWN_ERROR);
835} 837}
836 838
837irecv_error_t irecv_send_command(irecv_client_t client, const char* command) { 839irecv_error_t irecv_send_command(irecv_client_t client, const char* command) {
@@ -1103,7 +1105,8 @@ irecv_error_t irecv_getenv(irecv_client_t client, const char* variable, char** v
1103 ret = irecv_control_transfer(client, 0xC0, 0, 0, 0, (unsigned char*) response, 255, USB_TIMEOUT); 1105 ret = irecv_control_transfer(client, 0xC0, 0, 0, 0, (unsigned char*) response, 255, USB_TIMEOUT);
1104 1106
1105 *value = response; 1107 *value = response;
1106 return IRECV_E_SUCCESS; 1108
1109 return (ret > 0 ? IRECV_E_SUCCESS: IRECV_E_UNKNOWN_ERROR);
1107} 1110}
1108 1111
1109irecv_error_t irecv_getret(irecv_client_t client, unsigned int* value) { 1112irecv_error_t irecv_getret(irecv_client_t client, unsigned int* value) {
@@ -1120,7 +1123,8 @@ irecv_error_t irecv_getret(irecv_client_t client, unsigned int* value) {
1120 ret = irecv_control_transfer(client, 0xC0, 0, 0, 0, (unsigned char*) response, 255, USB_TIMEOUT); 1123 ret = irecv_control_transfer(client, 0xC0, 0, 0, 0, (unsigned char*) response, 255, USB_TIMEOUT);
1121 1124
1122 *value = (unsigned int) *response; 1125 *value = (unsigned int) *response;
1123 return IRECV_E_SUCCESS; 1126
1127 return (ret > 0 ? IRECV_E_SUCCESS: IRECV_E_UNKNOWN_ERROR);
1124} 1128}
1125 1129
1126irecv_error_t irecv_get_cpid(irecv_client_t client, unsigned int* cpid) { 1130irecv_error_t irecv_get_cpid(irecv_client_t client, unsigned int* cpid) {