ref: 37b00ca12e572a0ce38d34cef1fa7afd399d2a85
parent: 51f6ebd39969366013a870a66cd26b62514ff113
author: Jean-Marc Valin <jmvalin@jmvalin.ca>
date: Thu May 18 20:19:20 EDT 2017
misc fixes
--- a/include/opusenc.h
+++ b/include/opusenc.h
@@ -135,8 +135,8 @@
/* FIXME: Add type-checking macros to these. */
#define OPE_SET_PACKET_CALLBACK(x,u) OPE_SET_PACKET_CALLBACK_REQUEST, (x), (u)
#define OPE_GET_PACKET_CALLBACK(x,u) OPE_GET_PACKET_CALLBACK_REQUEST, (x), (u)
-#define OPE_SET_HEADER_GAIN(x,u) OPE_SET_HEADER_GAIN_REQUEST, (x), (u)
-#define OPE_GET_HEADER_GAIN(x,u) OPE_GET_HEADER_GAIN_REQUEST, (x), (u)
+#define OPE_SET_HEADER_GAIN(x,u) OPE_SET_HEADER_GAIN_REQUEST, __opus_check_int(x)
+#define OPE_GET_HEADER_GAIN(x,u) OPE_GET_HEADER_GAIN_REQUEST, __opus_check_int_ptr(x)
/*@}*/
/*@}*/
--- a/src/opusenc.c
+++ b/src/opusenc.c
@@ -813,7 +813,9 @@
"invalid picture file",
"invalid icon file (pictures of type 1 MUST be 32x32 PNGs)"
};
- if (error > -30) return opus_strerror(error+10);
+ if (error == 0) return "success";
+ else if (error >= -10) return "unknown error";
+ else if (error > -30) return opus_strerror(error+10);
else if (error >= OPE_INVALID_ICON) return ope_error_strings[-error-30];
else return "unknown error";
}
--- a/src/picture.c
+++ b/src/picture.c
@@ -376,6 +376,8 @@
if(out!=NULL){
base64_encode(out,(char *)buf+data_offset,data_length);
if(picture_type>=1&&picture_type<=2)*seen_file_icons|=picture_type;
+ } else {
+ *error = OPE_ALLOC_FAIL;
}
free(buf);
return out;