Skip to content

Commit

Permalink
Fix compile issue for LLVM
Browse files Browse the repository at this point in the history
  • Loading branch information
evanmiller committed Jan 1, 2011
1 parent 4dc7e01 commit a1fe308
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 31 deletions.
57 changes: 29 additions & 28 deletions ngx_http_zip_parsers.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ ngx_http_zip_file_init(ngx_http_zip_file_t *parsing_file)
parsing_file->need_zip64_offset = 0;
}

inline char hex_char_value(unsigned char ch) {
static char
hex_char_value(unsigned char ch) {
if ('0' <= ch && ch <= '9')
return ch - '0';
if ('A' <= ch && ch <= 'F')
Expand All @@ -38,7 +39,8 @@ inline char hex_char_value(unsigned char ch) {
return 0;
}

size_t destructive_url_decode_len(unsigned char* start, unsigned char* end)
static size_t
destructive_url_decode_len(unsigned char* start, unsigned char* end)
{
unsigned char *read_pos = start, *write_pos = start;

Expand Down Expand Up @@ -86,7 +88,7 @@ ngx_http_zip_clean_range(ngx_http_zip_range_t *range,
}


#line 90 "ngx_http_zip_parsers.c"
#line 92 "ngx_http_zip_parsers.c"
static const char _request_actions[] = {
0, 1, 1, 1, 2, 1, 3, 1,
4, 1, 5, 1, 6, 1, 7, 1,
Expand Down Expand Up @@ -150,7 +152,7 @@ static const int request_error = 0;
static const int request_en_main = 1;


#line 89 "ngx_http_zip_parsers.rl"
#line 91 "ngx_http_zip_parsers.rl"


ngx_int_t
Expand All @@ -162,12 +164,12 @@ ngx_http_zip_parse_request(ngx_http_zip_ctx_t *ctx)
ngx_http_zip_file_t *parsing_file = NULL;


#line 166 "ngx_http_zip_parsers.c"
#line 168 "ngx_http_zip_parsers.c"
{
cs = request_start;
}

#line 171 "ngx_http_zip_parsers.c"
#line 173 "ngx_http_zip_parsers.c"
{
int _klen;
unsigned int _trans;
Expand Down Expand Up @@ -242,7 +244,7 @@ ngx_http_zip_parse_request(ngx_http_zip_ctx_t *ctx)
switch ( *_acts++ )
{
case 0:
#line 101 "ngx_http_zip_parsers.rl"
#line 103 "ngx_http_zip_parsers.rl"
{
parsing_file = ngx_array_push(&ctx->files);
ngx_http_zip_file_init(parsing_file);
Expand All @@ -251,39 +253,38 @@ ngx_http_zip_parse_request(ngx_http_zip_ctx_t *ctx)
}
break;
case 1:
#line 108 "ngx_http_zip_parsers.rl"
#line 110 "ngx_http_zip_parsers.rl"
{
parsing_file->uri.data = p;
parsing_file->uri.len = 1;
}
break;
case 2:
#line 113 "ngx_http_zip_parsers.rl"
#line 115 "ngx_http_zip_parsers.rl"
{
//parsing_file->uri.len = fpc - parsing_file->uri.data;
parsing_file->uri.len = destructive_url_decode_len(parsing_file->uri.data, p);
}
break;
case 3:
#line 117 "ngx_http_zip_parsers.rl"
#line 118 "ngx_http_zip_parsers.rl"
{
parsing_file->args.data = p;
}
break;
case 4:
#line 120 "ngx_http_zip_parsers.rl"
#line 121 "ngx_http_zip_parsers.rl"
{
parsing_file->args.len = p - parsing_file->args.data;
}
break;
case 5:
#line 123 "ngx_http_zip_parsers.rl"
#line 124 "ngx_http_zip_parsers.rl"
{
parsing_file->size = parsing_file->size * 10 + ((*p) - '0');
}
break;
case 6:
#line 126 "ngx_http_zip_parsers.rl"
#line 127 "ngx_http_zip_parsers.rl"
{
if ((*p) == '-') {
ctx->missing_crc32 = 1;
Expand All @@ -303,18 +304,18 @@ ngx_http_zip_parse_request(ngx_http_zip_ctx_t *ctx)
}
break;
case 7:
#line 143 "ngx_http_zip_parsers.rl"
#line 144 "ngx_http_zip_parsers.rl"
{
parsing_file->filename.data = p;
}
break;
case 8:
#line 146 "ngx_http_zip_parsers.rl"
#line 147 "ngx_http_zip_parsers.rl"
{
parsing_file->filename.len = p - parsing_file->filename.data;
}
break;
#line 318 "ngx_http_zip_parsers.c"
#line 319 "ngx_http_zip_parsers.c"
}
}

Expand All @@ -327,7 +328,7 @@ ngx_http_zip_parse_request(ngx_http_zip_ctx_t *ctx)
_out: {}
}

#line 165 "ngx_http_zip_parsers.rl"
#line 166 "ngx_http_zip_parsers.rl"


if (cs < request_first_final) {
Expand All @@ -340,7 +341,7 @@ ngx_http_zip_parse_request(ngx_http_zip_ctx_t *ctx)
}


#line 344 "ngx_http_zip_parsers.c"
#line 345 "ngx_http_zip_parsers.c"
static const char _range_actions[] = {
0, 1, 0, 1, 1, 1, 2, 2,
0, 1, 2, 3, 1
Expand Down Expand Up @@ -393,7 +394,7 @@ static const int range_error = 0;
static const int range_en_main = 1;


#line 179 "ngx_http_zip_parsers.rl"
#line 180 "ngx_http_zip_parsers.rl"


ngx_int_t
Expand All @@ -406,12 +407,12 @@ ngx_http_zip_parse_range(ngx_http_request_t *r, ngx_str_t *range_str, ngx_http_z
u_char *pe = range_str->data + range_str->len;


#line 410 "ngx_http_zip_parsers.c"
#line 411 "ngx_http_zip_parsers.c"
{
cs = range_start;
}

#line 415 "ngx_http_zip_parsers.c"
#line 416 "ngx_http_zip_parsers.c"
{
int _klen;
unsigned int _trans;
Expand Down Expand Up @@ -485,7 +486,7 @@ ngx_http_zip_parse_range(ngx_http_request_t *r, ngx_str_t *range_str, ngx_http_z
switch ( *_acts++ )
{
case 0:
#line 191 "ngx_http_zip_parsers.rl"
#line 192 "ngx_http_zip_parsers.rl"
{
if (range) {
if (ngx_http_zip_clean_range(range, prefix, suffix, ctx) == NGX_ERROR) {
Expand All @@ -501,18 +502,18 @@ ngx_http_zip_parse_range(ngx_http_request_t *r, ngx_str_t *range_str, ngx_http_z
}
break;
case 1:
#line 205 "ngx_http_zip_parsers.rl"
#line 206 "ngx_http_zip_parsers.rl"
{ range->start = range->start * 10 + ((*p) - '0'); }
break;
case 2:
#line 207 "ngx_http_zip_parsers.rl"
#line 208 "ngx_http_zip_parsers.rl"
{ range->end = range->end * 10 + ((*p) - '0'); prefix = 0; }
break;
case 3:
#line 209 "ngx_http_zip_parsers.rl"
#line 210 "ngx_http_zip_parsers.rl"
{ suffix = 1; }
break;
#line 516 "ngx_http_zip_parsers.c"
#line 517 "ngx_http_zip_parsers.c"
}
}

Expand All @@ -525,7 +526,7 @@ ngx_http_zip_parse_range(ngx_http_request_t *r, ngx_str_t *range_str, ngx_http_z
_out: {}
}

#line 222 "ngx_http_zip_parsers.rl"
#line 223 "ngx_http_zip_parsers.rl"


if (cs < range_first_final) {
Expand Down
7 changes: 4 additions & 3 deletions ngx_http_zip_parsers.rl
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ ngx_http_zip_file_init(ngx_http_zip_file_t *parsing_file)
parsing_file->need_zip64_offset = 0;
}

inline char hex_char_value(unsigned char ch) {
static char
hex_char_value(unsigned char ch) {
if ('0' <= ch && ch <= '9')
return ch - '0';
if ('A' <= ch && ch <= 'F')
Expand All @@ -36,7 +37,8 @@ inline char hex_char_value(unsigned char ch) {
return 0;
}

size_t destructive_url_decode_len(unsigned char* start, unsigned char* end)
static size_t
destructive_url_decode_len(unsigned char* start, unsigned char* end)
{
unsigned char *read_pos = start, *write_pos = start;

Expand Down Expand Up @@ -111,7 +113,6 @@ ngx_http_zip_parse_request(ngx_http_zip_ctx_t *ctx)
}

action end_uri {
//parsing_file->uri.len = fpc - parsing_file->uri.data;
parsing_file->uri.len = destructive_url_decode_len(parsing_file->uri.data, fpc);
}
action start_args {
Expand Down

0 comments on commit a1fe308

Please sign in to comment.