mirror of
https://github.com/nginx/nginx.git
synced 2025-01-07 06:33:00 -06:00
Sun Studio on sparc uses different bit order
This commit is contained in:
parent
d3cdbc85e8
commit
f42ed05e9c
@ -105,21 +105,21 @@ ngx_snprintf(u_char *buf, size_t max, const char *fmt, ...)
|
|||||||
u_char *
|
u_char *
|
||||||
ngx_vsnprintf(u_char *buf, size_t max, const char *fmt, va_list args)
|
ngx_vsnprintf(u_char *buf, size_t max, const char *fmt, va_list args)
|
||||||
{
|
{
|
||||||
u_char *p, zero, *last, temp[NGX_INT64_LEN + 1];
|
u_char *p, zero, *last, temp[NGX_INT64_LEN + 1];
|
||||||
/*
|
/*
|
||||||
* really we need temp[NGX_INT64_LEN] only,
|
* really we need temp[NGX_INT64_LEN] only,
|
||||||
* but icc issues the warning
|
* but icc issues the warning
|
||||||
*/
|
*/
|
||||||
int d;
|
int d;
|
||||||
size_t len;
|
size_t len;
|
||||||
uint32_t ui32;
|
uint32_t ui32;
|
||||||
int64_t i64;
|
int64_t i64;
|
||||||
uint64_t ui64;
|
uint64_t ui64;
|
||||||
ngx_msec_t ms;
|
ngx_msec_t ms;
|
||||||
ngx_str_t *s;
|
ngx_uint_t width, sign, hexadecimal, max_width;
|
||||||
ngx_uint_t width, sign, hexadecimal, max_width;
|
ngx_variable_value_t *v;
|
||||||
static u_char hex[] = "0123456789abcdef";
|
static u_char hex[] = "0123456789abcdef";
|
||||||
static u_char HEX[] = "0123456789ABCDEF";
|
static u_char HEX[] = "0123456789ABCDEF";
|
||||||
|
|
||||||
if (max == 0) {
|
if (max == 0) {
|
||||||
return buf;
|
return buf;
|
||||||
@ -188,12 +188,12 @@ ngx_vsnprintf(u_char *buf, size_t max, const char *fmt, va_list args)
|
|||||||
switch (*fmt) {
|
switch (*fmt) {
|
||||||
|
|
||||||
case 'V':
|
case 'V':
|
||||||
s = va_arg(args, ngx_str_t *);
|
v = va_arg(args, ngx_variable_value_t *);
|
||||||
|
|
||||||
len = s->len & 0xffff;
|
len = v->len;
|
||||||
len = (buf + len < last) ? len : (size_t) (last - buf);
|
len = (buf + len < last) ? len : (size_t) (last - buf);
|
||||||
|
|
||||||
buf = ngx_cpymem(buf, s->data, len);
|
buf = ngx_cpymem(buf, v->data, len);
|
||||||
fmt++;
|
fmt++;
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
|
@ -13,17 +13,28 @@
|
|||||||
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
size_t len;
|
size_t len;
|
||||||
u_char *data;
|
u_char *data;
|
||||||
} ngx_str_t;
|
} ngx_str_t;
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
ngx_str_t key;
|
ngx_str_t key;
|
||||||
ngx_str_t value;
|
ngx_str_t value;
|
||||||
} ngx_keyval_t;
|
} ngx_keyval_t;
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
unsigned len:29;
|
||||||
|
|
||||||
|
unsigned valid:1;
|
||||||
|
unsigned no_cachable:1;
|
||||||
|
unsigned not_found:1;
|
||||||
|
|
||||||
|
u_char *data;
|
||||||
|
} ngx_variable_value_t;
|
||||||
|
|
||||||
|
|
||||||
#define ngx_string(str) { sizeof(str) - 1, (u_char *) str }
|
#define ngx_string(str) { sizeof(str) - 1, (u_char *) str }
|
||||||
#define ngx_null_string { 0, NULL }
|
#define ngx_null_string { 0, NULL }
|
||||||
|
|
||||||
|
@ -187,7 +187,7 @@ ngx_http_charset_header_filter(ngx_http_request_t *r)
|
|||||||
{
|
{
|
||||||
u_char *ct;
|
u_char *ct;
|
||||||
ngx_int_t charset, source_charset;
|
ngx_int_t charset, source_charset;
|
||||||
ngx_str_t *mc, *from, *to;
|
ngx_str_t *mc, *from, *to, s;
|
||||||
ngx_uint_t n;
|
ngx_uint_t n;
|
||||||
ngx_http_charset_t *charsets;
|
ngx_http_charset_t *charsets;
|
||||||
ngx_http_charset_ctx_t *ctx;
|
ngx_http_charset_ctx_t *ctx;
|
||||||
@ -256,8 +256,10 @@ ngx_http_charset_header_filter(ngx_http_request_t *r)
|
|||||||
return NGX_ERROR;
|
return NGX_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
charset = ngx_http_charset_get_charset(charsets, n,
|
s.len = vv->len;
|
||||||
(ngx_str_t *) vv);
|
s.data = vv->data;
|
||||||
|
|
||||||
|
charset = ngx_http_charset_get_charset(charsets, n, &s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -303,8 +305,10 @@ ngx_http_charset_header_filter(ngx_http_request_t *r)
|
|||||||
return NGX_ERROR;
|
return NGX_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
source_charset = ngx_http_charset_get_charset(charsets, n,
|
s.len = vv->len;
|
||||||
(ngx_str_t *) vv);
|
s.data = vv->data;
|
||||||
|
|
||||||
|
source_charset = ngx_http_charset_get_charset(charsets, n, &s);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (charset != NGX_HTTP_NO_CHARSET) {
|
if (charset != NGX_HTTP_NO_CHARSET) {
|
||||||
@ -373,17 +377,16 @@ static ngx_int_t
|
|||||||
ngx_http_charset_get_charset(ngx_http_charset_t *charsets, ngx_uint_t n,
|
ngx_http_charset_get_charset(ngx_http_charset_t *charsets, ngx_uint_t n,
|
||||||
ngx_str_t *charset)
|
ngx_str_t *charset)
|
||||||
{
|
{
|
||||||
size_t len;
|
|
||||||
ngx_uint_t i;
|
ngx_uint_t i;
|
||||||
|
|
||||||
len = charset->len & 0xffff;
|
|
||||||
|
|
||||||
for (i = 0; i < n; i++) {
|
for (i = 0; i < n; i++) {
|
||||||
if (charsets[i].name.len != len) {
|
if (charsets[i].name.len != charset->len) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ngx_strncasecmp(charsets[i].name.data, charset->data, len) == 0) {
|
if (ngx_strncasecmp(charsets[i].name.data, charset->data, charset->len)
|
||||||
|
== 0)
|
||||||
|
{
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -197,11 +197,14 @@ ngx_http_ssl_static_variable(ngx_http_request_t *r,
|
|||||||
{
|
{
|
||||||
ngx_ssl_variable_handler_pt handler = (ngx_ssl_variable_handler_pt) data;
|
ngx_ssl_variable_handler_pt handler = (ngx_ssl_variable_handler_pt) data;
|
||||||
|
|
||||||
size_t len;
|
size_t len;
|
||||||
|
ngx_str_t s;
|
||||||
|
|
||||||
if (r->connection->ssl) {
|
if (r->connection->ssl) {
|
||||||
|
|
||||||
(void) handler(r->connection, NULL, (ngx_str_t *) v);
|
(void) handler(r->connection, NULL, &s);
|
||||||
|
|
||||||
|
v->data = s.data;
|
||||||
|
|
||||||
for (len = 0; v->data[len]; len++) { /* void */ }
|
for (len = 0; v->data[len]; len++) { /* void */ }
|
||||||
|
|
||||||
@ -225,11 +228,17 @@ ngx_http_ssl_variable(ngx_http_request_t *r, ngx_http_variable_value_t *v,
|
|||||||
{
|
{
|
||||||
ngx_ssl_variable_handler_pt handler = (ngx_ssl_variable_handler_pt) data;
|
ngx_ssl_variable_handler_pt handler = (ngx_ssl_variable_handler_pt) data;
|
||||||
|
|
||||||
|
ngx_str_t s;
|
||||||
|
|
||||||
if (r->connection->ssl) {
|
if (r->connection->ssl) {
|
||||||
if (handler(r->connection, r->pool, (ngx_str_t *) v) != NGX_OK) {
|
|
||||||
|
if (handler(r->connection, r->pool, &s) != NGX_OK) {
|
||||||
return NGX_ERROR;
|
return NGX_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
v->len = s.len;
|
||||||
|
v->data = s.data;
|
||||||
|
|
||||||
if (v->len) {
|
if (v->len) {
|
||||||
v->valid = 1;
|
v->valid = 1;
|
||||||
v->no_cachable = 0;
|
v->no_cachable = 0;
|
||||||
|
@ -501,7 +501,7 @@ ngx_http_variable_request_set_size(ngx_http_request_t *r,
|
|||||||
ssize_t s, *sp;
|
ssize_t s, *sp;
|
||||||
ngx_str_t val;
|
ngx_str_t val;
|
||||||
|
|
||||||
val.len = v->len & 0xffff;
|
val.len = v->len;
|
||||||
val.data = v->data;
|
val.data = v->data;
|
||||||
|
|
||||||
s = ngx_parse_size(&val);
|
s = ngx_parse_size(&val);
|
||||||
|
@ -14,15 +14,7 @@
|
|||||||
#include <ngx_http.h>
|
#include <ngx_http.h>
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
typedef ngx_variable_value_t ngx_http_variable_value_t;
|
||||||
unsigned len:29;
|
|
||||||
|
|
||||||
unsigned valid:1;
|
|
||||||
unsigned no_cachable:1;
|
|
||||||
unsigned not_found:1;
|
|
||||||
|
|
||||||
u_char *data;
|
|
||||||
} ngx_http_variable_value_t;
|
|
||||||
|
|
||||||
#define ngx_http_variable(v) { sizeof(v) - 1, 1, 0, 0, (u_char *) v }
|
#define ngx_http_variable(v) { sizeof(v) - 1, 1, 0, 0, (u_char *) v }
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user