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


C++ MYASSERT函数代码示例

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


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

示例1: MAX

	/**
	 * Initialize the static resource array.
	 * This function saves the old objects present
	 * in the array.
	 * @param numResources The number of resource in the new array.
	 */
	void ResourceArray::init(unsigned numResources) {
		unsigned oldResSize = mResSize;
		mResSize = MAX(numResources + 1, oldResSize);
		void** oldRes = mRes;
		byte* oldTypes = mResTypes;
		mRes = new void*[mResSize];
		MYASSERT(mRes != NULL, ERR_OOM);
		mResTypes = new byte[mResSize];
		MYASSERT(mResTypes != NULL, ERR_OOM);

		if(oldRes) {
			memcpy(mRes, oldRes, oldResSize*sizeof(void*));
			memcpy(mResTypes, oldTypes, oldResSize*sizeof(byte));
			delete[] oldRes;
			delete[] oldTypes;
		}

		if(mResSize > oldResSize) {
			// Clear the new objects.
			//pointer arithmetic bug
			//memset(mRes + oldResSize*sizeof(void*), 0, (mResSize - oldResSize)*sizeof(void*));
			memset(&mRes[oldResSize], 0, (mResSize - oldResSize) * sizeof(void*));
			// Set to placeholder type.
			memset(mResTypes + oldResSize, RT_PLACEHOLDER, (mResSize - oldResSize));
		}
	}
开发者ID:Felard,项目名称:MoSync,代码行数:32,代码来源:ResourceArray.cpp

示例2: m_stat_file

Statistics::Statistics(const QString& filename, const QString& separator) :
    m_stat_file(new QFile(filename)), m_separator(separator)
{
    MYASSERT(m_stat_file != 0);
    MYASSERT(m_stat_file->open(QIODevice::WriteOnly));
    MYASSERT(!m_separator.isEmpty());
}
开发者ID:Rodeo314,项目名称:vasFMC-Krolock85,代码行数:7,代码来源:statistics.cpp

示例3: FMCSoundBase

FMCSound::FMCSound(const QString & filename, SOUND_SOURCE sound_source, FMOD_SYSTEM *fmod_system) :
    FMCSoundBase(sound_source), m_filename(filename), m_fmod_system(fmod_system), m_fmod_sound(0), m_fmod_channel(0)
{
    MYASSERT(!filename.isEmpty());
    MYASSERT(m_fmod_system != 0);
    MYASSERT(FMOD_System_CreateSound(m_fmod_system, filename.toLatin1().data(), FMOD_HARDWARE, 0, &m_fmod_sound) == FMOD_OK);
}
开发者ID:Rodeo314,项目名称:vasFMC-Krolock85,代码行数:7,代码来源:fmc_sounds.cpp

示例4: throw

LONG CKey::SetValue(LPCTSTR name, LPCTSTR value) throw()
{
  MYASSERT(value != NULL);
  MYASSERT(_object != NULL);
  return RegSetValueEx(_object, name, 0, REG_SZ,
      (const BYTE * )value, (lstrlen(value) + 1) * sizeof(TCHAR));
}
开发者ID:headupinclouds,项目名称:lzma-sdk,代码行数:7,代码来源:Registry.cpp

示例5: GraphicElementBase

GraphicElementProjectionBase::GraphicElementProjectionBase(const ProjectionBase* projection,
                                                           bool is_moveable) :
    GraphicElementBase(is_moveable), m_projection(projection), m_projection_changed(true)
{
    MYASSERT(m_projection != 0);
    MYASSERT(connect(projection, SIGNAL(signalChanged()), this, SLOT(slotProjectionChanged())));
}
开发者ID:Rodeo314,项目名称:vasFMC-Krolock85,代码行数:7,代码来源:ge_projection.cpp

示例6: BIG_PHAT_ERROR

	/**
	 * Destroy a placeholder. Mark this placeholder as free
	 * and store the index in the pool of free placeholders.
	 * @param index The placeholder handle.
	 * @return Status code.
	 */
	int ResourceArray::_maDestroyPlaceholder(unsigned index) {
		// The handle must be a dynamic placeholder.
		if (!(index & DYNAMIC_PLACEHOLDER_BIT)) {
			// TODO: Use MYASSERT_IF_PANICS_ENABLED when
			// conditional panics are to be used.
			BIG_PHAT_ERROR(ERR_RES_PLACEHOLDER_NOT_DYNAMIC);
			return -2;
		}

		// Get the index into the dynamic resource array.
		unsigned i = index & (~DYNAMIC_PLACEHOLDER_BIT);
		TESTINDEX(i, mDynResSize);

		// The placeholder must not have been destroyed.
		if (RT_NIL == mDynResTypes[i])
		{
			// TODO: Use MYASSERT_IF_PANICS_ENABLED when
			// conditional panics are to be used.
			BIG_PHAT_ERROR(ERR_RES_PLACEHOLDER_ALREADY_DESTROYED);
			return -2;
		}

		// Set the handle type to RT_NIL. This marks the
		// placeholder as destroyed.
		mDynResTypes[i] = RT_NIL;

		// Put handle into the pool.

		// Create or expand the pool as needed.
		if (0 == mDynResPoolCapacity) {
			// Create the initial pool.
			mDynResPoolCapacity = 2;
			mDynResPool = new unsigned[mDynResPoolCapacity];
			MYASSERT(mDynResPool != NULL, ERR_OOM);
		}
		else if (mDynResPoolSize + 1 > mDynResPoolCapacity) {
			// Expand the pool.
			unsigned* oldDynResPool = mDynResPool;
			mDynResPool = new unsigned[mDynResPoolCapacity * 2];
			MYASSERT(mDynResPool != NULL, ERR_OOM);

			// Copy from old to new and delete old.
			memcpy(
				mDynResPool,
				oldDynResPool,
				mDynResPoolCapacity * sizeof(unsigned));
			delete []oldDynResPool;

			// Set new capacity.
			mDynResPoolCapacity = mDynResPoolCapacity * 2;
		}

		// Increment pool size.
		++mDynResPoolSize;

		// Add free handle index last in array (push to stack).
		mDynResPool[mDynResPoolSize - 1] = index;

		return RES_OK;
	}
开发者ID:Felard,项目名称:MoSync,代码行数:66,代码来源:ResourceArray.cpp

示例7: glDeleteLists

// Lists
void glDeleteLists(GLuint list,  GLsizei range)
{
    ListRange listRange;
    int       i;

    if(!s_pCtx)
        return;

    if(list==0)
        return;

    MYASSERT(list>=1 && int(list+range)<=s_lists.size());

    // All of the lists that are being freed should be currently allocated,
    // and we're going to mark them as not allocated
    for(i=0; i<range; i++)
    {
        // To protect ourselves against double frees in a release build,
        // don't free the list if one of the list elements isn't allocated
        if(!s_listAllocated[list+i])
        {
            *((int *)0)=0;
            return;
        }

        MYASSERT(s_listAllocated[list+i]);

        s_listAllocated[list+i]=false;
    }

    listRange.begin=list;
    listRange.size=range;

    s_availableLists.push_back(listRange);
}
开发者ID:Rodeo314,项目名称:vasFMC-Krolock85,代码行数:36,代码来源:vas_gl.cpp

示例8: SYSCALL

SYSCALL(void, maHttpSetRequestHeader(MAHandle conn, const char* key, const char* value)) {
	LOGS("HttpSetRequestHeader %i %s: %s\n", conn, key, value);
	MAStreamConn& mac = getStreamConn(conn);
	HttpConnection* http = mac.conn->http();
	MYASSERT(http != NULL, ERR_CONN_NOT_HTTP);
	MYASSERT(http->mState == HttpConnection::SETUP, ERR_HTTP_NOT_SETUP);
	http->SetRequestHeader(key, value);
}
开发者ID:N00bKefka,项目名称:MoSync,代码行数:8,代码来源:networking.cpp

示例9: MYASSERT

LONG CKey::QueryValue(LPCWSTR name, LPWSTR value, UInt32 &count)
{
  MYASSERT(count != NULL);
  DWORD type = 0;
  LONG res = RegQueryValueExW(_object, name, NULL, &type, (LPBYTE)value, (DWORD *)&count);
  MYASSERT((res != ERROR_SUCCESS) || (type == REG_SZ) || (type == REG_MULTI_SZ) || (type == REG_EXPAND_SZ));
  return res;
}
开发者ID:headupinclouds,项目名称:lzma-sdk,代码行数:8,代码来源:Registry.cpp

示例10: MYASSERT

void GraphicElementLayerList::addElementByLayer(unsigned int layer, GraphicElementBase* element)
{
    MYASSERT(element != 0);

    addLayerWhenNotExisting(layer);
    GraphicElementList *list = m_layer_map.find(layer).value();
    MYASSERT(list != 0);
    list->addElement(element);
}
开发者ID:Rodeo314,项目名称:vasFMC-Krolock85,代码行数:9,代码来源:ge_layers.cpp

示例11: checklist

/*===========================================================================*
 *				checklist				     *
 *===========================================================================*/
static int checklist(char *file, int line,
	struct slabheader *s, int l, int bytes)
{
	struct slabdata *n = s->list_head[l];
	int ch = 0;

	while(n) {
		int count = 0, i;
		MYASSERT(n->sdh.magic1 == MAGIC1);
		MYASSERT(n->sdh.magic2 == MAGIC2);
		MYASSERT(n->sdh.list == l);
		MYASSERT(usedpages_add(n->sdh.phys, VM_PAGE_SIZE) == 0);
		if(n->sdh.prev)
			MYASSERT(n->sdh.prev->sdh.next == n);
		else
			MYASSERT(s->list_head[l] == n);
		if(n->sdh.next) MYASSERT(n->sdh.next->sdh.prev == n);
		for(i = 0; i < USEELEMENTS*8; i++)
			if(i >= ITEMSPERPAGE(bytes))
				MYASSERT(!GETBIT(n, i));
			else
				if(GETBIT(n,i))
					count++;
		MYASSERT(count == n->sdh.nused);
		ch += count;
		n = n->sdh.next;
	}

	return ch;
}
开发者ID:locosoft1986,项目名称:nucleos,代码行数:33,代码来源:slaballoc.c

示例12: chunk_getpath

static void chunk_getpath (const gs_chunk_t *chunk, char *cPath, size_t s)
{
	size_t cPathLen;

	MYASSERT(chunk);
	MYASSERT(cPath);

	cPathLen = snprintf (cPath, MAX(s, sizeof(chunk->ci->id.vol)), "%s/",
			chunk->ci->id.vol);
	chunk_id2str (chunk, cPath+cPathLen, s-cPathLen);
}
开发者ID:amogrid,项目名称:redcurrant,代码行数:11,代码来源:rawx.c

示例13: SOCKET_INIT

    static void SOCKET_INIT(void)
    {
        WORD vreq = MAKEWORD(2,2); WSADATA wd;
	int rcode = WSAStartup(vreq,&wd);
	int ver_min_high = 1, ver_min_low = 1;
	MYASSERT( rcode == 0, ("%d",rcode) );
	MYASSERT( HIBYTE(wd.wVersion)>ver_min_high ||
	          (HIBYTE(wd.wVersion)==ver_min_high &&
	           LOBYTE(wd.wVersion)>=ver_min_low),
	          ("%d.%d",wd.wVersion,wd.wVersion) );
    }
开发者ID:liuxfiu,项目名称:primogeni,代码行数:11,代码来源:fmtcp.c

示例14: getConn

static MAConn& getConn(MAHandle conn) {
	MAConn* macp;
	gConnMutex.lock();
	{
		MYASSERT(!gConnections.empty(), ERR_CONN_HANDLE_INVALID);
		ConnItr itr = gConnections.find(conn);
		MYASSERT(itr != gConnections.end(), ERR_CONN_HANDLE_INVALID);
		macp = itr->second;
	}
	gConnMutex.unlock();
	return *macp;
}
开发者ID:N00bKefka,项目名称:MoSync,代码行数:12,代码来源:networking.cpp

示例15: MYASSERT

void FMCConsole::registerConfigWidget(const QString& title, Config* cfg)
{
#if !VASFMC_GAUGE
    if (m_main_config->getIntValue(CFG_ENABLE_CONFIG_ACCESS) == 0) return;
    MYASSERT(!title.isEmpty());
    MYASSERT(cfg != 0);
    config_tab->addTab(new ConfigWidget(cfg), title);
#else
    Q_UNUSED(title);
    Q_UNUSED(cfg);
#endif
}
开发者ID:Rodeo314,项目名称:xVasFMC,代码行数:12,代码来源:fmc_console.cpp


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