minor fixes to extras
This commit is contained in:
parent
45c6276727
commit
e48246fa63
|
@ -181,7 +181,8 @@ static int pgq_free_envelope(MmsEnvelope *e, int removefromqueue)
|
||||||
|
|
||||||
static MmsEnvelope *pgq_queue_readenvelope(char *qf, char *mms_queuedir, int shouldblock)
|
static MmsEnvelope *pgq_queue_readenvelope(char *qf, char *mms_queuedir, int shouldblock)
|
||||||
{
|
{
|
||||||
long qid, num_attempts, i, n;
|
int64_t qid;
|
||||||
|
long num_attempts, i, n;
|
||||||
time_t sendt, created, lastt, edate;
|
time_t sendt, created, lastt, edate;
|
||||||
char cmd[4*QFNAMEMAX], _qf[QFNAMEMAX*2+1];
|
char cmd[4*QFNAMEMAX], _qf[QFNAMEMAX*2+1];
|
||||||
Octstr *from = NULL;
|
Octstr *from = NULL;
|
||||||
|
@ -212,7 +213,7 @@ static MmsEnvelope *pgq_queue_readenvelope(char *qf, char *mms_queuedir, int sho
|
||||||
|
|
||||||
/* Get top-level values. */
|
/* Get top-level values. */
|
||||||
if ((s = PQgetvalue(r, 0, PQfnumber(r, "id"))) != NULL)
|
if ((s = PQgetvalue(r, 0, PQfnumber(r, "id"))) != NULL)
|
||||||
qid = strtoul(s, NULL, 10);
|
qid = strtoull(s, NULL, 10);
|
||||||
else
|
else
|
||||||
qid = 0;
|
qid = 0;
|
||||||
|
|
||||||
|
@ -247,7 +248,7 @@ static MmsEnvelope *pgq_queue_readenvelope(char *qf, char *mms_queuedir, int sho
|
||||||
|
|
||||||
PQclear(r);
|
PQclear(r);
|
||||||
|
|
||||||
sprintf(cmd, "SELECT item,value,id FROM mms_message_headers WHERE qid=%ld FOR UPDATE", qid);
|
sprintf(cmd, "SELECT item,value,id FROM mms_message_headers WHERE qid=%lld FOR UPDATE", qid);
|
||||||
r = PQexec(c, cmd);
|
r = PQexec(c, cmd);
|
||||||
|
|
||||||
if (PQresultStatus(r) != PGRES_TUPLES_OK) {
|
if (PQresultStatus(r) != PGRES_TUPLES_OK) {
|
||||||
|
@ -397,7 +398,7 @@ static MmsEnvelope *pgq_queue_readenvelope(char *qf, char *mms_queuedir, int sho
|
||||||
}
|
}
|
||||||
|
|
||||||
/* utility writer function. */
|
/* utility writer function. */
|
||||||
static int _puthdr(PGconn *c, long qid, char *hname, char *val)
|
static int _puthdr(PGconn *c, int64_t qid, char *hname, char *val)
|
||||||
{
|
{
|
||||||
char cmd[QFNAMEMAX*4+1], vbuf[2*QFNAMEMAX+1];
|
char cmd[QFNAMEMAX*4+1], vbuf[2*QFNAMEMAX+1];
|
||||||
PGresult *r;
|
PGresult *r;
|
||||||
|
@ -406,7 +407,7 @@ static int _puthdr(PGconn *c, long qid, char *hname, char *val)
|
||||||
n = strlen(val);
|
n = strlen(val);
|
||||||
PQescapeStringConn(c, vbuf, val, n < QFNAMEMAX ? n : QFNAMEMAX, NULL);
|
PQescapeStringConn(c, vbuf, val, n < QFNAMEMAX ? n : QFNAMEMAX, NULL);
|
||||||
|
|
||||||
sprintf(cmd, "INSERT INTO mms_message_headers (qid,item,value) VALUES (%ld, '%.128s', '%.128s')",
|
sprintf(cmd, "INSERT INTO mms_message_headers (qid,item,value) VALUES (%lld, '%.128s', '%.128s')",
|
||||||
qid, hname, vbuf);
|
qid, hname, vbuf);
|
||||||
|
|
||||||
r = PQexec(c, cmd);
|
r = PQexec(c, cmd);
|
||||||
|
@ -773,7 +774,7 @@ static MmsMsg *pgq_queue_getdata(MmsEnvelope *e)
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Qthread_data_t {
|
struct Qthread_data_t {
|
||||||
long qid;
|
int64_t qid;
|
||||||
char qf[QFNAMEMAX];
|
char qf[QFNAMEMAX];
|
||||||
char dir[QFNAMEMAX]; /* item to load. */
|
char dir[QFNAMEMAX]; /* item to load. */
|
||||||
|
|
||||||
|
@ -853,7 +854,7 @@ static void pgq_queue_run(char *dir,
|
||||||
struct Qthread_data_t *d = gw_malloc(sizeof *d);
|
struct Qthread_data_t *d = gw_malloc(sizeof *d);
|
||||||
|
|
||||||
memset(d, 0, sizeof *d);
|
memset(d, 0, sizeof *d);
|
||||||
d->qid = strtoul(qid, NULL, 10);
|
d->qid = strtoull(qid, NULL, 10);
|
||||||
strncpy(d->qf, qfname, sizeof d->qf);
|
strncpy(d->qf, qfname, sizeof d->qf);
|
||||||
strncpy(d->dir, dir, sizeof d->dir);
|
strncpy(d->dir, dir, sizeof d->dir);
|
||||||
d->deliver = deliver;
|
d->deliver = deliver;
|
||||||
|
|
Loading…
Reference in New Issue