Skip to content

Commit

Permalink
Fix compiler warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
nateberkopec committed Aug 8, 2017
1 parent d31d68a commit de363c9
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 86 deletions.
133 changes: 65 additions & 68 deletions ext/puma_http11/http11_parser.c
Expand Up @@ -41,14 +41,11 @@ static const int puma_parser_start = 1;
static const int puma_parser_first_final = 47;
static const int puma_parser_error = 0;

static const int puma_parser_en_main = 1;


#line 82 "ext/puma_http11/http11_parser.rl"

int puma_parser_init(puma_parser *parser) {
int cs = 0;

#line 52 "ext/puma_http11/http11_parser.c"
{
cs = puma_parser_start;
Expand Down Expand Up @@ -82,7 +79,7 @@ size_t puma_parser_execute(puma_parser *parser, const char *buffer, size_t len,
/* assert(*pe == '\0' && "pointer does not end on NUL"); */
assert(pe - p == len - off && "pointers aren't same distance");


#line 86 "ext/puma_http11/http11_parser.c"
{
if ( p == pe )
Expand Down Expand Up @@ -131,7 +128,7 @@ case 2:
goto st0;
tr2:
#line 47 "ext/puma_http11/http11_parser.rl"
{
{
parser->request_method(parser, PTR_TO(mark), LEN(mark, p));
}
goto st3;
Expand Down Expand Up @@ -171,7 +168,7 @@ case 4:
goto st0;
tr8:
#line 50 "ext/puma_http11/http11_parser.rl"
{
{
parser->request_uri(parser, PTR_TO(mark), LEN(mark, p));
}
goto st5;
Expand All @@ -195,29 +192,29 @@ case 4:
parser->request_path(parser, PTR_TO(mark), LEN(mark,p));
}
#line 50 "ext/puma_http11/http11_parser.rl"
{
{
parser->request_uri(parser, PTR_TO(mark), LEN(mark, p));
}
goto st5;
tr44:
#line 57 "ext/puma_http11/http11_parser.rl"
{ MARK(query_start, p); }
#line 58 "ext/puma_http11/http11_parser.rl"
{
{
parser->query_string(parser, PTR_TO(query_start), LEN(query_start, p));
}
#line 50 "ext/puma_http11/http11_parser.rl"
{
{
parser->request_uri(parser, PTR_TO(mark), LEN(mark, p));
}
goto st5;
tr47:
#line 58 "ext/puma_http11/http11_parser.rl"
{
{
parser->query_string(parser, PTR_TO(query_start), LEN(query_start, p));
}
#line 50 "ext/puma_http11/http11_parser.rl"
{
{
parser->request_uri(parser, PTR_TO(mark), LEN(mark, p));
}
goto st5;
Expand Down Expand Up @@ -296,7 +293,7 @@ case 13:
goto st0;
tr18:
#line 62 "ext/puma_http11/http11_parser.rl"
{
{
parser->http_version(parser, PTR_TO(mark), LEN(mark, p));
}
goto st14;
Expand Down Expand Up @@ -359,8 +356,8 @@ case 16:
goto st0;
tr22:
#line 70 "ext/puma_http11/http11_parser.rl"
{
parser->body_start = p - buffer + 1;
{
parser->body_start = p - buffer + 1;
parser->header_done(parser, p + 1, pe - p - 1);
{p++; cs = 47; goto _out;}
}
Expand Down Expand Up @@ -412,7 +409,7 @@ case 17:
goto st0;
tr24:
#line 39 "ext/puma_http11/http11_parser.rl"
{
{
parser->field_len = LEN(field_start, p);
}
goto st18;
Expand Down Expand Up @@ -444,7 +441,7 @@ case 19:
goto st19;
tr9:
#line 50 "ext/puma_http11/http11_parser.rl"
{
{
parser->request_uri(parser, PTR_TO(mark), LEN(mark, p));
}
goto st20;
Expand All @@ -454,29 +451,29 @@ case 19:
parser->request_path(parser, PTR_TO(mark), LEN(mark,p));
}
#line 50 "ext/puma_http11/http11_parser.rl"
{
{
parser->request_uri(parser, PTR_TO(mark), LEN(mark, p));
}
goto st20;
tr45:
#line 57 "ext/puma_http11/http11_parser.rl"
{ MARK(query_start, p); }
#line 58 "ext/puma_http11/http11_parser.rl"
{
{
parser->query_string(parser, PTR_TO(query_start), LEN(query_start, p));
}
#line 50 "ext/puma_http11/http11_parser.rl"
{
{
parser->request_uri(parser, PTR_TO(mark), LEN(mark, p));
}
goto st20;
tr48:
#line 58 "ext/puma_http11/http11_parser.rl"
{
{
parser->query_string(parser, PTR_TO(query_start), LEN(query_start, p));
}
#line 50 "ext/puma_http11/http11_parser.rl"
{
{
parser->request_uri(parser, PTR_TO(mark), LEN(mark, p));
}
goto st20;
Expand Down Expand Up @@ -982,52 +979,52 @@ case 46:
goto tr2;
goto st0;
}
_test_eof2: cs = 2; goto _test_eof;
_test_eof3: cs = 3; goto _test_eof;
_test_eof4: cs = 4; goto _test_eof;
_test_eof5: cs = 5; goto _test_eof;
_test_eof6: cs = 6; goto _test_eof;
_test_eof7: cs = 7; goto _test_eof;
_test_eof8: cs = 8; goto _test_eof;
_test_eof9: cs = 9; goto _test_eof;
_test_eof10: cs = 10; goto _test_eof;
_test_eof11: cs = 11; goto _test_eof;
_test_eof12: cs = 12; goto _test_eof;
_test_eof13: cs = 13; goto _test_eof;
_test_eof14: cs = 14; goto _test_eof;
_test_eof15: cs = 15; goto _test_eof;
_test_eof16: cs = 16; goto _test_eof;
_test_eof47: cs = 47; goto _test_eof;
_test_eof17: cs = 17; goto _test_eof;
_test_eof18: cs = 18; goto _test_eof;
_test_eof19: cs = 19; goto _test_eof;
_test_eof20: cs = 20; goto _test_eof;
_test_eof21: cs = 21; goto _test_eof;
_test_eof22: cs = 22; goto _test_eof;
_test_eof23: cs = 23; goto _test_eof;
_test_eof24: cs = 24; goto _test_eof;
_test_eof25: cs = 25; goto _test_eof;
_test_eof26: cs = 26; goto _test_eof;
_test_eof27: cs = 27; goto _test_eof;
_test_eof28: cs = 28; goto _test_eof;
_test_eof29: cs = 29; goto _test_eof;
_test_eof30: cs = 30; goto _test_eof;
_test_eof31: cs = 31; goto _test_eof;
_test_eof32: cs = 32; goto _test_eof;
_test_eof33: cs = 33; goto _test_eof;
_test_eof34: cs = 34; goto _test_eof;
_test_eof35: cs = 35; goto _test_eof;
_test_eof36: cs = 36; goto _test_eof;
_test_eof37: cs = 37; goto _test_eof;
_test_eof38: cs = 38; goto _test_eof;
_test_eof39: cs = 39; goto _test_eof;
_test_eof40: cs = 40; goto _test_eof;
_test_eof41: cs = 41; goto _test_eof;
_test_eof42: cs = 42; goto _test_eof;
_test_eof43: cs = 43; goto _test_eof;
_test_eof44: cs = 44; goto _test_eof;
_test_eof45: cs = 45; goto _test_eof;
_test_eof46: cs = 46; goto _test_eof;
_test_eof2: cs = 2; goto _test_eof;
_test_eof3: cs = 3; goto _test_eof;
_test_eof4: cs = 4; goto _test_eof;
_test_eof5: cs = 5; goto _test_eof;
_test_eof6: cs = 6; goto _test_eof;
_test_eof7: cs = 7; goto _test_eof;
_test_eof8: cs = 8; goto _test_eof;
_test_eof9: cs = 9; goto _test_eof;
_test_eof10: cs = 10; goto _test_eof;
_test_eof11: cs = 11; goto _test_eof;
_test_eof12: cs = 12; goto _test_eof;
_test_eof13: cs = 13; goto _test_eof;
_test_eof14: cs = 14; goto _test_eof;
_test_eof15: cs = 15; goto _test_eof;
_test_eof16: cs = 16; goto _test_eof;
_test_eof47: cs = 47; goto _test_eof;
_test_eof17: cs = 17; goto _test_eof;
_test_eof18: cs = 18; goto _test_eof;
_test_eof19: cs = 19; goto _test_eof;
_test_eof20: cs = 20; goto _test_eof;
_test_eof21: cs = 21; goto _test_eof;
_test_eof22: cs = 22; goto _test_eof;
_test_eof23: cs = 23; goto _test_eof;
_test_eof24: cs = 24; goto _test_eof;
_test_eof25: cs = 25; goto _test_eof;
_test_eof26: cs = 26; goto _test_eof;
_test_eof27: cs = 27; goto _test_eof;
_test_eof28: cs = 28; goto _test_eof;
_test_eof29: cs = 29; goto _test_eof;
_test_eof30: cs = 30; goto _test_eof;
_test_eof31: cs = 31; goto _test_eof;
_test_eof32: cs = 32; goto _test_eof;
_test_eof33: cs = 33; goto _test_eof;
_test_eof34: cs = 34; goto _test_eof;
_test_eof35: cs = 35; goto _test_eof;
_test_eof36: cs = 36; goto _test_eof;
_test_eof37: cs = 37; goto _test_eof;
_test_eof38: cs = 38; goto _test_eof;
_test_eof39: cs = 39; goto _test_eof;
_test_eof40: cs = 40; goto _test_eof;
_test_eof41: cs = 41; goto _test_eof;
_test_eof42: cs = 42; goto _test_eof;
_test_eof43: cs = 43; goto _test_eof;
_test_eof44: cs = 44; goto _test_eof;
_test_eof45: cs = 45; goto _test_eof;
_test_eof46: cs = 46; goto _test_eof;

_test_eof: {}
_out: {}
Expand Down
4 changes: 2 additions & 2 deletions ext/puma_http11/mini_ssl.c
Expand Up @@ -244,7 +244,7 @@ void raise_error(SSL* ssl, int result) {
const char* err_str;
int err = errno;
int ssl_err = SSL_get_error(ssl, result);
int verify_err = SSL_get_verify_result(ssl);
int verify_err = (int) SSL_get_verify_result(ssl);

if(SSL_ERROR_SYSCALL == ssl_err) {
snprintf(msg, sizeof(msg), "System error: %s - %d", strerror(err), err);
Expand All @@ -257,7 +257,7 @@ void raise_error(SSL* ssl, int result) {
err_str, verify_err);

} else {
err = ERR_get_error();
err = (int) ERR_get_error();
ERR_error_string_n(err, buf, sizeof(buf));
snprintf(msg, sizeof(msg), "OpenSSL error: %s - %d", buf, err);

Expand Down
29 changes: 13 additions & 16 deletions ext/puma_http11/org/jruby/puma/Http11Parser.java
Expand Up @@ -182,9 +182,6 @@ private static byte[] init__puma_parser_trans_actions_0()
static final int puma_parser_first_final = 47;
static final int puma_parser_error = 0;

static final int puma_parser_en_main = 1;


// line 69 "ext/puma_http11/http11_parser.java.rl"

public static interface ElementCB {
Expand Down Expand Up @@ -220,7 +217,7 @@ public static class HttpParser {
public void init() {
cs = 0;


// line 225 "ext/puma_http11/org/jruby/puma/Http11Parser.java"
{
cs = puma_parser_start;
Expand Down Expand Up @@ -252,7 +249,7 @@ public int execute(ByteList buffer, int off) {
byte[] data = buffer.bytes();
parser.buffer = buffer;


// line 257 "ext/puma_http11/org/jruby/puma/Http11Parser.java"
{
int _klen;
Expand Down Expand Up @@ -347,7 +344,7 @@ else if ( data[p] > _puma_parser_trans_keys[_mid+1] )
break;
case 3:
// line 17 "ext/puma_http11/http11_parser.java.rl"
{
{
parser.field_len = p-parser.field_start;
}
break;
Expand All @@ -357,29 +354,29 @@ else if ( data[p] > _puma_parser_trans_keys[_mid+1] )
break;
case 5:
// line 22 "ext/puma_http11/http11_parser.java.rl"
{
{
if(parser.http_field != null) {
parser.http_field.call(parser.data, parser.field_start, parser.field_len, parser.mark, p-parser.mark);
}
}
break;
case 6:
// line 27 "ext/puma_http11/http11_parser.java.rl"
{
if(parser.request_method != null)
{
if(parser.request_method != null)
parser.request_method.call(parser.data, parser.mark, p-parser.mark);
}
break;
case 7:
// line 31 "ext/puma_http11/http11_parser.java.rl"
{
{
if(parser.request_uri != null)
parser.request_uri.call(parser.data, parser.mark, p-parser.mark);
}
break;
case 8:
// line 35 "ext/puma_http11/http11_parser.java.rl"
{
{
if(parser.fragment != null)
parser.fragment.call(parser.data, parser.mark, p-parser.mark);
}
Expand All @@ -390,14 +387,14 @@ else if ( data[p] > _puma_parser_trans_keys[_mid+1] )
break;
case 10:
// line 41 "ext/puma_http11/http11_parser.java.rl"
{
{
if(parser.query_string != null)
parser.query_string.call(parser.data, parser.query_start, p-parser.query_start);
}
break;
case 11:
// line 46 "ext/puma_http11/http11_parser.java.rl"
{
{
if(parser.http_version != null)
parser.http_version.call(parser.data, parser.mark, p-parser.mark);
}
Expand All @@ -411,8 +408,8 @@ else if ( data[p] > _puma_parser_trans_keys[_mid+1] )
break;
case 13:
// line 56 "ext/puma_http11/http11_parser.java.rl"
{
parser.body_start = p + 1;
{
parser.body_start = p + 1;
if(parser.header_done != null)
parser.header_done.call(parser.data, p + 1, pe - p - 1);
{ p += 1; _goto_targ = 5; if (true) continue _goto;}
Expand Down Expand Up @@ -442,7 +439,7 @@ else if ( data[p] > _puma_parser_trans_keys[_mid+1] )

parser.cs = cs;
parser.nread += (p - off);

assert p <= pe : "buffer overflow after parsing execute";
assert parser.nread <= len : "nread longer than length";
assert parser.body_start <= len : "body starts after buffer end";
Expand Down

0 comments on commit de363c9

Please sign in to comment.