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


C++ SAFE_MALLOC函数代码示例

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


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

示例1: getTLV

oscar_tlv* oscar_tlv_chain::putTLV(WORD wType, WORD wLen, BYTE *pData, BOOL bReplace)
{
	oscar_tlv *tlv = getTLV(wType, 1);

	if (tlv && bReplace)
		SAFE_FREE((void**)&tlv->pData);
	else {
		oscar_tlv_chain *last = this;

		while (last && last->next)
			last = last->next;

		if (last) {
			last->next = (oscar_tlv_chain*)SAFE_MALLOC(sizeof(oscar_tlv_chain));
			tlv = &last->next->tlv;
			tlv->wType = wType;
		}
	}
	if (tlv) {
		tlv->wLen = wLen;
		tlv->pData = (PBYTE)SAFE_MALLOC(wLen);
		memcpy(tlv->pData, pData, wLen);
	}
	return tlv;
}
开发者ID:0xmono,项目名称:miranda-ng,代码行数:25,代码来源:tlv.cpp

示例2: btreeCreateNodeBlock

void *
btreeCreateNodeBlock(GdbBlock *block, void *extra)
{
    BTreeNode *node;
    BTree *tree;

    tree = (BTree *)extra;

    MEM_CHECK(node = (BTreeNode *)SAFE_MALLOC(sizeof(BTreeNode), LOC_BTREE_0166));
    memset(node, 0, sizeof(BTreeNode));

    node->tree  = tree;
    node->block = block;

    /*comment: when reach here, we have no idea about keyCount, hence alloc children/keySizes/keys as the max possible num: the order*/

    MEM_CHECK(node->children = (offset_t *)SAFE_MALLOC(tree->order * sizeof(offset_t), LOC_BTREE_0167));
    memset(node->children, 0, tree->order * sizeof(offset_t));


    MEM_CHECK(node->keySizes = (uint16_t *)SAFE_MALLOC((tree->order - 1) * sizeof(uint16_t), LOC_BTREE_0168));
    memset(node->keySizes, 0, (tree->order - 1)  * sizeof(uint16_t));


    MEM_CHECK(node->keys = (uint8_t **)SAFE_MALLOC((tree->order - 1) * sizeof(uint8_t *), LOC_BTREE_0169));
    memset(node->keys, 0, (tree->order - 1) * sizeof(uint8_t *));

    return node;
}
开发者ID:petercloud,项目名称:RFS,代码行数:29,代码来源:btree_node.c

示例3: child_alloc

static void child_alloc(int *bufsz_arr)
{
	char **foo;
	int i, j;
	char buf[BUFSIZ];
	long count;

	foo = SAFE_MALLOC(tst_exit, nr_iovecs * sizeof(char *));

	count = 0;
	for (i = 0; i < nr_iovecs; i++) {
		foo[i] = SAFE_MALLOC(tst_exit, bufsz_arr[i]);
		for (j = 0; j < bufsz_arr[i]; j++) {
			foo[i][j] = count % 256;
			count++;
		}
	}
	tst_resm(TINFO, "child 0: %d iovecs allocated and initialized.",
		 nr_iovecs);

	/* passing addr via pipe */
	SAFE_CLOSE(tst_exit, pipe_fd[0]);
	snprintf(buf, BUFSIZ, "%p", (void *)foo);
	SAFE_WRITE(tst_exit, 1, pipe_fd[1], buf, strlen(buf));
	SAFE_CLOSE(tst_exit, pipe_fd[1]);

	/* wait until child_invoke is done reading from our VM */
	safe_semop(semid, 0, -1);
}
开发者ID:MohdVara,项目名称:ltp,代码行数:29,代码来源:process_vm_readv03.c

示例4: setup

static void setup(void)
{
	int node, ret;

	tst_require_root();
	TEST(ltp_syscall(__NR_migrate_pages, 0, 0, NULL, NULL));

	if (numa_available() == -1)
		tst_brkm(TCONF, NULL, "NUMA not available");

	ret = get_allowed_nodes(NH_MEMS, 1, &node);
	if (ret < 0)
		tst_brkm(TBROK | TERRNO, NULL, "get_allowed_nodes_arr: %d",
			 ret);

	sane_max_node = LTP_ALIGN(get_max_node(), sizeof(unsigned long)*8);
	sane_nodemask_size = sane_max_node / 8;
	sane_old_nodes = SAFE_MALLOC(NULL, sane_nodemask_size);
	sane_new_nodes = SAFE_MALLOC(NULL, sane_nodemask_size);
	memset(sane_old_nodes, 0, sane_nodemask_size);
	memset(sane_new_nodes, 0, sane_nodemask_size);

	set_bit(sane_old_nodes, node, 1);
	set_bit(sane_new_nodes, node, 1);

	TEST_PAUSE;
}
开发者ID:JanyHuang,项目名称:ltp,代码行数:27,代码来源:migrate_pages01.c

示例5: memset

fenc_attribute_policy *construct_test_policy1()
{
	fenc_attribute_policy *policy;
	fenc_attribute_subtree *subtree_AND, *subtree_L1, *subtree_L2, *subtree_L3, *subtree_L4, *subtree_L5, *subtree_OR;
	
	policy = (fenc_attribute_policy*)SAFE_MALLOC(sizeof(fenc_attribute_policy));
	memset(policy, 0, sizeof(fenc_attribute_policy));
	
	/* Add a simple one-level 3-out-of-3 policy.  Eventually we'll have helper routines to
	 * do this work.	*/
	subtree_AND = (fenc_attribute_subtree*)SAFE_MALLOC(sizeof(fenc_attribute_subtree));
	subtree_L1 = (fenc_attribute_subtree*)SAFE_MALLOC(sizeof(fenc_attribute_subtree));
	subtree_L2 = (fenc_attribute_subtree*)SAFE_MALLOC(sizeof(fenc_attribute_subtree));
	subtree_L3 = (fenc_attribute_subtree*)SAFE_MALLOC(sizeof(fenc_attribute_subtree));
	subtree_L4 = (fenc_attribute_subtree*)SAFE_MALLOC(sizeof(fenc_attribute_subtree));
	subtree_L5 = (fenc_attribute_subtree*)SAFE_MALLOC(sizeof(fenc_attribute_subtree));
	subtree_OR = (fenc_attribute_subtree*)SAFE_MALLOC(sizeof(fenc_attribute_subtree));
	memset(subtree_AND, 0, sizeof(fenc_attribute_subtree));
	memset(subtree_L1, 0, sizeof(fenc_attribute_subtree));
	memset(subtree_L2, 0, sizeof(fenc_attribute_subtree));
	memset(subtree_L3, 0, sizeof(fenc_attribute_subtree));
	memset(subtree_L4, 0, sizeof(fenc_attribute_subtree));
	memset(subtree_L5, 0, sizeof(fenc_attribute_subtree));
	memset(subtree_OR, 0, sizeof(fenc_attribute_subtree));
	
	subtree_L1->node_type = FENC_ATTRIBUTE_POLICY_NODE_LEAF;
	strcpy((char*)subtree_L1->attribute.attribute_str, "ONE");
	
	subtree_L2->node_type = FENC_ATTRIBUTE_POLICY_NODE_LEAF;
	strcpy((char*)subtree_L2->attribute.attribute_str, "TWO");
	
	subtree_L3->node_type = FENC_ATTRIBUTE_POLICY_NODE_LEAF;
	strcpy((char*)subtree_L3->attribute.attribute_str, "THREE");
	
	subtree_L4->node_type = FENC_ATTRIBUTE_POLICY_NODE_LEAF;
	strcpy((char*)subtree_L4->attribute.attribute_str, "FOUR");
	
	subtree_L5->node_type = FENC_ATTRIBUTE_POLICY_NODE_LEAF;
	strcpy((char*)subtree_L5->attribute.attribute_str, "FIVE");
	
	subtree_AND->node_type = FENC_ATTRIBUTE_POLICY_NODE_OR;
	subtree_AND->threshold_k = 2;
	subtree_AND->num_subnodes = 3;
	subtree_AND->subnode = SAFE_MALLOC(sizeof(fenc_attribute_subtree*) * 5);
	subtree_AND->subnode[0] = subtree_L1;
	subtree_AND->subnode[1] = subtree_L2;
	subtree_AND->subnode[2] = subtree_OR;
	
	subtree_OR->node_type = FENC_ATTRIBUTE_POLICY_NODE_AND;
	subtree_OR->subnode = SAFE_MALLOC(sizeof(fenc_attribute_subtree*) * 3);
	subtree_OR->num_subnodes = 3;
	subtree_OR->subnode[0] = subtree_L3;
	subtree_OR->subnode[1] = subtree_L4;
	subtree_OR->subnode[2] = subtree_L5;
	
	policy->root = subtree_AND;
	
	return policy;
}
开发者ID:Gurut,项目名称:libfenc,代码行数:59,代码来源:benchmark.c

示例6: child_invoke

static void child_invoke(int *bufsz_arr)
{
	int i, j, count, nr_error;
	unsigned char expect, actual;
	long *addrs;
	struct iovec local[NUM_LOCAL_VECS], *remote;
	int rcv_arr[NUM_LOCAL_VECS];

	addrs = fetch_remote_addrs();

	remote = SAFE_MALLOC(tst_exit, nr_iovecs * sizeof(struct iovec));
	for (i = 0; i < nr_iovecs; i++) {
		remote[i].iov_base = (void *)addrs[i];
		remote[i].iov_len = bufsz_arr[i];
	}
	tst_resm(TINFO, "child 1: %d remote iovecs received.", nr_iovecs);

	gen_random_arr(rcv_arr, NUM_LOCAL_VECS);
	for (i = 0; i < NUM_LOCAL_VECS; i++) {
		local[i].iov_base = SAFE_MALLOC(tst_exit, rcv_arr[i]);
		local[i].iov_len = rcv_arr[i];
	}
	tst_resm(TINFO, "child 1: %d local iovecs initialized.",
		 NUM_LOCAL_VECS);

	TEST(test_process_vm_readv(pids[0], local, NUM_LOCAL_VECS,
				   remote, nr_iovecs, 0));
	if (TEST_RETURN != bufsz)
		tst_brkm(TBROK | TERRNO, tst_exit, "process_vm_readv");

	/* verify every byte */
	count = 0;
	nr_error = 0;
	for (i = 0; i < NUM_LOCAL_VECS; i++) {
		for (j = 0; j < local[i].iov_len; j++) {
			expect = count % 256;
			actual = ((unsigned char *)local[i].iov_base)[j];
			if (expect != actual) {
#if DEBUG
				tst_resm(TFAIL, "child 1: expected %i, got %i "
					 "for byte seq %d",
					 expect, actual, count);
#endif
				nr_error++;
			}
			count++;
		}
	}
	if (nr_error)
		tst_brkm(TFAIL, tst_exit, "child 1: %d incorrect bytes "
			 "received.", nr_error);
	else
		tst_resm(TPASS, "child 1: all bytes are correctly received.");
}
开发者ID:1587,项目名称:ltp,代码行数:54,代码来源:process_vm_readv03.c

示例7: VideoEditorMp3Reader_getInterface

M4OSA_ERR VideoEditorMp3Reader_getInterface(
        M4READER_MediaType *pMediaType,
        M4READER_GlobalInterface **pRdrGlobalInterface,
        M4READER_DataInterface **pRdrDataInterface) {
    M4OSA_ERR err = M4NO_ERROR;

    ALOGV("VideoEditorMp3Reader_getInterface: begin");
    /* Input parameters check */
    VIDEOEDITOR_CHECK(M4OSA_NULL != pMediaType,      M4ERR_PARAMETER);
    VIDEOEDITOR_CHECK(M4OSA_NULL != pRdrGlobalInterface, M4ERR_PARAMETER);
    VIDEOEDITOR_CHECK(M4OSA_NULL != pRdrDataInterface, M4ERR_PARAMETER);

    SAFE_MALLOC(*pRdrGlobalInterface, M4READER_GlobalInterface, 1,
        "VideoEditorMp3Reader_getInterface");
    SAFE_MALLOC(*pRdrDataInterface, M4READER_DataInterface, 1,
        "VideoEditorMp3Reader_getInterface");

    *pMediaType = M4READER_kMediaTypeMP3;

    (*pRdrGlobalInterface)->m_pFctCreate       = VideoEditorMp3Reader_create;
    (*pRdrGlobalInterface)->m_pFctDestroy      = VideoEditorMp3Reader_destroy;
    (*pRdrGlobalInterface)->m_pFctOpen         = VideoEditorMp3Reader_open;
    (*pRdrGlobalInterface)->m_pFctClose        = VideoEditorMp3Reader_close;
    (*pRdrGlobalInterface)->m_pFctGetOption    = VideoEditorMp3Reader_getOption;
    (*pRdrGlobalInterface)->m_pFctSetOption    = VideoEditorMp3Reader_setOption;
    (*pRdrGlobalInterface)->m_pFctGetNextStream =
        VideoEditorMp3Reader_getNextStream;
    (*pRdrGlobalInterface)->m_pFctFillAuStruct =
        VideoEditorMp3Reader_fillAuStruct;
    (*pRdrGlobalInterface)->m_pFctStart        = M4OSA_NULL;
    (*pRdrGlobalInterface)->m_pFctStop         = M4OSA_NULL;
    (*pRdrGlobalInterface)->m_pFctJump         = VideoEditorMp3Reader_jump;
    (*pRdrGlobalInterface)->m_pFctReset        = VideoEditorMp3Reader_reset;
    (*pRdrGlobalInterface)->m_pFctGetPrevRapTime = M4OSA_NULL;

    (*pRdrDataInterface)->m_pFctGetNextAu      = VideoEditorMp3Reader_getNextAu;
    (*pRdrDataInterface)->m_readerContext      = M4OSA_NULL;

cleanUp:
    if( M4NO_ERROR == err )
    {
        ALOGV("VideoEditorMp3Reader_getInterface no error");
    }
    else
    {
        SAFE_FREE(*pRdrGlobalInterface);
        SAFE_FREE(*pRdrDataInterface);

        ALOGV("VideoEditorMp3Reader_getInterface ERROR 0x%X", err);
    }
    ALOGV("VideoEditorMp3Reader_getInterface: end");
    return err;
}
开发者ID:Jiangyi,项目名称:12055,代码行数:53,代码来源:VideoEditorMp3Reader.cpp

示例8: readIntoTLVChain

/* set maxTlvs<=0 to get all TLVs in length, or a positive integer to get at most the first n */
oscar_tlv_chain* readIntoTLVChain(BYTE **buf, WORD wLen, int maxTlvs)
{
	oscar_tlv_chain *now, *last, *chain = NULL;
	WORD now_tlv_len;
	int len = wLen;

	if (!buf || !wLen)
		return NULL;

	while (len > 0) { /* don't use unsigned variable for this check */
		now = (oscar_tlv_chain *)SAFE_MALLOC(sizeof(oscar_tlv_chain));

		if (!now) {
			disposeChain(&chain);
			return NULL;
		}

		unpackWord(buf, &(now->tlv.wType));
		unpackWord(buf, &now_tlv_len);
		now->tlv.wLen = now_tlv_len;
		len -= 4;

		if (now_tlv_len < 1)
			now->tlv.pData = NULL;
		else if (now_tlv_len <= len) {
			now->tlv.pData = (BYTE *)SAFE_MALLOC(now_tlv_len);
			if (now->tlv.pData)
				memcpy(now->tlv.pData, *buf, now_tlv_len);
		}
		else { // the packet is shorter than it should be
			SAFE_FREE((void**)&now);
			return chain; // give at least the rest of chain
		}

		if (chain) // keep the original order
			last->next = now;
		else
			chain = now;

		last = now;

		len -= now_tlv_len;
		*buf += now_tlv_len;

		if (--maxTlvs == 0)
			break;
	}

	return chain;
}
开发者ID:0xmono,项目名称:miranda-ng,代码行数:51,代码来源:tlv.cpp

示例9: SAFE_CLOSE

static long *fetch_remote_addrs(void)
{
	long *foo, *bar;
	char buf[BUFSIZ];
	long len;
	struct iovec local, remote;

	/* get addr from pipe */
	SAFE_CLOSE(tst_exit, pipe_fd[1]);
	SAFE_READ(tst_exit, 0, pipe_fd[0], buf, BUFSIZ);
	SAFE_CLOSE(tst_exit, pipe_fd[0]);
	if (sscanf(buf, "%p", &foo) != 1)
		tst_brkm(TBROK | TERRNO, tst_exit, "sscanf");

	len = nr_iovecs * sizeof(long);
	bar = SAFE_MALLOC(tst_exit, len);
	local.iov_base = bar;
	local.iov_len = len;
	remote.iov_base = foo;
	remote.iov_len = len;

	TEST(test_process_vm_readv(pids[0], &local, 1, &remote, 1, 0));
	if (TEST_RETURN != len)
		tst_brkm(TFAIL | TERRNO, tst_exit, "process_vm_readv");

	return local.iov_base;
}
开发者ID:1587,项目名称:ltp,代码行数:27,代码来源:process_vm_readv03.c

示例10: readIntoTLVRecordList

oscar_tlv_record_list* readIntoTLVRecordList(BYTE **buf, WORD wLen, int nCount)
{
	oscar_tlv_record_list *list = NULL, *last;

	while (wLen >= 2) {
		WORD wRecordSize;

		unpackWord(buf, &wRecordSize);
		wLen -= 2;
		if (wRecordSize && wRecordSize <= wLen) {
			oscar_tlv_record_list *pRecord = (oscar_tlv_record_list*)SAFE_MALLOC(sizeof(oscar_tlv_record_list));
			BYTE *pData = *buf;

			*buf += wRecordSize;
			wLen -= wRecordSize;

			pRecord->item = readIntoTLVChain(&pData, wRecordSize, 0);
			if (pRecord->item) { // keep the order
				if (list)
					last->next = pRecord;
				else
					list = pRecord;

				last = pRecord;
			}
			else SAFE_FREE((void**)&pRecord);
		}

		if (--nCount == 0)
			break;
	}
	return list;
}
开发者ID:0xmono,项目名称:miranda-ng,代码行数:33,代码来源:tlv.cpp

示例11: setup

static void setup(void)
{
	int i, fd;

	fd = SAFE_OPEN(TEST_FILE, O_RDWR | O_CREAT, 0664);

	pagesize = getpagesize();

	/* Writing 16 pages of random data into this file */
	for (i = 0; i < (pagesize / 2); i++)
		SAFE_WRITE(1, fd, STR, sizeof(STR) - 1);

	SAFE_FSTAT(fd, &st);

	file1 = SAFE_MMAP(0, st.st_size, PROT_READ, MAP_SHARED, fd, 0);
	file2 = SAFE_MMAP(0, st.st_size, PROT_READ, MAP_SHARED, fd, 0);
	file3 = SAFE_MMAP(0, st.st_size, PROT_READ, MAP_PRIVATE, fd, 0);
	shared_anon = SAFE_MMAP(0, MAP_SIZE, PROT_READ, MAP_SHARED |
			MAP_ANONYMOUS, -1, 0);

	nonalign = file1 + 100;

	ptr_addr = SAFE_MALLOC(st.st_size);
	tmp_addr = (void*)LTP_ALIGN((long)ptr_addr, pagesize);

	/* unmap as last step to avoid subsequent mmap(s) pick same address */
	SAFE_MUNMAP(file2 + st.st_size - pagesize, pagesize);
	SAFE_CLOSE(fd);

	tcases_filter();
}
开发者ID:kraj,项目名称:ltp,代码行数:31,代码来源:madvise02.c

示例12: setup

static void setup(void)
{
	struct rlimit rl = {
		.rlim_cur = RLIM_INFINITY,
		.rlim_max = RLIM_INFINITY,
	};
	int i;
	long arg_len, arg_count;

	bst = SAFE_MMAP(NULL, sizeof(*bst),
			   PROT_READ | PROT_WRITE,
			   MAP_SHARED | MAP_ANONYMOUS, -1, 0);
	bst->left = 0;
	bst->right = ARGS_SZ;

	arg_len = sysconf(_SC_PAGESIZE);
	arg = SAFE_MALLOC(arg_len);
	memset(arg, 'c', arg_len - 1);
	arg[arg_len - 1] = '\0';

	args[0] = "true";
	arg_count = ARGS_SZ;
	tst_res(TINFO, "Using %ld args of size %ld", arg_count, arg_len);
	for (i = 1; i < arg_count; i++)
		args[i] = arg;

	SAFE_SETRLIMIT(RLIMIT_STACK, &rl);
}
开发者ID:kraj,项目名称:ltp,代码行数:28,代码来源:thp01.c

示例13: setup

static void setup(void)
{
	struct sysinfo sstats;
	unsigned long long total_free;

	struct sigaction act;
	act.sa_handler = handler;
	act.sa_flags = 0;
	sigemptyset(&act.sa_mask);
	sigaction(SIGRTMIN, &act, 0);

	parse_mtest_options(opt_chunksize, &chunksize,
			opt_maxbytes, &maxbytes,
			opt_maxpercent, &maxpercent);
	sysinfo(&sstats);
	total_free = sstats.freeram;

	max_pids = total_free * sstats.mem_unit
		/ (unsigned long)ALLOC_THRESHOLD + 10;
	pid_list = SAFE_MALLOC(max_pids * sizeof(pid_t));

	if (!alloc_maxbytes) {
		/* set alloc_maxbytes to the extra amount we want to allocate */
		alloc_maxbytes = ((float)maxpercent / 100.00)
			* (sstats.mem_unit * total_free);
		tst_res(TINFO, "Filling up %d%% of free ram which is %llu kbytes",
			 maxpercent, alloc_maxbytes / 1024);
	}
}
开发者ID:yaneurabeya,项目名称:ltp,代码行数:29,代码来源:mtest01.c

示例14: cextclnt_recv

EC_BOOL cextclnt_recv(CEXTCLNT *cextclnt, UINT8 **in_buff, UINT32 *in_buff_size)
{
    UINT32 data_size;
    UINT8 *data_buff;

    if(EC_FALSE == csocket_recv_uint32(CEXTCLNT_SOCKFD(cextclnt), &data_size))
    {
        dbg_log(SEC_0069_CEXTSRV, 0)(LOGSTDOUT, "error:cextclnt_recv: recv data size from client %s on sockfd %d failed\n",
                            CEXTCLNT_IPADDR_STR(cextclnt), CEXTCLNT_SOCKFD(cextclnt));
        return (EC_FALSE);
    }

    data_buff = (UINT8 *)SAFE_MALLOC(data_size, LOC_CEXTSRV_0001);
    if(NULL_PTR == data_buff)
    {
        dbg_log(SEC_0069_CEXTSRV, 0)(LOGSTDOUT, "error:cextclnt_recv: alloc %ld bytes failed\n", data_size);
        return (EC_FALSE);
    }

    if(EC_FALSE == csocket_recv(CEXTCLNT_SOCKFD(cextclnt), data_buff, data_size))
    {
        dbg_log(SEC_0069_CEXTSRV, 0)(LOGSTDOUT, "error:cextclnt_recv: recv %ld bytes from client %s on sockfd %d failed\n",
                            data_size, CEXTCLNT_IPADDR_STR(cextclnt), CEXTCLNT_SOCKFD(cextclnt));
        SAFE_FREE(data_buff, LOC_CEXTSRV_0002);
        return (EC_FALSE);
    }

    (*in_buff) = data_buff;
    (*in_buff_size) = data_size;

    return (EC_TRUE);
}
开发者ID:inevity,项目名称:ebgn,代码行数:32,代码来源:cextsrv.c

示例15: VideoEditorMp3Reader_create

/**
 ****************************************************************************
 * @brief    create an instance of the MP3 reader
 * @note     allocates the context
 *
 * @param    pContext:        (OUT)    pointer on a reader context
 *
 * @return    M4NO_ERROR                 there is no error
 * @return    M4ERR_ALLOC                a memory allocation has failed
 * @return    M4ERR_PARAMETER            at least one parameter is not valid
 ****************************************************************************
*/
M4OSA_ERR VideoEditorMp3Reader_create(M4OSA_Context *pContext) {
    M4OSA_ERR err = M4NO_ERROR;
    VideoEditorMp3Reader_Context *pReaderContext = M4OSA_NULL;

    VIDEOEDITOR_CHECK(M4OSA_NULL != pContext, M4ERR_PARAMETER);

    ALOGV("VideoEditorMp3Reader_create begin");

    /* Context allocation & initialization */
    SAFE_MALLOC(pReaderContext, VideoEditorMp3Reader_Context, 1,
        "VideoEditorMp3Reader");

    pReaderContext->mAudioStreamHandler  = M4OSA_NULL;
    pReaderContext->mAudioAu.dataAddress = M4OSA_NULL;
    pReaderContext->mMaxDuration = 0;
    *pContext = pReaderContext;

cleanUp:
    if (M4NO_ERROR == err) {
        ALOGV("VideoEditorMp3Reader_create no error");
    } else {
        ALOGV("VideoEditorMp3Reader_create ERROR 0x%X", err);
    }
    ALOGV("VideoEditorMp3Reader_create end");
    return err;
}
开发者ID:Jiangyi,项目名称:12055,代码行数:38,代码来源:VideoEditorMp3Reader.cpp


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