Skip to content

Commit

Permalink
htable: updated for avp long value field
Browse files Browse the repository at this point in the history
  • Loading branch information
miconda committed Nov 21, 2022
1 parent d2f1e39 commit ce0d289
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions src/modules/htable/ht_api.c
Expand Up @@ -975,7 +975,7 @@ int ht_dbg(void)
if(it->flags&AVP_VAL_STR)
LM_ERR("\tv-s:%.*s\n", it->value.s.len, it->value.s.s);
else
LM_ERR("\tv-i:%d\n", it->value.n);
LM_ERR("\tv-i:%ld\n", it->value.n);
it = it->next;
}
ht_slot_unlock(ht, i);
Expand Down Expand Up @@ -1046,10 +1046,10 @@ int ht_table_spec(char *spec)
LM_DBG("htable [%.*s] - dbmode [%u]\n", name.len, name.s,
dbmode);
} else if(pit->name.len==7 && strncmp(pit->name.s, "initval", 7)==0) {
if(str2sint(&tok, &ival.n)!=0)
if(str2slong(&tok, &ival.n)!=0)
goto error;
itype = PV_VAL_INT;
LM_DBG("htable [%.*s] - initval [%d]\n", name.len, name.s,
LM_DBG("htable [%.*s] - initval [%ld]\n", name.len, name.s,
ival.n);
} else if(pit->name.len == 12 && strncmp(pit->name.s, "updateexpire", 12) == 0) {
if(str2int(&tok, &updateexpire) != 0)
Expand Down Expand Up @@ -1268,7 +1268,7 @@ int ht_set_cell_expire(ht_t *ht, str *name, int type, int_str *val)
now = 0;
if(val->n>0)
now = time(NULL) + val->n;
LM_DBG("set auto-expire to %u (%d)\n", (unsigned int)now,
LM_DBG("set auto-expire to %u (%ld)\n", (unsigned int)now,
val->n);

ht_slot_lock(ht, idx);
Expand Down
10 changes: 5 additions & 5 deletions src/modules/htable/ht_db.c
Expand Up @@ -331,7 +331,7 @@ int ht_db_load_table(ht_t *ht, str *dbtable, int mode)
if(ht->htexpire > 0 && ht_db_expires_flag!=0) {
expires.n = RES_ROWS(db_res)[i].values[4].val.int_val;
if (expires.n > 0 && expires.n < now) {
LM_DBG("skipping expired entry [%.*s] (%d)\n", kname.len,
LM_DBG("skipping expired entry [%.*s] (%ld)\n", kname.len,
kname.s, expires.n-now);
continue;
}
Expand Down Expand Up @@ -412,15 +412,15 @@ int ht_db_load_table(ht_t *ht, str *dbtable, int mode)
LM_ERR("null value in row %d\n", i);
goto error;
}
str2sint(&kvalue, &val.n);
str2slong(&kvalue, &val.n);
break;
case DB1_BLOB:
kvalue = RES_ROWS(db_res)[i].values[3].val.blob_val;
if(kvalue.s==NULL) {
LM_ERR("null value in row %d\n", i);
goto error;
}
str2sint(&kvalue, &val.n);
str2slong(&kvalue, &val.n);
break;
case DB1_STRING:
kvalue.s = (char*)(RES_ROWS(db_res)[i].values[3].val.string_val);
Expand All @@ -429,7 +429,7 @@ int ht_db_load_table(ht_t *ht, str *dbtable, int mode)
goto error;
}
kvalue.len = strlen(kvalue.s);
str2sint(&kvalue, &val.n);
str2slong(&kvalue, &val.n);
break;
case DB1_INT:
val.n = RES_ROWS(db_res)[i].values[3].val.int_val;
Expand Down Expand Up @@ -589,7 +589,7 @@ int ht_db_save_table(ht_t *ht, str *dbtable)
LM_DBG("entry key: [%.*s] value: [%.*s] (str)\n",
it->name.len, it->name.s, it->value.s.len, it->value.s.s);
} else {
LM_DBG("entry key: [%.*s] value: [%d] (int)\n",
LM_DBG("entry key: [%.*s] value: [%ld] (int)\n",
it->name.len, it->name.s, it->value.n);
}

Expand Down

0 comments on commit ce0d289

Please sign in to comment.