Fixed some small bugs.

This commit is contained in:
Thomas Pornin 2016-11-04 21:29:18 -04:00
parent 3210f38e04
commit bab0f8639c
4 changed files with 6 additions and 5 deletions

View file

@ -258,6 +258,9 @@ HT_expand(HT *ht)
n = ht->num_buckets; n = ht->num_buckets;
n2 = n << 1; n2 = n << 1;
new_buckets = xmalloc(n2 * sizeof *new_buckets); new_buckets = xmalloc(n2 * sizeof *new_buckets);
for (u = 0; u < n2; u ++) {
new_buckets[u] = NULL;
}
for (u = 0; u < n; u ++) { for (u = 0; u < n; u ++) {
ht_elt *e, *f; ht_elt *e, *f;
@ -509,7 +512,7 @@ static int
string_to_time(const char *s, uint32_t *days, uint32_t *seconds) string_to_time(const char *s, uint32_t *days, uint32_t *seconds)
{ {
int year, month, day, hour, minute, second; int year, month, day, hour, minute, second;
int day_of_year, leaps; int day_of_year, leaps, i;
if (parse_dec(s, 4, &year) < 0) { if (parse_dec(s, 4, &year) < 0) {
return -1; return -1;
@ -568,7 +571,7 @@ string_to_time(const char *s, uint32_t *days, uint32_t *seconds)
return -1; return -1;
} }
day_of_year = 0; day_of_year = 0;
for (int i = 1; i < month; i ++) { for (i = 1; i < month; i ++) {
day_of_year += month_length(year, i); day_of_year += month_length(year, i);
} }
if (day < 1 || day > month_length(year, month)) { if (day < 1 || day > month_length(year, month)) {

View file

@ -35,7 +35,6 @@
#include <arpa/inet.h> #include <arpa/inet.h>
#include <unistd.h> #include <unistd.h>
#include <fcntl.h> #include <fcntl.h>
#include <sys/poll.h>
#include "brssl.h" #include "brssl.h"
#include "bearssl.h" #include "bearssl.h"

View file

@ -35,7 +35,6 @@
#include <arpa/inet.h> #include <arpa/inet.h>
#include <unistd.h> #include <unistd.h>
#include <fcntl.h> #include <fcntl.h>
#include <sys/poll.h>
#include "brssl.h" #include "brssl.h"
#include "bearssl.h" #include "bearssl.h"

View file

@ -35,7 +35,7 @@
#include <arpa/inet.h> #include <arpa/inet.h>
#include <unistd.h> #include <unistd.h>
#include <fcntl.h> #include <fcntl.h>
#include <sys/poll.h> #include <poll.h>
#include "brssl.h" #include "brssl.h"
#include "bearssl.h" #include "bearssl.h"