Fix signed and unsigned comparasion while I'm here.
p = b;
c = p;
- while (p - b < remain) {
+ while (p - b < (gint)remain) {
switch (state) {
case 0:
/* Read version */
break;
case 2:
/* Read message */
- if (g_ascii_isspace (*p) || p - b == remain - 1) {
+ if (g_ascii_isspace (*p) || p - b == (gint)remain - 1) {
state = 99;
next_state = 3;
}
}
c = p;
- while (p - b < remain) {
+ while (p - b < (gint)remain) {
switch (state) {
case 0:
/* Read metric's name */
break;
case 4:
/* Read required score */
- if (g_ascii_isspace (*p) || p - b == remain - 1) {
+ if (g_ascii_isspace (*p) || p - b == (gint)remain - 1) {
new->required_score = strtod (c, &err_str);
if (*err_str != *p && *err_str != *(p + 1)) {
/* Invalid score */
break;
case 6:
/* Read reject score */
- if (g_ascii_isspace (*p) || p - b == remain - 1) {
+ if (g_ascii_isspace (*p) || p - b == (gint)remain - 1) {
new->reject_score = strtod (c, &err_str);
if (*err_str != *p && *err_str != *(p + 1)) {
/* Invalid score */
p ++;
}
c = p;
- while (p - b < remain) {
+ while (p - b < (gint)remain) {
switch (state) {
case 0:
/* Read symbol's name */
- if (p - b == remain - 1 || *p == ';' || *p == '(') {
+ if (p - b == (gint)remain - 1 || *p == ';' || *p == '(') {
if (p - c <= 1) {
/* Empty symbol name */
goto err;
}
else {
- if (p - b == remain - 1) {
+ if (p - b == (gint)remain - 1) {
l = p - c + 1;
}
else {
break;
case 2:
/* Read description */
- if (*p == ';' || p - b == remain - 1) {
+ if (*p == ';' || p - b == (gint)remain - 1) {
if (*p == ';') {
l = p - c;
}
break;
case 3:
/* Read option */
- if (*p == ',' || p - b == remain - 1) {
+ if (*p == ',' || p - b == (gint)remain - 1) {
/* Insert option into linked list */
l = p - c;
- if (p - b == remain - 1) {
+ if (p - b == (gint)remain - 1) {
l ++;
}
sym = g_malloc (l + 1);
p = b;
c = b;
- while (p - b < remain) {
+ while (p - b < (gint)remain) {
switch (state) {
case 0:
/* Read action */
}
break;
case 1:
- if (p - b == remain - 1) {
+ if (p - b == (gint)remain - 1) {
if (p - c <= 1) {
/* Empty action name */
goto err;
p = b;
c = b;
- while (p - b < remain) {
+ while (p - b < (gint)remain) {
switch (state) {
case 0:
/* Read header name */
p ++;
break;
case 1:
- if (p - b == remain - 1) {
+ if (p - b == (gint)remain - 1) {
if (p - c <= 1) {
/* Empty action name */
goto err;
p = buf->data + buf->pos;
/* Skip \r and \n characters */
- while (p - buf->data < buf->len && (*p == '\r' || *p == '\n')) {
+ while (p - buf->data < (gint)buf->len && (*p == '\r' || *p == '\n')) {
p ++;
}
- if (p - buf->data == buf->len) {
+ if (p - buf->data == (gint)buf->len) {
/* Do not move anything */
buf->pos = 0;
return;
/* Get one word */
p = buf->data;
- while (p - buf->data < buf->pos) {
+ while (p - buf->data < (gint)buf->pos) {
if (g_ascii_isspace (*p)) {
- while (p - buf->data < buf->pos && g_ascii_isspace (*p)) {
+ while (p - buf->data < (gint)buf->pos && g_ascii_isspace (*p)) {
p ++;
}
break;
while (p < end) {
if (g_ascii_isspace (*p)) {
error = FALSE;
- while (p - buf->data < buf->pos && g_ascii_isspace (*p)) {
+ while (p - buf->data < (gint)buf->pos && g_ascii_isspace (*p)) {
p ++;
}
break;
if (g_ascii_isspace (*p)) {
error = FALSE;
/* Skip spaces after flags */
- while (p - buf->data < buf->pos && g_ascii_isspace (*p)) {
+ while (p - buf->data < (gint)buf->pos && g_ascii_isspace (*p)) {
p ++;
}
break;
}
(*rep)->data = g_malloc (idx->len);
- if ((read (log->fd, (*rep)->data, idx->len)) != idx->len) {
+ if ((read (log->fd, (*rep)->data, idx->len)) != (ssize_t)idx->len) {
msg_warn ("cannot read file %s, error %d, %s", log->filename, errno, strerror (errno));
res = FALSE;
goto end;
while (cur) {
buf = cur->data;
blen = BUFREMAIN (buf);
- if (r >= blen) {
+ if (r >= (ssize_t)blen) {
tmp = cur;
cur = g_list_previous (cur);
/* Mark this buffer as read */
else if (*err_str == 'g' || *err_str == 'G') {
result *= 1073741824L;
}
- else if (len > 0 && err_str - limit != len) {
+ else if (len > 0 && err_str - limit != (gint)len) {
msg_warn ("invalid limit value '%s' at position '%s'", limit, err_str);
result = 0;
}
l = *len;
}
- while (h - s < l) {
+ while (h - s < (gint)l) {
switch (state) {
/* Out of entitle */
case 0:
if (elt && (elt->flags & KV_ELT_PERSISTENT) == 0 && elt->expire > 0) {
/* Check expiration */
- if (now - elt->age > elt->expire) {
+ if (now - elt->age > (gint)elt->expire) {
/* Set need expire as we have no write lock here */
elt->flags |= KV_ELT_NEED_EXPIRE;
elt = NULL;
/* Check other elements in this queue */
TAILQ_FOREACH_SAFE (elt, &expire->head, entry, temp) {
if ((!forced &&
- (elt->flags & (KV_ELT_PERSISTENT|KV_ELT_DIRTY)) != 0) || elt->expire < (now - elt->age)) {
+ (elt->flags & (KV_ELT_PERSISTENT|KV_ELT_DIRTY)) != 0) || (gint)elt->expire < (now - elt->age)) {
break;
}
storage->memory -= ELT_SIZE (elt);
*/
db->envp->set_lk_detect (db->envp, DB_LOCK_DEFAULT);
+ /*
+ * Avoid explicit sync on committing
+ */
+ db->envp->set_flags (db->envp, DB_TXN_NOSYNC, 1);
+
flags = DB_CREATE | DB_THREAD;
/* Create and open db pointer */
if ((ret = db_create (&db->dbp, db->envp, 0)) != 0) {
goto err;
}
- if ((ret = db->dbp->open (db->dbp, NULL, db->filename, NULL, DB_BTREE, flags, 0)) != 0) {
+ if ((ret = db->dbp->open (db->dbp, NULL, db->filename, NULL, DB_HASH, flags, 0)) != 0) {
goto err;
}
}
/* Now we have directory, append base64 encoded filename */
k = key;
- if (end - p < keylen * 2 + 1) {
+ if (end - p < (gint)keylen * 2 + 1) {
/* Filebuf is not large enough */
return FALSE;
}
return URI_ERRNO_NO_PORT_COLON;
/* We only use 8 bits for portlen so better check */
- if (uri->portlen != port_end - host_end)
+ if ((gint)uri->portlen != port_end - host_end)
return URI_ERRNO_INVALID_PORT;
/* test if port is number */