Skip to content

Commit

Permalink
Fix some warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
vstakhov committed Feb 14, 2014
1 parent ebf6eba commit 286d6ba
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 19 deletions.
4 changes: 1 addition & 3 deletions src/curve.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,7 @@ rdns_curve_ctx_add_key (struct rdns_curve_ctx *ctx,
const char *name, const unsigned char *pubkey)
{
struct rdns_curve_entry *entry;
int len;
bool success = true;
unsigned char *pk, *sk;

entry = malloc (sizeof (struct rdns_curve_entry));
if (entry != NULL) {
Expand Down Expand Up @@ -194,7 +192,7 @@ rdns_curve_hex_to_byte (const char *in, unsigned char *out)
unsigned char *
rdns_curve_key_from_hex (const char *hex)
{
int len = strlen (hex), i;
unsigned int len = strlen (hex), i;
unsigned char *res = NULL;

if (len == crypto_box_PUBLICKEYBYTES * 2) {
Expand Down
3 changes: 1 addition & 2 deletions src/packet.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ rdns_maybe_punycode_label (uint8_t *begin, uint8_t **res, uint8_t **dot, unsigne
void
rdns_format_dns_name (struct rdns_request *req, const char *name, unsigned int namelen)
{
uint8_t *pos = req->packet + req->pos, *end, *dot, *name_pos, *begin;
uint8_t *pos = req->packet + req->pos, *dot, *name_pos, *begin;
unsigned int remain = req->packet_len - req->pos - 5, label_len;
uint32_t *uclabel;
size_t punylabel_len, uclabel_len;
Expand All @@ -98,7 +98,6 @@ rdns_format_dns_name (struct rdns_request *req, const char *name, unsigned int n
}

begin = (uint8_t *)name;
end = (uint8_t *)name + namelen;
for (;;) {
/* Check label for unicode characters */
if (rdns_maybe_punycode_label (begin, &name_pos, &dot, &label_len)) {
Expand Down
2 changes: 1 addition & 1 deletion src/ref.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ typedef struct ref_entry_s {
(obj)->ref.dtor = (ref_dtor_cb_t)(dtor_cb); \
} while (0)

#ifdef HAVE_ATOMIC
#ifdef HAVE_ATOMIC_BUILTINS
#define REF_RETAIN(obj) do { \
__sync_add_and_fetch (&(obj)->ref.refcount, 1); \
} while (0)
Expand Down
7 changes: 1 addition & 6 deletions src/resolver.c
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,6 @@ rdns_parse_reply (uint8_t *in, int r, struct rdns_request *req,
{
struct dns_header *header = (struct dns_header *)in;
struct rdns_reply *rep;
struct rdns_io_channel *ioc;
struct rdns_reply_entry *elt;
uint8_t *pos;

Expand Down Expand Up @@ -289,12 +288,9 @@ void
rdns_process_timer (void *arg)
{
struct rdns_request *req = (struct rdns_request *)arg;
struct rdns_resolver *resolver;
struct rdns_reply *rep;
int r;

resolver = req->resolver;

req->retransmits --;
if (req->retransmits == 0) {
UPSTREAM_FAIL (req->io->srv, time (NULL));
Expand Down Expand Up @@ -387,7 +383,6 @@ rdns_make_request_full (
va_list args;
struct rdns_request *req;
struct rdns_server *serv;
struct in_addr *addr;
int r, type;
unsigned int i;

Expand Down Expand Up @@ -576,7 +571,7 @@ rdns_resolver_free (struct rdns_resolver *resolver)
{
struct rdns_server *serv, *stmp;
struct rdns_io_channel *ioc;
int i;
unsigned int i;

if (resolver->initialized) {
if (resolver->periodic != NULL) {
Expand Down
11 changes: 4 additions & 7 deletions src/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include <errno.h>
#include <netdb.h>
#include <fcntl.h>
#include <ctype.h>

#include "ottery.h"
#include "util.h"
Expand All @@ -53,7 +54,7 @@ rdns_make_socket_nonblocking (int fd)
static int
rdns_make_inet_socket (int type, struct addrinfo *addr)
{
int fd, r, on = 1, s_error;
int fd, r, s_error;
socklen_t optlen;
struct addrinfo *cur;

Expand Down Expand Up @@ -104,8 +105,7 @@ rdns_make_inet_socket (int type, struct addrinfo *addr)
static int
rdns_make_unix_socket (const char *path, struct sockaddr_un *addr, int type)
{
int fd = -1, s_error, r, serrno, on = 1;
struct stat st;
int fd = -1, s_error, r, serrno;
socklen_t optlen;

if (path == NULL) {
Expand Down Expand Up @@ -359,7 +359,7 @@ static bool
rdns_resolver_conf_process_line (struct rdns_resolver *resolver, char *line)
{
char *p, *c;
bool has_obrace = false, maybe_v6 = false;
bool has_obrace = false;
unsigned int port = dns_port;

if (strncmp (line, "nameserver", sizeof ("nameserver") - 1) == 0) {
Expand All @@ -375,9 +375,6 @@ rdns_resolver_conf_process_line (struct rdns_resolver *resolver, char *line)
if (isxdigit (*p)) {
c = p;
while (isxdigit (*p) || *p == ':' || *p == '.') {
if (*p == ':') {
maybe_v6 = true;
}
p ++;
}
if (has_obrace && *p != ']') {
Expand Down

0 comments on commit 286d6ba

Please sign in to comment.