Sun Studio on sparc uses different bit order

This commit is contained in:
Igor Sysoev 2007-07-17 09:23:23 +00:00
parent d3cdbc85e8
commit f42ed05e9c
6 changed files with 56 additions and 41 deletions

View File

@ -105,21 +105,21 @@ ngx_snprintf(u_char *buf, size_t max, const char *fmt, ...)
u_char *
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,
* but icc issues the warning
*/
int d;
size_t len;
uint32_t ui32;
int64_t i64;
uint64_t ui64;
ngx_msec_t ms;
ngx_str_t *s;
ngx_uint_t width, sign, hexadecimal, max_width;
static u_char hex[] = "0123456789abcdef";
static u_char HEX[] = "0123456789ABCDEF";
int d;
size_t len;
uint32_t ui32;
int64_t i64;
uint64_t ui64;
ngx_msec_t ms;
ngx_uint_t width, sign, hexadecimal, max_width;
ngx_variable_value_t *v;
static u_char hex[] = "0123456789abcdef";
static u_char HEX[] = "0123456789ABCDEF";
if (max == 0) {
return buf;
@ -188,12 +188,12 @@ ngx_vsnprintf(u_char *buf, size_t max, const char *fmt, va_list args)
switch (*fmt) {
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);
buf = ngx_cpymem(buf, s->data, len);
buf = ngx_cpymem(buf, v->data, len);
fmt++;
continue;

View File

@ -13,17 +13,28 @@
typedef struct {
size_t len;
u_char *data;
size_t len;
u_char *data;
} ngx_str_t;
typedef struct {
ngx_str_t key;
ngx_str_t value;
ngx_str_t key;
ngx_str_t value;
} 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_null_string { 0, NULL }

View File

@ -187,7 +187,7 @@ ngx_http_charset_header_filter(ngx_http_request_t *r)
{
u_char *ct;
ngx_int_t charset, source_charset;
ngx_str_t *mc, *from, *to;
ngx_str_t *mc, *from, *to, s;
ngx_uint_t n;
ngx_http_charset_t *charsets;
ngx_http_charset_ctx_t *ctx;
@ -256,8 +256,10 @@ ngx_http_charset_header_filter(ngx_http_request_t *r)
return NGX_ERROR;
}
charset = ngx_http_charset_get_charset(charsets, n,
(ngx_str_t *) vv);
s.len = vv->len;
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;
}
source_charset = ngx_http_charset_get_charset(charsets, n,
(ngx_str_t *) vv);
s.len = vv->len;
s.data = vv->data;
source_charset = ngx_http_charset_get_charset(charsets, n, &s);
}
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_str_t *charset)
{
size_t len;
ngx_uint_t i;
len = charset->len & 0xffff;
for (i = 0; i < n; i++) {
if (charsets[i].name.len != len) {
if (charsets[i].name.len != charset->len) {
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;
}
}

View File

@ -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;
size_t len;
size_t len;
ngx_str_t s;
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 */ }
@ -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_str_t s;
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;
}
v->len = s.len;
v->data = s.data;
if (v->len) {
v->valid = 1;
v->no_cachable = 0;

View File

@ -501,7 +501,7 @@ ngx_http_variable_request_set_size(ngx_http_request_t *r,
ssize_t s, *sp;
ngx_str_t val;
val.len = v->len & 0xffff;
val.len = v->len;
val.data = v->data;
s = ngx_parse_size(&val);

View File

@ -14,15 +14,7 @@
#include <ngx_http.h>
typedef struct {
unsigned len:29;
unsigned valid:1;
unsigned no_cachable:1;
unsigned not_found:1;
u_char *data;
} ngx_http_variable_value_t;
typedef ngx_variable_value_t ngx_http_variable_value_t;
#define ngx_http_variable(v) { sizeof(v) - 1, 1, 0, 0, (u_char *) v }