コード例 #1
0
//从对象中将字符串值转换为long double并存储在target中,若失败,失败发送信息给client
int getLongDoubleFromObjectOrReply(client *c, robj *o, long double *target, const char *msg) {
    long double value;
    if (getLongDoubleFromObject(o, &value) != C_OK) {   //如果出错
        if (msg != NULL) {                  //msg不为空
            addReplyError(c,(char*)msg);    //发送指定的msg给client
        } else {
            addReplyError(c,"value is not a valid float");  //发送普通字符串
        }
        return C_ERR;
    }
    *target = value;    //将转换成功的值存到传入参数中,返回0成功
    return C_OK;
}
コード例 #2
0
ファイル: object.c プロジェクト: LichKing-lee/nbase-arc
int getLongDoubleFromObjectOrReply(client *c, robj *o, long double *target, const char *msg) {
    long double value;
    if (getLongDoubleFromObject(o, &value) != C_OK) {
        if (msg != NULL) {
            addReplyError(c,(char*)msg);
        } else {
            addReplyError(c,"value is not a valid float");
        }
        return C_ERR;
    }
    *target = value;
    return C_OK;
}
コード例 #3
0
ファイル: robj.c プロジェクト: ncloudioj/rhino-rox
int getLongDoubleFromObjectOrReply(rr_client_t *c, robj *o, long double *target, const char *msg) {
    long double value;
    if (getLongDoubleFromObject(o, &value) != RR_OK) {
        if (msg != NULL) {
            reply_add_err(c,(char*)msg);
        } else {
            reply_add_err(c,"value is not a valid float");
        }
        return RR_ERROR;
    }
    *target = value;
    return RR_OK;
}