我有这部分代码:如果条件不工作
void query(hash_t* params) {
record_t* rec;
// Coordinator, opgroup and Opcode specified by the client
uint64_t netid = 0;
uint8_t op_code_group = 0;
uint8_t op_code = 0;
char* par;
now = mdl_now();
/* set the start and end time based on query parameters */
...........
// Network id is required
par = hash_get(params, "netid");
...........
netid = strtoull(par, NULL, 10);
par = hash_get(params, "opcode_group");
...........
op_code_group = strtoul(par, NULL, 10);
par = hash_get(params, "opcode");
...........
op_code = strtoul(par, NULL, 10);
/* seek in the bytestream */
mdl_seek(start);
while((rec = (record_t*) mdl_next(&ts)) != NULL) {
...............
// Only print records with the wanted net and opcodes
if((netid != 0) && (netid != NTOHLL(rec->net_id)))
continue;
if((opcode_group != 0) && (op_code_group != ntohl(rec->opcode_group)))
continue;
if((opcode != 0) && (op_code != ntohl(rec->opcode)))
continue;
..............
mdl_print("%u %llu %u %u %u %d\n",
sec,
NTOHLL(rec->net_id),
rec->op_code_group,
rec->op_code,
rec->payloadlength,
val);
}
}
opcode_group,操作码和其它参数传递到通过http请求的查询类。
这是一个问题: 如果我指定一个opcode_group例如= 160,结果不会显示任何东西。相反,如果我指定opcode_group = 0(所有记录),结果会显示所有记录,包括opcode_group = 160的记录。
错误在哪里?非常感谢你。
现在将开始学习如何使用调试器的好时机。 – 2013-03-06 12:23:25
调试器非常善于帮助您查找错误。用它! – 2013-03-06 12:23:30
你可以说我是CentOS的调试器吗?我不知道该怎么做... – sharkbait 2013-03-06 12:24:25