本文整理汇总了C++中return_if_fail函数的典型用法代码示例。如果您正苦于以下问题:C++ return_if_fail函数的具体用法?C++ return_if_fail怎么用?C++ return_if_fail使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了return_if_fail函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: __mm_player_streaming_set_content_bitrate
void __mm_player_streaming_set_content_bitrate(mm_player_streaming_t* streamer, guint max_bitrate, guint avg_bitrate)
{
debug_fenter();
return_if_fail(streamer);
/* Note : Update buffering criterion bytes
* 1. maximum bitrate is considered first.
* 2. average bitrage * 3 is next.
* 3. if there are no updated bitrate, use default buffering limit.
*/
if (max_bitrate > 0 && streamer->buffer_max_bitrate != max_bitrate)
{
debug_log("set maximum bitrate(%dbps).\n", max_bitrate);
streamer->buffer_max_bitrate = max_bitrate;
streamer->need_update = TRUE;
}
if (avg_bitrate > 0 && streamer->buffer_avg_bitrate != avg_bitrate)
{
debug_log("set averate bitrate(%dbps).\n", avg_bitrate);
streamer->buffer_avg_bitrate = avg_bitrate;
streamer->need_update = TRUE;
}
debug_fleave();
return;
}
示例2: streaming_set_buffering_time
static void
streaming_set_buffering_time(mm_player_streaming_t* streamer, gdouble buffering_time)
{
gdouble buffer_buffering_time = DEFAULT_BUFFERING_TIME;
debug_fenter();
return_if_fail(streamer);
if (buffering_time < MIN_BUFFERING_TIME)
buffer_buffering_time = MIN_BUFFERING_TIME;
else if (buffering_time > MAX_BUFFERING_TIME)
buffer_buffering_time = MAX_BUFFERING_TIME;
else
buffer_buffering_time = buffering_time;
if (streamer->buffering_time != buffer_buffering_time)
{
debug_log("set buffer buffering time from %2.1f to %2.1f.", streamer->buffering_time, buffer_buffering_time);
streamer->buffering_time = buffer_buffering_time;
}
debug_fleave();
return;
}
示例3: __mm_player_streaming_set_buffer
void __mm_player_streaming_set_buffer(mm_player_streaming_t* streamer, GstElement * buffer,
gboolean use_buffering, guint buffer_size, gdouble low_percent, gdouble high_percent, gdouble buffering_time,
gboolean use_file, gchar * file_path, guint64 content_size)
{
debug_fenter();
return_if_fail(streamer);
if (buffer)
{
streamer->buffer = buffer;
debug_log("buffer element is %s.", GST_ELEMENT_NAME(buffer));
g_object_set ( G_OBJECT (streamer->buffer), "use-buffering", use_buffering, NULL );
}
streaming_set_buffer_size(streamer, buffer_size);
streaming_set_buffer_percent(streamer, low_percent, high_percent);
streaming_set_buffer_type (streamer, use_file, file_path, content_size);
streaming_set_buffering_time(streamer, buffering_time);
debug_fleave();
return;
}
示例4: test_pthread
void test_pthread(void)
{
pthread_t consumer_t = 0;
pthread_t producer_t = 0;
Locker *wrlock = locker_pthread_create();
Locker *nest_lock = locker_pthread_nest_create(wrlock, (ReadSelfId)pthread_self);
#ifdef RW_LOCK
Locker *rdlock = locker_pthread_create();
RWLock *rwlock = rwlock_create(wrlock, rdlock);
#endif
DList *head = NULL;
#ifdef RW_LOCK
head = dlist_create(rwlock);
#else
head = dlist_create(wrlock);
#endif
return_if_fail(head != NULL);
pthread_create(&producer_t, NULL, producer_thread, head);
pthread_create(&consumer_t, NULL, consumer_thread, head);
pthread_join(consumer_t, NULL);
pthread_join(producer_t, NULL);
}
示例5: mowgli_object_unref
/*
* mowgli_object_unref
*
* Decrement the reference counter on an object.
*
* Inputs:
* - the object to refcount
*
* Outputs:
* - none
*
* Side Effects:
* - if the refcount is 0, the object is destroyed.
*/
void
mowgli_object_unref(void *object)
{
mowgli_object_t *obj = mowgli_object(object);
return_if_fail(object != NULL);
obj->refcount--;
if (obj->refcount <= 0)
{
mowgli_object_message_broadcast(obj, "destroy");
if (obj->name != NULL)
free(obj->name);
if (obj->klass != NULL)
{
mowgli_destructor_t destructor = obj->klass->destructor;
if (obj->klass->dynamic == TRUE)
mowgli_object_class_destroy(obj->klass);
if (destructor != NULL)
destructor(obj);
else
free(obj);
}
else
{
mowgli_log_warning("invalid object class");
}
}
}
示例6: sgs_connection_get_context
void CMediaSession::unregister_fd_cb(sgs_connection *conn, int fd, short events)
{
sgs_context *ctx = sgs_connection_get_context(conn);
CMediaSession *thiz = (CMediaSession *) sgs_context_get_priv(ctx);
return_if_fail(thiz);
thiz->unregisterFdCB(conn, fd, events);
}
示例7: add_polygon_path
PRIVATE void add_polygon_path(SvgPolygonRenderObject* render_object, GraphicsPath* path){
ARRAY point_array = {0};
return_if_fail(render_object && path);
point_array = svg_polygon_render_object_get_point_array(render_object);
path->AddPolygon((PointF*)point_array.data, point_array.length);
}
示例8: ini_parser_error
static void ini_parser_error(INIParser* thiz, int line, int row, char* message)
{
return_if_fail(thiz != NULL && thiz->builder != NULL);
ini_builder_on_error(thiz->builder, line, row, message);
return;
}
示例9: ftk_widget_set_type
void ftk_widget_set_type(FtkWidget* thiz, int type)
{
return_if_fail(thiz != NULL && thiz->priv != NULL);
thiz->priv->type = type;
return;
}
示例10: ini_parser_subkey
static void ini_parser_subkey(INIParser* thiz)
{
return_if_fail(thiz != NULL && thiz->builder != NULL);
ini_builder_on_subkey(thiz->builder, thiz->subkey_start);
return;
}
示例11: ini_parser_value
static void ini_parser_value(INIParser* thiz)
{
return_if_fail(thiz != NULL && thiz->builder != NULL);
ini_builder_on_value(thiz->builder, thiz->value_start);
return;
}
示例12: db_close
void
db_close(database_handle_t *db)
{
return_if_fail(db_mod != NULL);
return db_mod->db_close(db);
}
示例13: ini_parser_set_builder
void ini_parser_set_builder(INIParser* thiz, INIBuilder* builder)
{
return_if_fail(thiz != NULL && builder != NULL);
thiz->builder = builder;
return;
}
示例14: opensex_db_close
static void opensex_db_close(database_handle_t *db)
{
opensex_t *rs;
int errno1;
char oldpath[BUFSIZE], newpath[BUFSIZE];
return_if_fail(db != NULL);
rs = db->priv;
mowgli_strlcpy(oldpath, db->file, sizeof oldpath);
mowgli_strlcat(oldpath, ".new", sizeof oldpath);
mowgli_strlcpy(newpath, db->file, sizeof newpath);
fclose(rs->f);
if (db->txn == DB_WRITE)
{
/* now, replace the old database with the new one, using an atomic rename */
if (srename(oldpath, newpath) < 0)
{
errno1 = errno;
slog(LG_ERROR, "db_save(): cannot rename services.db.new to services.db: %s", strerror(errno1));
wallops(_("\2DATABASE ERROR\2: db_save(): cannot rename services.db.new to services.db: %s"), strerror(errno1));
}
hook_call_db_saved();
}
free(rs->buf);
free(rs);
free(db->file);
free(db);
}
示例15: mowgli_object_init
/*
* mowgli_object_init
*
* Populates the object manager part of an object.
*
* Inputs:
* - pointer to object manager area
* - (optional) name of object
* - (optional) class of object
* - (optional) custom destructor
*
* Outputs:
* - none
*
* Side Effects:
* - none
*/
void
mowgli_object_init(mowgli_object_t *obj, const char *name, mowgli_object_class_t *klass, mowgli_destructor_t des)
{
return_if_fail(obj != NULL);
if (name != NULL)
obj->name = mowgli_strdup(name);
if (klass != NULL)
{
obj->klass = klass;
}
else
{
mowgli_object_class_t *tmp = mowgli_alloc(sizeof *tmp);
mowgli_object_class_init(tmp, name, des, TRUE);
obj->klass = tmp;
}
obj->refcount = 1;
obj->message_handlers.head = NULL;
obj->message_handlers.tail = NULL;
obj->message_handlers.count = 0;
obj->metadata.head = NULL;
obj->metadata.tail = NULL;
obj->metadata.count = 0;
mowgli_object_message_broadcast(obj, "create");
}