Пример #1
0
int RedisCli::_exeCmdWithOutputM(T &output, const string &cmdName, const string &key,
                                 const U&input)
{
    int ret = 0;
    int argc = 0;
    const char **argv = NULL;
    size_t *argvLen = NULL;
    int i = 0;
    Replyer rpler;
    typename U::const_iterator it = input.begin();

    argc = _argSize(input) + 1;
    if (!key.empty()) argc++;

    argv = (const char **)malloc(sizeof(char *) * argc);
    if (!argv) {
        ret = -1;
        goto exit;
    }

    argvLen = (size_t *)malloc(sizeof(size_t) * argc);
    if (!argvLen) {
        ret = -1;
        goto exit;
    }

    argv[i] = cmdName.data();
    argvLen[i++] = cmdName.size();
    if (!key.empty()) {
        argv[i] = key.data();
        argvLen[i++] = key.size();
    }

    for (; it != input.end(); it++, i++) {
        _fillData(i, argv, argvLen, it);
    }

    ret = _exeCmd(rpler, argc, argv, argvLen);
    if (ret < 0) {
        ret = -1;
    } else {
        ret = getResultFromReply(rpler.reply(), output);
    }
exit:
    if (argv) free(argv);
    if (argvLen) free(argvLen);
    return ret;
}
Пример #2
0
void MeshManager::loadNormals(BasicMesh* result, const std::string& readLine, GameFile* file)
{
	_fillData(result->m_normals, file, 3, readLine);
}
Пример #3
0
void MeshManager::loadUvs(BasicMesh* result, const std::string& readLine, GameFile* file)
{
	_fillData(result->m_uvs, file, 2, readLine);
}
Пример #4
0
void MeshManager::loadIndices(BasicMesh* result, const std::string& readLine, GameFile* file)
{
	 result->m_indicesCount = _fillData(result->m_indices, file, 3, readLine);
}
Пример #5
0
void MeshManager::loadVertices(BasicMesh* result, const std::string& readLine, GameFile* file)
{
	int count = _fillData(result->m_vertices, file, 3, readLine);
	result->m_verticesCount = count / 3; // fillData returns the float array size, which is 3*vertices count
}