当前位置: 首页>>代码示例>>C++>>正文


C++ return_val_if_fail函数代码示例

本文整理汇总了C++中return_val_if_fail函数的典型用法代码示例。如果您正苦于以下问题:C++ return_val_if_fail函数的具体用法?C++ return_val_if_fail怎么用?C++ return_val_if_fail使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了return_val_if_fail函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: dlist_foreach

Ret dlist_foreach(DList* thiz, DListDataVisitFunc visit, void* ctx)
{
    Ret ret = RET_OK;
    DListNode* iter = NULL;

    return_val_if_fail(thiz != NULL && visit != NULL, RET_INVALID_PARAMS);

    dlist_rdlock(thiz);

    iter = thiz->first;

    while(iter != NULL && ret != RET_STOP)
    {
        ret = visit(ctx, iter->data);

        iter = iter->next;
    }
    dlist_unlock(thiz);

    return ret;
}
开发者ID:iDings,项目名称:sysprog-code,代码行数:21,代码来源:dlist.c

示例2: dlist_get_node

static DListNode* dlist_get_node(DList* thiz, size_t index, int fail_return_last)
{
	DListNode* iter = NULL;
	
	return_val_if_fail(thiz != NULL, NULL); 

	iter = thiz->first;

	while(iter != NULL && iter->next != NULL && index > 0)
	{
		iter = iter->next;
		index--;
	}

	if(!fail_return_last)
	{
		iter = index > 0 ? NULL : iter;
	}

	return iter;
}
开发者ID:suzp1984,项目名称:donkey,代码行数:21,代码来源:dlist.c

示例3: mm_player_sound_filter_custom_get_eq_bands_number

int
mm_player_sound_filter_custom_get_eq_bands_number(MMHandleType hplayer, int *bands)
{
	mm_player_t* player = (mm_player_t*)hplayer;
	int result = MM_ERROR_NONE;
	debug_fenter();

	return_val_if_fail( player, MM_ERROR_PLAYER_NOT_INITIALIZED );

	/* check if EQ is supported */
	if ( !_mmplayer_is_supported_filter_type( MM_AUDIO_FILTER_TYPE_CUSTOM, MM_AUDIO_FILTER_CUSTOM_EQ ) )
	{
		return MM_ERROR_PLAYER_SOUND_EFFECT_NOT_SUPPORTED_FILTER;
	}

	*bands = PLAYER_INI()->audio_filter_custom_eq_num;
	debug_log("number of custom eq band = %d\n", *bands);

	debug_fleave();

	return result;
}
开发者ID:tizenorg,项目名称:framework.multimedia.libmm-player,代码行数:22,代码来源:mm_player_sndeffect.c

示例4: ftk_display_android_update

static Ret ftk_display_android_update(FtkDisplay* thiz, FtkBitmap* bitmap, FtkRect* rect, int xoffset, int yoffset)
{
	int i = 0;
	Ret ret = RET_OK;
	DECL_PRIV(thiz, priv);
	int width = rect->width;
	int height = rect->height;
	int src_width = ftk_bitmap_width(bitmap);
	int src_height = ftk_bitmap_height(bitmap);
	int dst_width = ftk_bitmap_width(priv->bitmap);
	int dst_height = ftk_bitmap_height(priv->bitmap);
	FtkColor* src = ftk_bitmap_lock(bitmap);
	FtkColor* dst = ftk_bitmap_lock(priv->bitmap);

	return_val_if_fail(rect->x < src_width && rect->y < src_height
		&& xoffset < dst_width && yoffset < dst_height, RET_FAIL);

	width = (xoffset + width) >= dst_width ? dst_width - xoffset : width;
	height = (yoffset + height) >= dst_height ? dst_height - yoffset : height;

	yoffset = dst_height  - yoffset - height - 1;
	src += rect->y * src_width + rect->x;
	dst += (yoffset + height) * dst_width + xoffset;

	for(i = 0; i < height; i++)
	{
		memcpy(dst, src, sizeof(FtkColor) * width);
		dst -= dst_width;
		src += src_width;
	}

#if 0
	display_bitmap(priv, priv->bitmap, xoffset, yoffset, width, height, xoffset, yoffset);
#else
	display_bitmap(priv, priv->bitmap, 0, 0, screen_width, screen_height, 0, 0);
#endif

	return ret;
}
开发者ID:bbw2008good,项目名称:ftk,代码行数:39,代码来源:ftk_display_android_gles.c

示例5: font_data_load

FontData* font_data_load(char* data, unsigned length)
{
	FontData* thiz = font_data_create(0, 0);

	return_val_if_fail(data != NULL && length > sizeof(FontDataHeader), NULL);

	if(thiz != NULL)
	{
		int glyph_size = 0;
		thiz->header = *(FontDataHeader*)data;
		glyph_size = thiz->header.char_nr * sizeof(FGlyph);

		thiz->glyphs = (FGlyph*)(data + sizeof(FontDataHeader));
		thiz->data = (unsigned char*)(data + sizeof(FontDataHeader) + glyph_size);
		thiz->data_size = length - ((char*)thiz->data - data);
		thiz->data_buffer_size = thiz->data_size;
		thiz->new_created = 0;
		thiz->org_data = data;
	}

	return thiz;
}
开发者ID:bbw2008good,项目名称:ftk,代码行数:22,代码来源:fontdata.c

示例6: mowgli_queue_shift

mowgli_queue_t *
mowgli_queue_shift(mowgli_queue_t *head, void *data)
{
	mowgli_queue_t *out = mowgli_heap_alloc(mowgli_queue_heap);

	return_val_if_fail(head != NULL, NULL);

	out->next = head;
	out->data = data;

	if (head != NULL)
	{
		out->prev = head->prev;

		if (out->prev != NULL)
			out->prev->next = out;

		head->prev = out;
	}

	return out;
}
开发者ID:binki,项目名称:libmowgli-2,代码行数:22,代码来源:queue.c

示例7: ftk_painter_create

FtkWidget* ftk_painter_create(FtkWidget* parent, int x, int y, int width, int height)
{
	FtkWidget* thiz = (FtkWidget*)FTK_ZALLOC(sizeof(FtkWidget));
	return_val_if_fail(thiz != NULL, NULL);
	
	thiz->priv_subclass[0] = (PrivInfo*)FTK_ZALLOC(sizeof(PrivInfo));
	if(thiz->priv_subclass[0] != NULL)
	{
		thiz->on_event = ftk_painter_on_event;
		thiz->on_paint = ftk_painter_on_paint;
		thiz->destroy  = ftk_painter_destroy;

		ftk_widget_init(thiz, FTK_PAINTER, 0, x, y, width, height, 0);
		ftk_widget_append_child(parent, thiz);
	}
	else
	{
		FTK_FREE(thiz);
	}

	return thiz;
}
开发者ID:bbw2008good,项目名称:ftk,代码行数:22,代码来源:ftk_painter.c

示例8: _fbdevVideoGetPortAtom

static Atom
_fbdevVideoGetPortAtom (FBDevPortAttrAtom paa)
{
	int i;

	return_val_if_fail (paa > PAA_MIN && paa < PAA_MAX, None);

	for (i = 0; i < NUM_ATOMS; i++)
	{
		if (paa == atom_list[i].paa)
		{
			if (atom_list[i].atom == None)
				atom_list[i].atom = MakeAtom (atom_list[i].name, strlen (atom_list[i].name), TRUE);

			return atom_list[i].atom;
		}
	}

	ErrorF ("Error: Unknown Port Attribute Name!\n");

	return None;
}
开发者ID:tizenorg,项目名称:adaptation.xorg.driver.xserver-xorg-video-emulfb,代码行数:22,代码来源:fbdev_video.c

示例9: create_plugin

	k3d::iunknown* create_plugin()
	{
		if(!delegate_factory)
			delegate_factory = dynamic_cast<k3d::iapplication_plugin_factory*>(k3d::plugin::factory::lookup(delegate_factory_name));

		if(!delegate_factory)
		{
			k3d::log() << error << "Couldn't locate delegate factory [" << delegate_factory_name << "]" << std::endl;
			return 0;
		}

		k3d::iunknown* const plugin = delegate_factory->create_plugin();
		return_val_if_fail(plugin, 0);

		k3d::filesystem::ifstream script_file(script_path);
		std::stringstream script_stream;
		script_stream << script_file.rdbuf();

		k3d::property::set_internal_value(*plugin, "script", script_stream.str());

		return plugin;
	}
开发者ID:AwesomeDoesIt,项目名称:k3d,代码行数:22,代码来源:module.cpp

示例10: ini_parser_load_from_file

Ret ini_parser_load_from_file(INIParser* thiz, const char* filename, char comment_char, char delim_char)
{
	return_val_if_fail(thiz != NULL && filename != NULL, RET_INVALID_PARAMS);

	struct stat fstat;
	char* buf;
	int fd;

	if (stat(filename, &fstat)) {
		printf("Can't read the stat of config file -- %s\n", filename);
		return RET_FAIL;
	}

	buf = (char*)malloc(fstat.st_size);
	if ((fd = open(filename, O_RDONLY)) < 0) {
		return RET_FAIL;
	}

	read(fd, buf, fstat.st_size);

	return ini_parser_load_from_buf(thiz, buf, comment_char, delim_char);
}
开发者ID:suzp1984,项目名称:donkey,代码行数:22,代码来源:ini_parser.c

示例11: ftk_key_board_candidate_text

static Ret ftk_key_board_candidate_text(FtkWidget* thiz, FtkKeyBoardCell* cell)
{
	FtkEvent event;
	DECL_PRIV0(thiz, priv);
	FtkKeyBoardDesc* desc = priv->desc;
	FtkKeyBoardCandidate* candidate = NULL;
	return_val_if_fail(desc->candidate_focus < desc->candidate_nr, RET_FAIL);

	if(priv->editor != NULL)
	{
		candidate = desc->candidates + desc->candidate_focus;

		ftk_event_init(&event,     FTK_EVT_IM_COMMIT);
		event.widget   = priv->editor;
		event.u.extra  = (char*)candidate->text;
		ftk_widget_event(priv->editor, &event);
	}

	ftk_logd("%s:%d %s\n", __func__, __LINE__, cell->text);

	return RET_OK;
}
开发者ID:htbegin,项目名称:pyftk,代码行数:22,代码来源:ftk_key_board.c

示例12: xml_node_create_normal

XmlNode* xml_node_create_normal(const char* name, const char** attrs)
{
	XmlNode* node = NULL;
	return_val_if_fail(name != NULL, NULL);

	if((node = calloc(1, sizeof(XmlNode))) != NULL)
	{
		int i = 0;
		node->type = XML_NODE_NORMAL;
		node->u.normal.name = strdup(name);

		if(attrs != NULL)
		{
			for(i = 0; attrs[i] != NULL && attrs[i+1] != NULL; i += 2)
			{
				xml_node_append_attr(node, attrs[i], attrs[i+1]);
			}
		}
	}

	return node;
}
开发者ID:0ct0cat,项目名称:spexamples,代码行数:22,代码来源:xml_tree.c

示例13: ftk_key_board_create

FtkWidget* ftk_key_board_create(FtkWidget* parent, int x, int y, int width, int height)
{
	FtkWidget* thiz = (FtkWidget*)FTK_ZALLOC(sizeof(FtkWidget));
	return_val_if_fail(thiz != NULL, NULL);
	
	thiz->priv_subclass[0] = (PrivInfo*)FTK_ZALLOC(sizeof(PrivInfo));
	if(thiz->priv_subclass[0] != NULL)
	{
		thiz->on_event = ftk_key_board_on_event;
		thiz->on_paint = ftk_key_board_on_paint;
		thiz->destroy  = ftk_key_board_destroy;

		ftk_widget_init(thiz, FTK_KEY_BOARD, 0, x, y, width, height, FTK_ATTR_BG_FOUR_CORNER|FTK_ATTR_NO_FOCUS);
		ftk_widget_append_child(parent, thiz);
	}
	else
	{
		FTK_FREE(thiz);
	}

	return thiz;
}
开发者ID:htbegin,项目名称:pyftk,代码行数:22,代码来源:ftk_key_board.c

示例14: ftk_input_method_manager_unregister

Ret  ftk_input_method_manager_unregister(FtkInputMethodManager* thiz, FtkInputMethod* im)
{
	size_t i = 0;
	return_val_if_fail(thiz != NULL && im != NULL, RET_FAIL);

	for(i = 0; i < thiz->nr; i++)
	{
		if(thiz->methods[i] == im)
		{
			ftk_input_method_destroy(thiz->methods[i]);
			thiz->methods[i] = NULL;
			break;
		}
	}
	
	for(; i < thiz->nr; i++)
	{
		thiz->methods[i] = thiz->methods[i+1];
	}

	return RET_OK;
}
开发者ID:htbegin,项目名称:pyftk,代码行数:22,代码来源:ftk_input_method_manager.c

示例15: backup_restore

static STATUS backup_restore(char* path)
{
    return_val_if_fail(p_current != NULL, RET_FAIL);
    miui_busy_process();
    switch(p_current->result) {
        case RESTORE_ALL:
#ifdef DUALSYSTEM_PARTITIONS
            miuiIntent_send(INTENT_RESTORE, 9, path, "1", "1", "1", "1", "0", "0", "1", "1");
#else
            miuiIntent_send(INTENT_RESTORE, 9, path, "1", "1", "1", "1", "0", "0", "0", "0");
#endif
            break;
        case RESTORE_CACHE:
            miuiIntent_send(INTENT_RESTORE, 9, path, "0", "0", "0", "1", "0", "0", "0", "0");
            break;
        case RESTORE_DATA:
            miuiIntent_send(INTENT_RESTORE, 9, path, "0", "0", "1", "0", "0", "0", "0", "0");
            break;
        case RESTORE_SYSTEM:
            miuiIntent_send(INTENT_RESTORE, 9, path, "0", "1", "0", "0", "0", "0", "0", "0");
           break;
        case RESTORE_BOOT:
            miuiIntent_send(INTENT_RESTORE, 9, path, "1", "0", "0", "0", "0", "0", "0", "0");
            break;
#ifdef DUALSYSTEM_PARTITIONS
        case RESTORE_SYSTEM1:
            miuiIntent_send(INTENT_RESTORE, 9, path, "0", "0", "0", "0", "0", "0", "0", "1");
           break;
        case RESTORE_BOOT1:
            miuiIntent_send(INTENT_RESTORE, 9, path, "0", "0", "0", "0", "0", "0", "1", "0");
            break;
#endif
        default:
            miui_error("p->resulte %d should not be the value\n", p_current->result);
            break;
    }
    return RET_OK;
}
开发者ID:PeterCxy,项目名称:miui_recovery,代码行数:38,代码来源:backup_ui.c


注:本文中的return_val_if_fail函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。