summaryrefslogtreecommitdiff
path: root/librabbitmq/amqp_table.c
diff options
context:
space:
mode:
authorDavid Wragg <dpw@lshift.net>2010-05-30 23:31:40 +0100
committerDavid Wragg <dpw@lshift.net>2010-05-30 23:31:40 +0100
commit66a0a987914626fc0ea86067a0ea1dd7a2bebdd2 (patch)
tree0e400acdd2e7f35ed47b94d51308b142e82dbeac /librabbitmq/amqp_table.c
parent7e8fbea4c9212774c101e33218d26a0dc992dc03 (diff)
downloadrabbitmq-c-github-ask-66a0a987914626fc0ea86067a0ea1dd7a2bebdd2.tar.gz
Make error codes returned by librabbitmq functions opaque
Windows doesn't generally use POSIX error codes, which poses a problem for librabbitmq's approach of using those error codes in its API. So make the librabbitmq error codes opaque: They are still be integers, but client code is not supposed to assume anything about them, except that they can be passed to a new amqp_error_string() function which returns the corresponding error message Internally, the error codes are either taken from a set of librabbitmq-specific values, or correspond to an OS-specific (POSIX or win32) error code, with a simple encoding to indicate which is which.
Diffstat (limited to 'librabbitmq/amqp_table.c')
-rw-r--r--librabbitmq/amqp_table.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/librabbitmq/amqp_table.c b/librabbitmq/amqp_table.c
index 25c5932..db45588 100644
--- a/librabbitmq/amqp_table.c
+++ b/librabbitmq/amqp_table.c
@@ -86,7 +86,7 @@ static int amqp_decode_array(amqp_bytes_t encoded,
int limit;
if (entries == NULL) {
- return -ENOMEM;
+ return -ERROR_NO_MEMORY;
}
offset += 4;
@@ -99,7 +99,7 @@ static int amqp_decode_array(amqp_bytes_t encoded,
newentries = realloc(entries, allocated_entries * sizeof(amqp_field_value_t));
if (newentries == NULL) {
free(entries);
- return -ENOMEM;
+ return -ERROR_NO_MEMORY;
}
entries = newentries;
}
@@ -117,7 +117,7 @@ static int amqp_decode_array(amqp_bytes_t encoded,
if (output->entries == NULL && num_entries > 0) {
/* NULL is legitimate if we requested a zero-length block. */
free(entries);
- return -ENOMEM;
+ return -ERROR_NO_MEMORY;
}
memcpy(output->entries, entries, num_entries * sizeof(amqp_field_value_t));
@@ -140,7 +140,7 @@ int amqp_decode_table(amqp_bytes_t encoded,
int limit;
if (entries == NULL) {
- return -ENOMEM;
+ return -ERROR_NO_MEMORY;
}
offset += 4;
@@ -159,7 +159,7 @@ int amqp_decode_table(amqp_bytes_t encoded,
newentries = realloc(entries, allocated_entries * sizeof(amqp_table_entry_t));
if (newentries == NULL) {
free(entries);
- return -ENOMEM;
+ return -ERROR_NO_MEMORY;
}
entries = newentries;
}
@@ -182,7 +182,7 @@ int amqp_decode_table(amqp_bytes_t encoded,
if (output->entries == NULL && num_entries > 0) {
/* NULL is legitimate if we requested a zero-length block. */
free(entries);
- return -ENOMEM;
+ return -ERROR_NO_MEMORY;
}
memcpy(output->entries, entries, num_entries * sizeof(amqp_table_entry_t));
@@ -274,7 +274,7 @@ static int amqp_decode_field_value(amqp_bytes_t encoded,
case AMQP_FIELD_KIND_VOID:
break;
default:
- return -EINVAL;
+ return -ERROR_BAD_AMQP_DATA;
}
*offsetptr = offset;
@@ -410,7 +410,7 @@ static int amqp_encode_field_value(amqp_bytes_t encoded,
case AMQP_FIELD_KIND_VOID:
break;
default:
- return -EINVAL;
+ abort();
}
*offsetptr = offset;