本文整理汇总了C++中MYASSERT函数的典型用法代码示例。如果您正苦于以下问题:C++ MYASSERT函数的具体用法?C++ MYASSERT怎么用?C++ MYASSERT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了MYASSERT函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: MYASSERT
/**
* Implementation of maCreatePlaceholder.
* @return A placeholder handle.
*/
unsigned int ResourceArray::create_RT_PLACEHOLDER() {
// Get a placeholder from the pool, if available.
if (mDynResPoolSize > 0) {
--mDynResPoolSize;
unsigned handle = mDynResPool[mDynResPoolSize];
int placeholderIndex = handle & (~DYNAMIC_PLACEHOLDER_BIT);
mDynResTypes[placeholderIndex] = RT_PLACEHOLDER;
return handle;
}
// Expand the dynamic resource array if needed.
if (mDynResSize + 1 > mDynResCapacity) {
void** oldPlaceholders = mDynRes;
byte* oldPlaceholderTypes = mDynResTypes;
mDynRes = new void*[mDynResCapacity * 2];
MYASSERT(mDynRes != NULL, ERR_OOM);
mDynResTypes = new byte[mDynResCapacity * 2];
MYASSERT(mDynResTypes != NULL, ERR_OOM);
memset(mDynRes, 0, sizeof(void*) * (mDynResCapacity * 2));
if (oldPlaceholders != NULL) {
// Copy from old to new.
memcpy(
mDynRes,
oldPlaceholders,
mDynResCapacity * sizeof(void*));
memcpy(
mDynResTypes,
oldPlaceholderTypes,
mDynResCapacity * sizeof(byte));
// Delete old arrays.
delete []oldPlaceholders;
delete []oldPlaceholderTypes;
}
// Set new capacity.
mDynResCapacity = mDynResCapacity * 2;
}
// This is the index of the new placeholder.
int placeholderIndex = mDynResSize;
// Increment placeholder array size.
++mDynResSize;
// Add a placeholder type to the new array item.
mDynResTypes[placeholderIndex] = RT_PLACEHOLDER;
// Return the handle id, this is the index of the
// array item with the dynamic resource bit set.
return placeholderIndex | DYNAMIC_PLACEHOLDER_BIT;
}
开发者ID:Felard,项目名称:MoSync,代码行数:57,代码来源:ResourceArray.cpp
示例17: MYASSERT
bool ChartElemText::loadFromDomElement(QDomElement& dom_element,
QDomDocument& dom_doc,
QString& err_msg)
{
MYASSERT(!dom_element.isNull());
TreeBaseXML::loadFromDomElement(dom_element, dom_doc, err_msg);
if (m_dom_element.tagName() != CHART_NODE_NAME_TEXTS_TEXT)
{
err_msg = QString("Wrong node name (%s), expected (%s)").
arg(m_dom_element.tagName()).arg(CHART_NODE_NAME_TEXTS_TEXT);
return false;
}
// extract the text from the node
setTextNode(dom_element);
QString text = m_text_node.data().trimmed();
// extract other info from node
bool draw_border = dom_element.attribute(CHART_ATTR_BORDER).toInt();
bool is_latlon = dom_element.attribute(CHART_ATTR_ISLATLON).toInt();
QString abs_ref_corner_text = dom_element.attribute(CHART_ATTR_REFPOINT);
bool ok_x = false, ok_y = false;
double x = dom_element.attribute(CHART_ATTR_POINT_X).toDouble(&ok_x);
double y = dom_element.attribute(CHART_ATTR_POINT_Y).toDouble(&ok_y);
if (!ok_x || !ok_y)
{
err_msg = QString("Text: Could not parse X/Y (%1/%2) of tag named (%3)").
arg(dom_element.attribute(CHART_ATTR_POINT_X)).
arg(dom_element.attribute(CHART_ATTR_POINT_Y)).
arg(dom_element.tagName());
return false;
}
// check info
delete m_ge_textrect;
m_ge_textrect = new GETextRect(m_chart_model->getProjection(), text,
QPointF(x,y), is_latlon,
GETextRect::getAbsRefCornerFromText(abs_ref_corner_text),
draw_border);
MYASSERT(m_ge_textrect);
m_ge_textrect->setDataElement(this);
m_chart_model->getGELayerList()->addElementByLayer(CHART_GE_LAYER_TEXTRECT, m_ge_textrect);
return true;
}
开发者ID:Rodeo314,项目名称:vasFMC-Krolock85,代码行数:52,代码来源:chart.elem.text.cpp
示例18: MYASSERT
void IOCPServer::slotNewConnection()
{
QTcpSocket *client_connection = m_tcp_server->nextPendingConnection();
m_client_socket_list.append(client_connection);
MYASSERT(connect(client_connection, SIGNAL(disconnected()), this, SLOT(slotGotClientData())));
MYASSERT(connect(client_connection, SIGNAL(readyRead()), this, SLOT(slotGotClientData())));
Logger::log(QString("IOCPServer:slotNewConnection: client connected: %1:%2").
arg(client_connection->peerAddress().toString()).
arg(client_connection->peerPort()));
client_connection->write(QString("Arn.TipoSer:vasFMC:CL\r\n").toAscii());
}
开发者ID:Rodeo314,项目名称:vasFMC-Krolock85,代码行数:13,代码来源:iocp.cpp
示例19: GraphicElementProjectionBase
GEVor::GEVor(const ProjectionBase* projection, const Vor* vor) :
GraphicElementProjectionBase(projection)
{
MYASSERT(vor != 0);
m_vor = static_cast<Vor*>(vor->copy());
MYASSERT(m_vor != 0);
QString text =
QString("%1 %2").arg(m_vor->getFreq()/1000.0, 0, 'f', 2).arg(m_vor->getId());
m_label = new GELabel(m_projection, this, QPointF(0,0), text);
MYASSERT(m_label != 0);
m_label->setNormalColor(m_normal_color);
}
开发者ID:Rodeo314,项目名称:vasFMC-Krolock85,代码行数:13,代码来源:ge_vor.cpp
示例20: GraphicElementProjectionBase
GEAirport::GEAirport(const ProjectionBase* projection,
const Airport* airport) :
GraphicElementProjectionBase(projection)
{
MYASSERT(airport != 0);
m_airport = static_cast<Airport*>(airport->copy());
MYASSERT(m_airport != 0);
m_normal_color = m_active_color = Qt::blue;
m_label = new GELabel(m_projection, this, QPointF(0,6), m_airport->getId(), false, false);
MYASSERT(m_label != 0);
m_label->setNormalColor(m_normal_color);
}
开发者ID:Rodeo314,项目名称:vasFMC-Krolock85,代码行数:13,代码来源:ge_airport.cpp
注:本文中的MYASSERT函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论