コード例 #1
0
ファイル: message.cpp プロジェクト: ZhaozhengPlus/libqi
AnyReference Message::value(const qi::Signature &signature, const qi::TransportSocketPtr &socket) const {
    qi::TypeInterface* type = qi::TypeInterface::fromSignature(signature);
    if (!type) {
        qiLogError() <<"fromBuffer: unknown type " << signature.toString();
        throw std::runtime_error("Could not construct type for " + signature.toString());
        qiLogDebug() << "Serialized message body: " << _p->buffer.size();
    }
    qi::BufferReader br(_p->buffer);
    //TODO: not exception safe
    AnyReference res(type);
    return decodeBinary(&br, res, boost::bind(deserializeObject, _1, socket), socket.get());
}
コード例 #2
0
ファイル: freesatv2.cpp プロジェクト: Adga52/enigma2
static void loadFile(huffTableEntry **table, const char *filename)
{
	char buf[1024];
	char *from;
	char *to;
	char *binary;
	char *colon;

	CFile fp(filename, "r");
	if ( fp )
	{
		while ( fgets(buf,sizeof(buf),fp) != NULL )
		{
			// Tokenize string "in place"
			from = buf;
			colon = strchr(buf, ':');
			if (colon == NULL)
				continue;
			binary = colon + 1;
			*colon = 0;
			colon = strchr(binary, ':');
			if (colon == NULL)
				continue;
			*colon = 0;
			to = colon + 1;
			colon = strchr(to, ':');
			if (colon != NULL)
				*colon = 0;
			{
				int bin_len = strlen(binary);
				int from_char = resolveChar(from);
				char to_char = resolveChar(to);
				unsigned long bin = decodeBinary(binary);

				// Add entry to end of bucket
				huffTableEntry **pCurrent = &table[from_char];
				while ( *pCurrent != NULL )
				{
					pCurrent = &((*pCurrent)->nextEntry);
				}
				*pCurrent = new huffTableEntry(bin, bin_len, to_char);
			}
		}
	}
#ifdef FREESATV2_DEBUG
	else
	{
		eDebug("[FREESAT] Cannot load '%s'",filename);
	}
#endif
}