本文整理汇总了C++中DEBUG_CHECK函数的典型用法代码示例。如果您正苦于以下问题:C++ DEBUG_CHECK函数的具体用法?C++ DEBUG_CHECK怎么用?C++ DEBUG_CHECK使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了DEBUG_CHECK函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DEBUG_CHECK
void CItem::Spawn_KillChildren()
{
// kill all creatures spawned from this !
DEBUG_CHECK( IsType(IT_SPAWN_CHAR));
int iCurrent = m_itSpawnChar.m_current;
for ( int j = 0; j < 256; j++ ) // loop through all maps
{
if ( !g_MapList.m_maps[j] ) continue; // skip unsupported maps
for ( int i = 0; i < g_MapList.GetSectorQty(j); i++ )
{
CSector * pSector = g_World.GetSector(j, i);
ASSERT(pSector);
CChar * pCharNext;
CChar * pChar = STATIC_CAST <CChar*>( pSector->m_Chars_Active.GetHead());
for ( ; pChar!=NULL; pChar = pCharNext )
{
pCharNext = pChar->GetNext();
if ( pChar->NPC_IsSpawnedBy( this ))
{
pChar->Delete();
iCurrent --;
}
}
}
}
if (iCurrent && ! g_Serv.IsLoading())
{
DEBUG_CHECK(iCurrent==0);
}
m_itSpawnChar.m_current = 0; // Should not be necessary
Spawn_OnTick( false );
}
示例2: secp256k1_ecdsa_verify
int secp256k1_ecdsa_verify(const secp256k1_context_t* ctx, const unsigned char *msg32, const unsigned char *sig, int siglen, const unsigned char *pubkey, int pubkeylen) {
secp256k1_ge_t q;
secp256k1_ecdsa_sig_t s;
secp256k1_scalar_t m;
int ret = -3;
DEBUG_CHECK(ctx != NULL);
DEBUG_CHECK(secp256k1_ecmult_context_is_built(&ctx->ecmult_ctx));
DEBUG_CHECK(msg32 != NULL);
DEBUG_CHECK(sig != NULL);
DEBUG_CHECK(pubkey != NULL);
secp256k1_scalar_set_b32(&m, msg32, NULL);
if (secp256k1_eckey_pubkey_parse(&q, pubkey, pubkeylen)) {
if (secp256k1_ecdsa_sig_parse(&s, sig, siglen)) {
if (secp256k1_ecdsa_sig_verify(&ctx->ecmult_ctx, &s, &q, &m)) {
/* success is 1, all other values are fail */
ret = 1;
} else {
ret = 0;
}
} else {
ret = -2;
}
} else {
ret = -1;
}
return ret;
}
示例3: secp256k1_ec_pubkey_tweak_mul
int secp256k1_ec_pubkey_tweak_mul(const secp256k1_context_t* ctx, unsigned char *pubkey, int pubkeylen, const unsigned char *tweak) {
secp256k1_ge_t p;
secp256k1_scalar_t factor;
int ret = 0;
int overflow = 0;
DEBUG_CHECK(ctx != NULL);
DEBUG_CHECK(secp256k1_ecmult_context_is_built(&ctx->ecmult_ctx));
DEBUG_CHECK(pubkey != NULL);
DEBUG_CHECK(tweak != NULL);
secp256k1_scalar_set_b32(&factor, tweak, &overflow);
if (!overflow) {
ret = secp256k1_eckey_pubkey_parse(&p, pubkey, pubkeylen);
if (ret) {
ret = secp256k1_eckey_pubkey_tweak_mul(&ctx->ecmult_ctx, &p, &factor);
}
if (ret) {
int oldlen = pubkeylen;
ret = secp256k1_eckey_pubkey_serialize(&p, pubkey, &pubkeylen, oldlen <= 33);
VERIFY_CHECK(pubkeylen == oldlen);
}
}
return ret;
}
示例4: secp256k1_ecdsa_pubkey_tweak_mul
int secp256k1_ecdsa_pubkey_tweak_mul(unsigned char *pubkey, int pubkeylen, const unsigned char *tweak) {
DEBUG_CHECK(secp256k1_ecmult_consts != NULL);
DEBUG_CHECK(pubkey != NULL);
DEBUG_CHECK(tweak != NULL);
int ret = 1;
secp256k1_num_t factor;
secp256k1_num_init(&factor);
secp256k1_num_set_bin(&factor, tweak, 32);
if (secp256k1_num_is_zero(&factor))
ret = 0;
if (secp256k1_num_cmp(&factor, &secp256k1_ge_consts->order) >= 0)
ret = 0;
secp256k1_ge_t p;
if (ret) {
if (!secp256k1_ecdsa_pubkey_parse(&p, pubkey, pubkeylen))
ret = 0;
}
if (ret) {
secp256k1_num_t zero;
secp256k1_num_init(&zero);
secp256k1_num_set_int(&zero, 0);
secp256k1_gej_t pt;
secp256k1_gej_set_ge(&pt, &p);
secp256k1_ecmult(&pt, &pt, &factor, &zero);
secp256k1_num_free(&zero);
secp256k1_ge_set_gej(&p, &pt);
int oldlen = pubkeylen;
secp256k1_ecdsa_pubkey_serialize(&p, pubkey, &pubkeylen, oldlen <= 33);
VERIFY_CHECK(pubkeylen == oldlen);
}
secp256k1_num_free(&factor);
return ret;
}
示例5: secp256k1_ecdsa_verify
int secp256k1_ecdsa_verify(const unsigned char *msg, int msglen, const unsigned char *sig, int siglen, const unsigned char *pubkey, int pubkeylen) {
DEBUG_CHECK(secp256k1_ecmult_consts != NULL);
DEBUG_CHECK(msg != NULL);
DEBUG_CHECK(msglen <= 32);
DEBUG_CHECK(sig != NULL);
DEBUG_CHECK(pubkey != NULL);
int ret = -3;
secp256k1_num_t m;
secp256k1_num_init(&m);
secp256k1_ecdsa_sig_t s;
secp256k1_ecdsa_sig_init(&s);
secp256k1_ge_t q;
secp256k1_num_set_bin(&m, msg, msglen);
if (!secp256k1_ecdsa_pubkey_parse(&q, pubkey, pubkeylen)) {
ret = -1;
goto end;
}
if (!secp256k1_ecdsa_sig_parse(&s, sig, siglen)) {
ret = -2;
goto end;
}
if (!secp256k1_ecdsa_sig_verify(&s, &q, &m)) {
ret = 0;
goto end;
}
ret = 1;
end:
secp256k1_ecdsa_sig_free(&s);
secp256k1_num_free(&m);
return ret;
}
示例6: secp256k1_ecdsa_privkey_tweak_add
int secp256k1_ecdsa_privkey_tweak_add(unsigned char *seckey, const unsigned char *tweak) {
DEBUG_CHECK(seckey != NULL);
DEBUG_CHECK(tweak != NULL);
int ret = 1;
secp256k1_num_t term;
secp256k1_num_init(&term);
secp256k1_num_set_bin(&term, tweak, 32);
if (secp256k1_num_cmp(&term, &secp256k1_ge_consts->order) >= 0)
ret = 0;
secp256k1_num_t sec;
secp256k1_num_init(&sec);
if (ret) {
secp256k1_num_set_bin(&sec, seckey, 32);
secp256k1_num_add(&sec, &sec, &term);
secp256k1_num_mod(&sec, &secp256k1_ge_consts->order);
if (secp256k1_num_is_zero(&sec))
ret = 0;
}
if (ret)
secp256k1_num_get_bin(seckey, 32, &sec);
secp256k1_num_clear(&sec);
secp256k1_num_clear(&term);
secp256k1_num_free(&sec);
secp256k1_num_free(&term);
return ret;
}
示例7: secp256k1_ecdsa_pubkey_tweak_add
int secp256k1_ecdsa_pubkey_tweak_add(unsigned char *pubkey, int pubkeylen, const unsigned char *tweak) {
DEBUG_CHECK(secp256k1_ecmult_consts != NULL);
DEBUG_CHECK(pubkey != NULL);
DEBUG_CHECK(tweak != NULL);
int ret = 1;
secp256k1_num_t term;
secp256k1_num_init(&term);
secp256k1_num_set_bin(&term, tweak, 32);
if (secp256k1_num_cmp(&term, &secp256k1_ge_consts->order) >= 0)
ret = 0;
secp256k1_ge_t p;
if (ret) {
if (!secp256k1_ecdsa_pubkey_parse(&p, pubkey, pubkeylen))
ret = 0;
}
if (ret) {
secp256k1_gej_t pt;
secp256k1_gej_set_ge(&pt, &p);
secp256k1_num_t one;
secp256k1_num_init(&one);
secp256k1_num_set_int(&one, 1);
secp256k1_ecmult(&pt, &pt, &one, &term);
secp256k1_num_free(&one);
if (secp256k1_gej_is_infinity(&pt))
ret = 0;
secp256k1_ge_set_gej(&p, &pt);
int oldlen = pubkeylen;
secp256k1_ecdsa_pubkey_serialize(&p, pubkey, &pubkeylen, oldlen <= 33);
VERIFY_CHECK(pubkeylen == oldlen);
}
secp256k1_num_free(&term);
return ret;
}
示例8: free_db_conn
void free_db_conn (db_t * db)
{
DEBUG_CHECK(db->flags & DB_FLAG_EMPTY, "Freeing DB connection that is already freed\n");
DEBUG_CHECK(!dbConnUsed, "Freeing DB connection when dbConnUsed == 0\n");
dbConnUsed--;
db->flags |= DB_FLAG_EMPTY;
}
示例9: swap_in
/*
* Read something back in from swap. Return the size.
* blockp - a pointer to what will hold the block read in
* loc - position in the swap file to read from
*/
static int
swap_in(char ** blockp, int loc)
{
int size;
DEBUG_CHECK(!blockp, "blockp null in swap_in()\n");
if (loc == -1)
return 0;
swap_seek(loc, 0);
#ifdef SWAP_USE_FD
/* find out size */
if (read(swap_file, &size, sizeof size) == -1)
fatal("Couldn't read the swap file.\n");
DEBUG_CHECK(size <= 0, "Illegal size read from swap file.\n");
*blockp = DXALLOC(size, TAG_SWAP, "swap_in");
if (read(swap_file, *blockp, size) == -1)
fatal("Couldn't read the swap file.\n");
#else
/* find out size */
if (fread((char *) &size, sizeof size, 1, swap_file) == -1)
fatal("Couldn't read the swap file.\n");
DEBUG_CHECK(size <= 0, "Illegal size read from swap file.\n");
*blockp = DXALLOC(size, TAG_SWAP, "swap_in");
if (fread(*blockp, size, 1, swap_file) == -1)
fatal("Couldn't read the swap file.\n");
#endif
total_bytes_swapped -= size;
return size;
}
示例10: secp256k1_ec_pubkey_verify
int secp256k1_ec_pubkey_verify(const secp256k1_context_t* ctx, const unsigned char *pubkey, int pubkeylen) {
secp256k1_ge_t q;
DEBUG_CHECK(ctx != NULL);
DEBUG_CHECK(pubkey != NULL);
(void)ctx;
return secp256k1_eckey_pubkey_parse(&q, pubkey, pubkeylen);
}
示例11: secp256k1_ecdsa_pubkey_compress
int secp256k1_ecdsa_pubkey_compress(unsigned char *pubkey, int *pubkeylen) {
DEBUG_CHECK(pubkey != NULL);
DEBUG_CHECK(pubkeylen != NULL);
secp256k1_ge_t p;
if (!secp256k1_ecdsa_pubkey_parse(&p, pubkey, *pubkeylen))
return 0;
secp256k1_ecdsa_pubkey_serialize(&p, pubkey, pubkeylen, 1);
return 1;
}
示例12: secp256k1_ecdsa_privkey_import
int secp256k1_ecdsa_privkey_import(unsigned char *seckey, const unsigned char *privkey, int privkeylen) {
DEBUG_CHECK(seckey != NULL);
DEBUG_CHECK(privkey != NULL);
secp256k1_num_t key;
secp256k1_num_init(&key);
int ret = secp256k1_ecdsa_privkey_parse(&key, privkey, privkeylen);
if (ret)
secp256k1_num_get_bin(seckey, 32, &key);
secp256k1_num_free(&key);
return ret;
}
示例13: secp256k1_ecdsa_privkey_export
int secp256k1_ecdsa_privkey_export(const unsigned char *seckey, unsigned char *privkey, int *privkeylen, int compressed) {
DEBUG_CHECK(seckey != NULL);
DEBUG_CHECK(privkey != NULL);
DEBUG_CHECK(privkeylen != NULL);
secp256k1_num_t key;
secp256k1_num_init(&key);
secp256k1_num_set_bin(&key, seckey, 32);
int ret = secp256k1_ecdsa_privkey_serialize(privkey, privkeylen, &key, compressed);
secp256k1_num_free(&key);
return ret;
}
示例14: basis
/*
This function reads images in to a vector. That vector is then mean subtracted
and then projected onto an optimal basis (PCA, LDA or LPP). Returned is a matrix
that contains the images after they have been projected onto the subspace.
*/
Matrix
readAndProjectImages (Subspace *s, char *imageNamesFile, char *imageDirectory, int *numImages, ImageList **srt)
{
int i, j;
Matrix images, vector, smallVector;
char name[FILE_LINE_LENGTH];
ImageList *subject, *replicate;
DEBUG(1, "Reading training file names from file");
*srt = getImageNames(imageNamesFile, numImages);
DEBUG_CHECK(*srt, "Error: header no imagenames found in file image list file");
/* Automatically determine number of pixels in images */
sprintf(name, "%s/%s", imageDirectory, (*srt)->filename);
DEBUG(1, "Autodetecting number of pixels, i.e. vector length based on the size of image 0.");
DEBUG_CHECK (autoFileLength(name) == s->numPixels, "Images sizes do not match subspace basis vector size");
DEBUG_INT(1, "Vector length", s->numPixels);
DEBUG_CHECK(s->numPixels > 0, "Error positive value required for a Vector Length");
/*Images stored in the columns of a matrix */
DEBUG(1, "Allocating image matrix");
images = makeMatrix(s->basis->col_dim, *numImages);
vector = makeMatrix(s->numPixels, 1);
i = 0;
for (subject = *srt; subject; subject = subject->next_subject) {
for (replicate = subject; replicate; replicate = replicate->next_replicate) {
if (debuglevel > 0)
printf("%s ", replicate->filename);
sprintf(name, "%s/%s", imageDirectory, replicate->filename);
replicate->imageIndex = i;
readFile(name, 0, vector);
writeProgress("Reading images", i,*numImages);
smallVector = centerThenProjectImages(s, vector);
/* Copy the smaller vector into the image matrix*/
for (j = 0; j < smallVector->row_dim; j++) {
ME(images, j, i) = ME(smallVector, j, 0);
}
freeMatrix(smallVector);
i++; /* increament the image index */
}
if (debuglevel > 0)
printf("\n");
}
return images;
}
示例15: secp256k1_ec_pubkey_decompress
int secp256k1_ec_pubkey_decompress(const secp256k1_context_t* ctx, unsigned char *pubkey, int *pubkeylen) {
secp256k1_ge_t p;
int ret = 0;
DEBUG_CHECK(pubkey != NULL);
DEBUG_CHECK(pubkeylen != NULL);
(void)ctx;
if (secp256k1_eckey_pubkey_parse(&p, pubkey, *pubkeylen)) {
ret = secp256k1_eckey_pubkey_serialize(&p, pubkey, pubkeylen, 0);
}
return ret;
}