Skip to content

Commit

Permalink
cleaned up warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
robertdavidgraham committed Nov 2, 2023
1 parent f3c2790 commit 8196cdd
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 7 deletions.
3 changes: 2 additions & 1 deletion src/out-redis.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,10 @@ clean_response_queue(struct Output *out, SOCKET fd)
static void
redis_out_open(struct Output *out, FILE *fp)
{
/*FIXME: why did I write this code using ptrdiff_t? */
ptrdiff_t fd = (ptrdiff_t)fp;
size_t count;
unsigned char line[1024];
char line[1024];

UNUSEDPARM(out);
if (out->redis.password != NULL)
Expand Down
13 changes: 13 additions & 0 deletions src/pixie-timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,19 @@ pixie_nanotime(void)
}
#endif

/*
* Timing is incredibly importatn to masscan because we need to throttle
* how fast we spew packets. Every platofrm has slightly different timing
* even given standard APIs. We need to make sure we have an accurate
* timing function.
*
* This function tests betwe [0.9, 1.9] the expected results. I want something
* tight, like [0.99,1.01] (plus/minus 1%), but unfortunately automated
* testing platforms, like GitHub Actions, are overloaded, so when I wait
* for half a second, they might actually wait for 0.7 seconds, causing
* this test to fail. Thus, I have to greatly expand the range that passes
* this test.
*/
int pixie_time_selftest(void)
{
static const uint64_t duration = 456789;
Expand Down
6 changes: 4 additions & 2 deletions src/proto-http.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ _http_append(unsigned char **inout_header, size_t length1, size_t length2, const
}

enum What {spaces, notspaces, end_of_line, end_of_field};
size_t _skip(enum What what, const unsigned char *hdr, size_t offset, size_t header_length)
static size_t
_skip(enum What what, const unsigned char *hdr, size_t offset, size_t header_length)
{
switch (what) {
case notspaces:
Expand Down Expand Up @@ -221,7 +222,8 @@ http_change_requestline(unsigned char **hdr, size_t header_length,
return header_length;
}

size_t _field_length(const unsigned char *hdr, size_t offset, size_t hdr_length)
static size_t
_field_length(const unsigned char *hdr, size_t offset, size_t hdr_length)
{
size_t original_offset = offset;

Expand Down
6 changes: 4 additions & 2 deletions src/proto-mc.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@

static unsigned char hand_shake_ptr[128];

unsigned char* hand_shake(uint16_t port, const char* ip,size_t ip_len)
static unsigned char *
hand_shake(uint16_t port, const char* ip, size_t ip_len)
{
size_t tlen = 10+ip_len;
unsigned char * ret = (unsigned char *)calloc(1,tlen);
Expand All @@ -27,7 +28,8 @@ unsigned char* hand_shake(uint16_t port, const char* ip,size_t ip_len)
return ret;
}

void* memstr(void * mem, size_t len, char * str)
static void *
memstr(void * mem, size_t len, char * str)
{
size_t stlen = strlen(str);
if(len < stlen)
Expand Down
2 changes: 1 addition & 1 deletion src/string_s.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ errno_t fopen_s(FILE **pFile, const char *filename, const char *mode)
*/
#ifdef __GNUC__
int
memcasecmp(const void *lhs, const void *rhs, int length)
memcasecmp(const void *lhs, const void *rhs, size_t length)
{
int i;
for (i=0; i<length; i++) {
Expand Down
2 changes: 1 addition & 1 deletion src/string_s.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ errno_t fopen_s(FILE **fp, const char *filename, const char *mode);
/* GCC 4 */
# define sprintf_s snprintf
# define vsprintf_s vsnprintf
int memcasecmp(const void *lhs, const void *rhs, int length);
int memcasecmp(const void *lhs, const void *rhs, size_t length);
typedef int errno_t;
#if !defined(WIN32) /* mingw */
errno_t fopen_s(FILE **fp, const char *filename, const char *mode);
Expand Down

0 comments on commit 8196cdd

Please sign in to comment.