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


C++ FAIL_IF_NULL函数代码示例

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


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


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