本文整理汇总了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));
}
}
示例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());
}
示例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);
}
示例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));
}
示例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())));
}
示例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;
}
示例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);
}
示例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);
}
示例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;
}
示例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);
}
示例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;
}
示例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);
}
示例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) );
}
示例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;
}
示例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
}