• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ FAIL_IF_NULL函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: FAIL_IF_NULL

HRESULT U2Dx9ShaderMgr::CreateShader( LPD3DXBUFFER pbufShader,
									 U2Dx9ShaderDesc::ShaderType ShaderType,
									U2Dx9ShaderDesc * pDesc )
{
	HRESULT hr = S_OK;
	FAIL_IF_NULL( pbufShader );
	FAIL_IF_NULL( pDesc );
	FAIL_IF_NULL( ms_pD3DDev );

	pDesc->m_type			= ShaderType;

	if( ShaderType == U2Dx9ShaderDesc::SHADERTYPE_VERTEX )
	{
		hr = ms_pD3DDev->CreateVertexShader( (DWORD*) pbufShader->GetBufferPointer(),
			(IDirect3DVertexShader9**) & pDesc->m_pShader );
		SAFE_RELEASE( pbufShader );
		BREAK_AND_RET_VAL_IF_FAILED(hr);		
	}
	else
	{
		hr = ms_pD3DDev->CreatePixelShader( (DWORD*) pbufShader->GetBufferPointer(),
			(IDirect3DPixelShader9**) & pDesc->m_pShader );
		SAFE_RELEASE( pbufShader );		
		BREAK_AND_RET_VAL_IF_FAILED(hr);				
	}
	return( hr );
}
开发者ID:DanielNeander,项目名称:my-3d-engine,代码行数:27,代码来源:U2Dx9ShaderMgr.cpp


示例2: DetectFiledataIsdataatParseTest1

static int DetectFiledataIsdataatParseTest1(void)
{
    DetectEngineCtx *de_ctx = DetectEngineCtxInit();
    FAIL_IF_NULL(de_ctx);
    de_ctx->flags |= DE_QUIET;

    Signature *s = DetectEngineAppendSig(de_ctx,
            "alert tcp any any -> any any ("
            "file_data; content:\"one\"; "
            "isdataat:!4,relative; sid:1;)");
    FAIL_IF_NULL(s);

    SigMatch *sm = s->init_data->smlists[g_file_data_buffer_id];
    FAIL_IF_NULL(sm);
    FAIL_IF_NOT(sm->type == DETECT_CONTENT);
    sm = sm->next;
    FAIL_IF_NULL(sm);
    FAIL_IF_NOT(sm->type == DETECT_ISDATAAT);

    DetectIsdataatData *data = (DetectIsdataatData *)sm->ctx;
    FAIL_IF_NOT(data->flags & ISDATAAT_RELATIVE);
    FAIL_IF_NOT(data->flags & ISDATAAT_NEGATED);
    FAIL_IF(data->flags & ISDATAAT_RAWBYTES);

    DetectEngineCtxFree(de_ctx);
    PASS;
}
开发者ID:norg,项目名称:suricata,代码行数:27,代码来源:detect-file-data.c


示例3: DetectAppLayerProtocolTest04

static int DetectAppLayerProtocolTest04(void)
{
    Signature *s = NULL;
    DetectAppLayerProtocolData *data = NULL;
    DetectEngineCtx *de_ctx = DetectEngineCtxInit();
    FAIL_IF_NULL(de_ctx);
    de_ctx->flags |= DE_QUIET;

    s = DetectEngineAppendSig(de_ctx, "alert tcp any any -> any any "
            "(app-layer-protocol:!http; sid:1;)");
    FAIL_IF_NULL(s);
    FAIL_IF(s->alproto != ALPROTO_UNKNOWN);
    FAIL_IF(s->flags & SIG_FLAG_APPLAYER);

    FAIL_IF_NULL(s->sm_lists[DETECT_SM_LIST_MATCH]);
    FAIL_IF_NULL(s->sm_lists[DETECT_SM_LIST_MATCH]->ctx);

    data = (DetectAppLayerProtocolData*)s->sm_lists[DETECT_SM_LIST_MATCH]->ctx;
    FAIL_IF_NULL(data);
    FAIL_IF(data->alproto != ALPROTO_HTTP);
    FAIL_IF(data->negated == 0);

    DetectEngineCtxFree(de_ctx);
    PASS;
}
开发者ID:bmeeks8,项目名称:suricata,代码行数:25,代码来源:detect-app-layer-protocol.c


示例4: DetectTlsIssuerTest01

/**
 * \test Test that a signature containing a tls_cert_issuer is correctly parsed
 *       and that the keyword is registered.
 */
static int DetectTlsIssuerTest01(void)
{
    DetectEngineCtx *de_ctx = NULL;
    SigMatch *sm = NULL;

    de_ctx = DetectEngineCtxInit();
    FAIL_IF_NULL(de_ctx);

    de_ctx->flags |= DE_QUIET;
    de_ctx->sig_list = SigInit(de_ctx, "alert tls any any -> any any "
                               "(msg:\"Testing tls_cert_issuer\"; "
                               "tls_cert_issuer; content:\"test\"; sid:1;)");
    FAIL_IF_NULL(de_ctx->sig_list);

    /* sm should not be in the MATCH list */
    sm = de_ctx->sig_list->sm_lists[DETECT_SM_LIST_MATCH];
    FAIL_IF_NOT_NULL(sm);

    sm = de_ctx->sig_list->sm_lists[DETECT_SM_LIST_TLSISSUER_MATCH];
    FAIL_IF_NULL(sm);

    FAIL_IF(sm->type != DETECT_CONTENT);
    FAIL_IF_NOT_NULL(sm->next);

    SigGroupCleanup(de_ctx);
    SigCleanSignatures(de_ctx);
    DetectEngineCtxFree(de_ctx);

    PASS;
}
开发者ID:P1sec,项目名称:suricata,代码行数:34,代码来源:detect-tls-cert-issuer.c


示例5: PyObject_CallFunctionObjArgs

/* out: */
PyObject *supp_convertDocumentToPythonDocument(lucene::document::Document *doc) {
  lucene::document::DocumentFieldEnumeration *fieldEnum = NULL;
  PyObject *docFields = NULL;
  PyObject *pyDoc = PyObject_CallFunctionObjArgs(global_DocumentConstructor, Py_False, NULL);
  FAIL_IF_NULL(pyDoc);
  docFields = PyDict_New();
  FAIL_IF_NULL(docFields);

  fieldEnum = doc->fields();
  while (fieldEnum->hasMoreElements()) {
    lucene::document::Field *field = fieldEnum->nextElement();

    PyObject *pyName;
    CONVERT_STRING_OUT(field->Name(), pyName);
    if (pyName == NULL) goto fail;
    PyObject *pyValue;
    CONVERT_STRING_OUT(field->StringValue(), pyValue);
    if (pyValue == NULL) {
      Py_DECREF(pyName);
      goto fail;
    }
    PyObject *pyIsStored = PyBool_FromLong( (long) field->IsStored() );
    PyObject *pyIsIndexed = PyBool_FromLong( (long) field->IsIndexed() );
    PyObject *pyIsTokenized = PyBool_FromLong( (long) field->IsTokenized() );

    PyObject *pyField = PyObject_CallFunctionObjArgs(global_FieldConstructor,
        pyName, pyValue, pyIsStored, pyIsIndexed, pyIsTokenized,
        NULL
      );
    Py_DECREF(pyValue);
    Py_DECREF(pyIsStored);
    Py_DECREF(pyIsIndexed);
    Py_DECREF(pyIsTokenized);
    if (pyField == NULL) {
      Py_DECREF(pyName);
      goto fail;
    }

    if ( PyDict_SetItem(docFields, pyName, pyField) == -1) goto fail;
    /* PyDict_SetItem established its own references to pyName and pyField. */
    Py_DECREF(pyName);
    Py_DECREF(pyField);
  }
  /* Now we have a dict containing the fields.  Attach it to pyDoc. */
  if ( PyObject_SetAttr(pyDoc, global_string__fields, docFields) == -1) goto fail;
  Py_DECREF(docFields);

  delete fieldEnum;
  return pyDoc;
  fail:
    if (!PyErr_Occurred()) PyErr_NoMemory();
    Py_XDECREF(pyDoc);
    Py_XDECREF(docFields);
    delete fieldEnum;
    return NULL;
}
开发者ID:shiwenxiang,项目名称:clucene,代码行数:57,代码来源:supp_document.cpp


示例6: DetectTemplateSignatureTest01

static int DetectTemplateSignatureTest01 (void)
{
    DetectEngineCtx *de_ctx = DetectEngineCtxInit();
    FAIL_IF_NULL(de_ctx);

    Signature *sig = DetectEngineAppendSig(de_ctx, "alert ip any any -> any any (template:1,10; sid:1; rev:1;)");
    FAIL_IF_NULL(sig);

    DetectEngineCtxFree(de_ctx);
    PASS;
}
开发者ID:bmeeks8,项目名称:suricata,代码行数:11,代码来源:detect-template.c


示例7: DetectFtpdataSignatureTest01

static int DetectFtpdataSignatureTest01(void)
{
    DetectEngineCtx *de_ctx = DetectEngineCtxInit();
    FAIL_IF_NULL(de_ctx);

    Signature *sig = DetectEngineAppendSig(de_ctx, "alert ip any any -> any any (ftpdata_command:stor; sid:1; rev:1;)");
    FAIL_IF_NULL(sig);

    DetectEngineCtxFree(de_ctx);
    PASS;
}
开发者ID:bmeeks8,项目名称:suricata,代码行数:11,代码来源:detect-ftpdata.c


示例8: DetectKrb5ErrCodeSignatureTest01

static int DetectKrb5ErrCodeSignatureTest01 (void)
{
    DetectEngineCtx *de_ctx = DetectEngineCtxInit();
    FAIL_IF_NULL(de_ctx);

    Signature *sig = DetectEngineAppendSig(de_ctx, "alert krb5 any any -> any any (krb5_err_code:10; sid:1; rev:1;)");
    FAIL_IF_NULL(sig);

    DetectEngineCtxFree(de_ctx);
    PASS;
}
开发者ID:micsoftvn,项目名称:suricata,代码行数:11,代码来源:detect-krb5-errcode.c


示例9: UTHRemoveSessionFromFlow

int UTHRemoveSessionFromFlow(Flow *f)
{
    FAIL_IF_NULL(f);
    FAIL_IF_NOT(f->proto == IPPROTO_TCP);
    TcpSession *ssn = f->protoctx;
    FAIL_IF_NULL(ssn);
    StreamTcpSessionCleanup(ssn);
    SCFree(ssn);
    f->protoctx = NULL;
    return 1;
}
开发者ID:norg,项目名称:suricata,代码行数:11,代码来源:util-unittest-helper.c


示例10: DetectHttpRequestLineTest01

/**
 * \test Test that a signature containting a http_request_line is correctly parsed
 *       and the keyword is registered.
 */
static int DetectHttpRequestLineTest01(void)
{
    DetectEngineCtx *de_ctx = DetectEngineCtxInit();
    FAIL_IF_NULL(de_ctx);

    de_ctx->flags |= DE_QUIET;
    de_ctx->sig_list = SigInit(de_ctx, "alert tcp any any -> any any "
                               "(http_request_line; content:\"GET /\"; sid:1;)");
    FAIL_IF_NULL(de_ctx->sig_list);

    DetectEngineCtxFree(de_ctx);
    PASS;
}
开发者ID:gozzy,项目名称:suricata,代码行数:17,代码来源:detect-http-request-line.c


示例11: UTHAddStreamToFlow

int UTHAddStreamToFlow(Flow *f, int direction,
    uint8_t *data, uint32_t data_len)
{
    FAIL_IF_NULL(f);
    FAIL_IF_NOT(f->proto == IPPROTO_TCP);
    FAIL_IF_NULL(f->protoctx);
    TcpSession *ssn = f->protoctx;

    StreamingBufferSegment seg;
    TcpStream *stream = direction == 0 ? &ssn->client : &ssn->server;
    int r = StreamingBufferAppend(&stream->sb, &seg, data, data_len);
    FAIL_IF_NOT(r == 0);
    stream->last_ack += data_len;
    return 1;
}
开发者ID:norg,项目名称:suricata,代码行数:15,代码来源:util-unittest-helper.c


示例12: DetectSslStateTestParseNegate

/**
 * \test Test parsing of negated states.
 */
int DetectSslStateTestParseNegate(void)
{
    DetectSslStateData *ssd = DetectSslStateParse("!client_hello");
    FAIL_IF_NULL(ssd);
    uint32_t expected = DETECT_SSL_STATE_CLIENT_HELLO;
    FAIL_IF(ssd->flags != expected || ssd->mask != expected);
    SCFree(ssd);

    ssd = DetectSslStateParse("!client_hello,!server_hello");
    FAIL_IF_NULL(ssd);
    expected = DETECT_SSL_STATE_CLIENT_HELLO | DETECT_SSL_STATE_SERVER_HELLO;
    FAIL_IF(ssd->flags != expected || ssd->mask != expected);
    SCFree(ssd);

    PASS;
}
开发者ID:P1sec,项目名称:suricata,代码行数:19,代码来源:detect-ssl-state.c


示例13: sizeof

void MixedApp::InitializeWindow(HINSTANCE instance)
{
    WNDCLASSEX wcx{};
    wcx.cbSize = sizeof(wcx);
    wcx.hbrBackground = static_cast<HBRUSH>(GetStockObject(BLACK_BRUSH));
    wcx.hInstance = instance;
    wcx.lpfnWndProc = s_WindowProc;
    wcx.lpszClassName = ClassName;

    if (RegisterClassEx(&wcx) == INVALID_ATOM)
    {
        FAIL(L"RegisterClassEx failed.");
    }

    DWORD style = WS_OVERLAPPEDWINDOW;
    RECT rc{ 0, 0, 1280, 720 };
    AdjustWindowRect(&rc, style, FALSE);

    Window = CreateWindow(ClassName, ClassName, style, CW_USEDEFAULT, CW_USEDEFAULT,
        rc.right - rc.left, rc.bottom - rc.top, nullptr, nullptr, instance, nullptr);

    FAIL_IF_NULL(Window, L"Failed to create window. Error %d", GetLastError());

    ShowWindow(Window, SW_SHOW);
    UpdateWindow(Window);
}
开发者ID:rezanour,项目名称:exploratory2,代码行数:26,代码来源:MixedApp.cpp


示例14: DecodeEthernetTestDceNextTooSmall

/**
 * Test that a DCE ethernet frame, followed by data that is too small
 * for an ethernet header.
 *
 * Redmine issue:
 * https://redmine.openinfosecfoundation.org/issues/2887
 */
static int DecodeEthernetTestDceNextTooSmall(void)
{
    uint8_t raw_eth[] = {
        0x00, 0x10, 0x94, 0x55, 0x00, 0x01, 0x00, 0x10,
        0x94, 0x56, 0x00, 0x01, 0x89, 0x03, //0x88, 0x64,

        0x00, 0x00,

        0x00, 0x10, 0x94, 0x55, 0x00, 0x01, 0x00, 0x10,
        0x94, 0x56, 0x00, 0x01,
    };

    Packet *p = SCMalloc(SIZE_OF_PACKET);
    FAIL_IF_NULL(p);
    ThreadVars tv;
    DecodeThreadVars dtv;

    memset(&dtv, 0, sizeof(DecodeThreadVars));
    memset(&tv,  0, sizeof(ThreadVars));
    memset(p, 0, SIZE_OF_PACKET);

    DecodeEthernet(&tv, &dtv, p, raw_eth, sizeof(raw_eth), NULL);

    FAIL_IF_NOT(ENGINE_ISSET_EVENT(p, ETHERNET_PKT_TOO_SMALL));

    SCFree(p);
    PASS;
}
开发者ID:gozzy,项目名称:suricata,代码行数:35,代码来源:decode-ethernet.c


示例15: frameq_enqueue_send_and_recv_vr

void frameq_enqueue_send_and_recv_vr(void* arg, struct modtest_result* result) {
	//int ret = 0;
	const char buf[] = { 0x7E, 0x00, 0x04, 0x08, 0x01, 0x56, 0x52, 0x4E };
	const int count = 8;

	struct xb_device* xbdev = (struct xb_device*)arg;
	struct sk_buff* send_buf = alloc_skb(128, GFP_KERNEL);
	struct sk_buff* skb;

	unsigned char* tail = skb_put(send_buf, count);
	memcpy(tail, buf, count);
	frameq_enqueue_send(&xbdev->send_queue, send_buf);

	FAIL_IF_NOT_EQ(1, skb_queue_len(&xbdev->send_queue));
	FAIL_IF_NOT_EQ(0, xbdev->recv_buf->len);

	xb_send(xbdev);
	skb = xb_recv(xbdev, 1, 1000);

	FAIL_IF_NULL(skb);

	FAIL_IF_NOT_EQ(0, skb_queue_len(&xbdev->send_queue));

	TEST_SUCCESS();
}
开发者ID:soburi,项目名称:XBee-linux-serial-driver,代码行数:25,代码来源:xbee802154_test.c


示例16: FlowBitsTestSig02

static int FlowBitsTestSig02(void)
{
    Signature *s = NULL;
    ThreadVars th_v;
    DetectEngineCtx *de_ctx = NULL;

    memset(&th_v, 0, sizeof(th_v));

    de_ctx = DetectEngineCtxInit();
    FAIL_IF_NULL(de_ctx);

    de_ctx->flags |= DE_QUIET;

    s = de_ctx->sig_list = SigInit(de_ctx,"alert ip any any -> any any (msg:\"isset rule need an option\"; flowbits:isset; content:\"GET \"; sid:1;)");
    FAIL_IF_NOT_NULL(s);

    s = de_ctx->sig_list = SigInit(de_ctx,"alert ip any any -> any any (msg:\"isnotset rule need an option\"; flowbits:isnotset; content:\"GET \"; sid:2;)");
    FAIL_IF_NOT_NULL(s);

    s = de_ctx->sig_list = SigInit(de_ctx,"alert ip any any -> any any (msg:\"set rule need an option\"; flowbits:set; content:\"GET \"; sid:3;)");
    FAIL_IF_NOT_NULL(s);

    s = de_ctx->sig_list = SigInit(de_ctx,"alert ip any any -> any any (msg:\"unset rule need an option\"; flowbits:unset; content:\"GET \"; sid:4;)");
    FAIL_IF_NOT_NULL(s);

    s = de_ctx->sig_list = SigInit(de_ctx,"alert ip any any -> any any (msg:\"toggle rule need an option\"; flowbits:toggle; content:\"GET \"; sid:5;)");
    FAIL_IF_NOT_NULL(s);

    DetectEngineCtxFree(de_ctx);

    PASS;
}
开发者ID:P1sec,项目名称:suricata,代码行数:32,代码来源:detect-flowbits.c


示例17: DecodeMPLSTestPacketTooSmall

static int DecodeMPLSTestPacketTooSmall(void)
{
    ThreadVars tv;
    DecodeThreadVars dtv;

    memset(&dtv, 0, sizeof(DecodeThreadVars));
    memset(&tv,  0, sizeof(ThreadVars));

    Packet *p0 = SCCalloc(1, SIZE_OF_PACKET);
    memset(p0, 0, SIZE_OF_PACKET);
    uint8_t pkt0[] = { 0x00, 0x01, 0x51, 0xff };
    DecodeMPLS(&tv, &dtv, p0, pkt0, sizeof(pkt0), NULL);
    FAIL_IF_NOT(ENGINE_ISSET_EVENT(p0, MPLS_PKT_TOO_SMALL));
    SCFree(p0);

    Packet *p1 = SCCalloc(1, SIZE_OF_PACKET);
    FAIL_IF_NULL(p1);
    uint8_t pkt1[] = { 0x00, 0x01, 0x51, 0xff, 0x45 };
    DecodeMPLS(&tv, &dtv, p1, pkt1, sizeof(pkt1), NULL);
    FAIL_IF_NOT(ENGINE_ISSET_EVENT(p1, MPLS_PKT_TOO_SMALL));
    SCFree(p1);

    Packet *p2 = SCCalloc(1, SIZE_OF_PACKET);
    FAIL_IF_NULL(p2);
    uint8_t pkt2[] = { 0x00, 0x01, 0x51, 0xff, 0x45, 0x01 };
    DecodeMPLS(&tv, &dtv, p2, pkt2, sizeof(pkt2), NULL);
    FAIL_IF_NOT(ENGINE_ISSET_EVENT(p2, MPLS_PKT_TOO_SMALL));
    SCFree(p2);

    Packet *p3 = SCCalloc(1, SIZE_OF_PACKET);
    FAIL_IF_NULL(p3);
    uint8_t pkt3[] = { 0x00, 0x01, 0x51, 0xff, 0x45, 0x01, 0x02 };
    DecodeMPLS(&tv, &dtv, p3, pkt3, sizeof(pkt3), NULL);
    FAIL_IF_NOT(ENGINE_ISSET_EVENT(p3, MPLS_PKT_TOO_SMALL));
    SCFree(p3);

    // This should not create a too small event is it has one more byte
    // than required.
    Packet *p4 = SCCalloc(1, SIZE_OF_PACKET);
    FAIL_IF_NULL(p4);
    uint8_t pkt4[] = { 0x00, 0x01, 0x51, 0xff, 0x45, 0x01, 0x02, 0x03 };
    DecodeMPLS(&tv, &dtv, p4, pkt4, sizeof(pkt4), NULL);
    FAIL_IF(ENGINE_ISSET_EVENT(p4, MPLS_PKT_TOO_SMALL));
    SCFree(p4);

    PASS;
}
开发者ID:gozzy,项目名称:suricata,代码行数:47,代码来源:decode-mpls.c


示例18: DetectSslStateTest01

int DetectSslStateTest01(void)
{
    DetectSslStateData *ssd = DetectSslStateParse("client_hello");
    FAIL_IF_NULL(ssd);
    FAIL_IF_NOT(ssd->flags == DETECT_SSL_STATE_CLIENT_HELLO);
    SCFree(ssd);
    PASS;
}
开发者ID:P1sec,项目名称:suricata,代码行数:8,代码来源:detect-ssl-state.c


示例19: DetectKrb5ErrCodeParseTest01

static int DetectKrb5ErrCodeParseTest01 (void)
{
    DetectKrb5ErrCodeData *krb5d = DetectKrb5ErrCodeParse("10");
    FAIL_IF_NULL(krb5d);
    FAIL_IF(!(krb5d->err_code == 10));
    DetectKrb5ErrCodeFree(krb5d);
    PASS;
}
开发者ID:micsoftvn,项目名称:suricata,代码行数:8,代码来源:detect-krb5-errcode.c


示例20: DetectTemplateParseTest01

static int DetectTemplateParseTest01 (void)
{
    DetectTemplateData *templated = DetectTemplateParse("1,10");
    FAIL_IF_NULL(templated);
    FAIL_IF(!(templated->arg1 == 1 && templated->arg2 == 10));
    DetectTemplateFree(templated);
    PASS;
}
开发者ID:bmeeks8,项目名称:suricata,代码行数:8,代码来源:detect-template.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ FAIL_M函数代码示例发布时间:2022-05-30
下一篇:
C++ FAIL_IF函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap