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


C++ RawData::size方法代码示例

本文整理汇总了C++中RawData::size方法的典型用法代码示例。如果您正苦于以下问题:C++ RawData::size方法的具体用法?C++ RawData::size怎么用?C++ RawData::size使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在RawData的用法示例。


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

示例1: test_main

int test_main(int argc, char *argv[])
{
	if (argc == 1) {
		// no argument, lets run like we are in "check"
		const char * srcdir = getenv("srcdir");

		BOOST_ASSERT(srcdir != NULL);
		g_testfile = std::string(srcdir);
		g_testfile += "/ljpegtest1.jpg";
	}
	else {
		g_testfile = argv[1];
	}

	RawData *decompData;
	File::Ptr s(new File(g_testfile.c_str()));
	RawContainer *container = new JfifContainer(s, 0);

	LJpegDecompressor decompressor(s.get(), container);

	decompData = decompressor.decompress();

	boost::crc_optimal<16, 0x1021, 0xFFFF, 0, false, false>  crc_ccitt2;
	const uint8_t * data = static_cast<uint8_t *>(decompData->data());
	size_t data_len = decompData->size();
	crc_ccitt2 = std::for_each( data, data + data_len, crc_ccitt2 );

	BOOST_CHECK(crc_ccitt2() == 0x20cc);

	delete decompData;
	delete container;

	return 0;
}
开发者ID:Distrotech,项目名称:libopenraw,代码行数:34,代码来源:ljpegtest.cpp

示例2: encryptor

TEST(CryptingTest, EncryptStream)
{
	std::stringstream strmIn;
	RawData expression;
	FillStream(strmIn, expression);

	std::stringstream strmOut;
	AesEncryptor encryptor(keyNormal, ivNormal);
	uint64_t encryptedSize = 0;
	ASSERT_NO_THROW(encryptedSize = encryptor.Encrypt(strmIn, strmOut, expression.size()));
	ASSERT_EQ(encryptedSize, expression.size());

	EXPECT_EQ(encryptedSize, expression.size());
	RawData encrypted(static_cast<unsigned int>(encryptedSize));
	strmOut.read(reinterpret_cast<char*>(&encrypted[0]), encryptedSize);
	EXPECT_NE(encrypted, expression);
}
开发者ID:ElwooD07,项目名称:BdContainer,代码行数:17,代码来源:CryptingTest.cpp

示例3: expression

TEST(CryptingTest, EncryptString)
{
	RawData expression(StringToRawData("1234567890"));
	AesEncryptor encryptor(keyNormal, ivNormal);
	RawData encrypted;
	ASSERT_NO_THROW(encryptor.Encrypt(expression, encrypted));
	EXPECT_EQ(encrypted.size(), expression.size());
	EXPECT_NE(encrypted, expression);
}
开发者ID:ElwooD07,项目名称:BdContainer,代码行数:9,代码来源:CryptingTest.cpp

示例4: onResponse

void CommandManager::onResponse(CCHttpClient* client, CCHttpResponse* response)
{
    const string commandName = m_currentCommand->getName();
    if (response->isSucceed())
    {
        
        
        m_currentCommand->setCommandState(CommandStateResonsedProcessed);
        if (m_currentCommand->getMessageHandler())
        {
            int responseCode = response->getResponseCode();
            
            RawData* responseData = response->getResponseData();
            int responseDataSize = responseData->size();
            
            const char* data = &((*responseData)[0]);
            
            CCLOG("command %s response code %d length %d", commandName.c_str(), responseCode, responseDataSize);
            
            ResponseMessage message;
            bool decoded = message.ParseFromArray(data, responseDataSize);
            
            CCAssert(decoded, FORMAT("command %s decode fail data length=%d", commandName.c_str(), responseDataSize));
            
            m_currentCommand->getMessageHandler()->setMessage(&message);
            m_currentCommand->getMessageHandler()->execute();
            
        }
    }
    else
    {
        CCLOG("command %s fail errorcode=%d error message=%s", commandName.c_str(), response->getResponseCode(), response->getErrorBuffer());
        
        int resendCount = m_currentCommand->getResendCount();
        if (resendCount < MAX_RESEND_COUNT)
        {
            client->send(response->getHttpRequest());
            
            m_currentCommand->setResendCount(resendCount + 1);
            
            CCLOG("resend command %s for the %d time(s)", commandName.c_str(), resendCount);
        }
        else
        {
            CCMessageBox(FORMAT("Command fail %s", commandName.c_str()), "Error");
        }
        
    }
    
}
开发者ID:newcl,项目名称:boom,代码行数:50,代码来源:CommandManager.cpp


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