const char *val_str;
char *dbg, *key;
+ if (!di) {
+ srd_err("Invalid decoder instance.");
+ return SRD_ERR_ARG;
+ }
+
+ if (!options) {
+ srd_err("Invalid options GHashTable.");
+ return SRD_ERR_ARG;
+ }
+
if (!PyObject_HasAttrString(di->decoder->py_dec, "options")) {
/* Decoder has no options. */
if (g_hash_table_size(options) == 0) {
* @return Pointer to a newly allocated struct srd_decoder_inst, or
* NULL in case of failure.
*
- * @since 0.1.0
+ * @since 0.1.0 (the API changed in 0.3.0, though)
*/
SRD_API struct srd_decoder_inst *srd_inst_new(struct srd_session *sess,
const char *decoder_id, GHashTable *options)
*
* @return SRD_OK upon success, a (negative) error code otherwise.
*
- * @since 0.1.0
+ * @since 0.1.0 (the API changed in 0.3.0, though)
*/
SRD_API int srd_inst_stack(struct srd_session *sess,
struct srd_decoder_inst *di_from, struct srd_decoder_inst *di_to)
*
* @return Pointer to struct srd_decoder_inst, or NULL if not found.
*
- * @since 0.1.0
+ * @since 0.1.0 (the API changed in 0.3.0, though)
*/
SRD_API struct srd_decoder_inst *srd_inst_find_by_id(struct srd_session *sess,
const char *inst_id)
srd_logic *logic;
uint64_t end_samplenum;
- srd_dbg("Calling decode() on instance %s with %d bytes starting "
- "at sample %d.", di->inst_id, inbuflen, start_samplenum);
+ srd_dbg("Calling decode() on instance %s with %" PRIu64 " bytes "
+ "starting at sample %" PRIu64 ".", di->inst_id, inbuflen,
+ start_samplenum);
/* Return an error upon unusable input. */
if (!di) {
* A session holds all decoder instances, their stack relationships and
* output callbacks.
*
- * @param sess. A pointer which will hold a pointer to a newly
- * initialized session on return.
+ * @param sess A pointer which will hold a pointer to a newly
+ * initialized session on return.
*
* @return SRD_OK upon success, a (negative) error code otherwise.
*
if (!sess) {
srd_err("Invalid session pointer.");
- return SRD_ERR;
+ return SRD_ERR_ARG;
}
if (!(*sess = g_try_malloc(sizeof(struct srd_session))))
*
* @return SRD_OK upon success, a (negative) error code otherwise.
*
- * @since 0.1.0
+ * @since 0.1.0 (the API changed in 0.3.0, though)
*/
SRD_API int srd_session_start(struct srd_session *sess)
{
ret = SRD_OK;
srd_dbg("Calling start() on all instances in session %d with "
- "%d probes, unitsize %d samplerate %d.", sess->session_id,
+ "%" PRIu64 " probes, unitsize %" PRIu64
+ ", samplerate %" PRIu64 ".", sess->session_id,
sess->num_probes, sess->unitsize, sess->samplerate);
/*
return SRD_ERR_ARG;
}
+ if (!data) {
+ srd_err("Invalid config data.");
+ return SRD_ERR_ARG;
+ }
+
if (!g_variant_is_of_type(data, G_VARIANT_TYPE_UINT64)) {
- srd_err("Value for key %d should be of type uint64.");
+ srd_err("Value for key %d should be of type uint64.", key);
return SRD_ERR_ARG;
}
case SRD_CONF_SAMPLERATE:
sess->samplerate = g_variant_get_uint64(data);
break;
+ default:
+ srd_err("Cannot set config for unknown key %d.", key);
+ return SRD_ERR_ARG;
}
g_variant_unref(data);
*
* All decoder instances and output callbacks are properly released.
*
- * @param sess. The session to be destroyed.
+ * @param sess The session to be destroyed.
*
* @return SRD_OK upon success, a (negative) error code otherwise.
*
- * @since 0.1.0
+ * @since 0.3.0
*/
SRD_API int srd_session_destroy(struct srd_session *sess)
{
int session_id;
+ if (!sess) {
+ srd_err("Invalid session.");
+ return SRD_ERR_ARG;
+ }
+
session_id = sess->session_id;
if (sess->di_list)
srd_inst_free_all(sess, NULL);
* @param cb The function to call. Must not be NULL.
* @param cb_data Private data for the callback function. Can be NULL.
*
- * @since 0.1.0
+ * @since 0.1.0 (the API changed in 0.3.0, though)
*/
SRD_API int srd_pd_output_callback_add(struct srd_session *sess,
int output_type, srd_pd_output_callback_t cb, void *cb_data)