Klaus Demo nginx / 74b7a91
Win32: Borland C compatibility fixes. Several false positive warnings silenced, notably W8012 "Comparing signed and unsigned" (due to u_short values promoted to int), and W8072 "Suspicious pointer arithmetic" (due to large type values added to pointers). With this patch, it's now again possible to compile nginx using bcc32, with options we normally compile on win32 minus ipv6 and ssl. Maxim Dounin 8 years ago
9 changed file(s) with 27 addition(s) and 15 deletion(s). Raw diff Collapse all Expand all
1212
1313 bcc32 -c $(CFLAGS) -I. $(PCREFLAGS) pcre_*.c
1414
15 > pcre.lst
16 for %n in (*.obj) do @echo +%n & >> pcre.lst
15 copy /y nul pcre.lst
16 for %n in (*.obj) do @echo +%n ^^& >> pcre.lst
1717 echo + >> pcre.lst
1818
1919 tlib pcre.lib @pcre.lst
296296
297297 cidr = ecf->debug_connection.elts;
298298 for (i = 0; i < ecf->debug_connection.nelts; i++) {
299 if (cidr[i].family != c->sockaddr->sa_family) {
299 if (cidr[i].family != (ngx_uint_t) c->sockaddr->sa_family) {
300300 goto next;
301301 }
302302
519519 return NGX_OK;
520520 }
521521
522 last += u->length - NGX_HTTP_MEMCACHED_END;
522 last += (size_t) (u->length - NGX_HTTP_MEMCACHED_END);
523523
524524 if (ngx_strncmp(last, ngx_http_memcached_end, b->last - last) != 0) {
525525 ngx_log_error(NGX_LOG_ERR, ctx->request->connection->log, 0,
156156 #define ngx_mp4_atom_header(mp4) (mp4->buffer_pos - 8)
157157 #define ngx_mp4_atom_data(mp4) mp4->buffer_pos
158158 #define ngx_mp4_atom_data_size(t) (uint64_t) (sizeof(t) - 8)
159 #define ngx_mp4_atom_next(mp4, n) mp4->buffer_pos += n; mp4->offset += n
159
160
161 #define ngx_mp4_atom_next(mp4, n) \
162 mp4->buffer_pos += (size_t) n; \
163 mp4->offset += n
160164
161165
162166 #define ngx_mp4_set_atom_name(p, n1, n2, n3, n4) \
955959 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, mp4->file.log, 0, "mp4 ftyp atom");
956960
957961 if (atom_data_size > 1024
958 || ngx_mp4_atom_data(mp4) + atom_data_size > mp4->buffer_end)
962 || ngx_mp4_atom_data(mp4) + (size_t) atom_data_size > mp4->buffer_end)
959963 {
960964 ngx_log_error(NGX_LOG_ERR, mp4->file.log, 0,
961965 "\"%s\" mp4 ftyp atom is too large:%uL",
13031307
13041308 trak->out[NGX_HTTP_MP4_TRAK_ATOM].buf = atom;
13051309
1306 atom_end = mp4->buffer_pos + atom_data_size;
1310 atom_end = mp4->buffer_pos + (size_t) atom_data_size;
13071311 atom_file_end = mp4->offset + atom_data_size;
13081312
13091313 rc = ngx_http_mp4_read_atom(mp4, ngx_http_mp4_trak_atoms, atom_data_size);
17111711
17121712 if (buf->last - buf->pos >= ctx->chunked.size) {
17131713
1714 buf->pos += ctx->chunked.size;
1714 buf->pos += (size_t) ctx->chunked.size;
17151715 b->last = buf->pos;
17161716 ctx->chunked.size = 0;
17171717
18741874 b->tag = u->output.tag;
18751875
18761876 if (buf->last - buf->pos >= ctx->chunked.size) {
1877 buf->pos += ctx->chunked.size;
1877 buf->pos += (size_t) ctx->chunked.size;
18781878 b->last = buf->pos;
18791879 ctx->chunked.size = 0;
18801880
173173
174174 for ( ;; ) {
175175
176 for (i = 0; i < iphp->addrlen; i++) {
176 for (i = 0; i < (ngx_uint_t) iphp->addrlen; i++) {
177177 hash = (hash * 113 + iphp->addr[i]) % 6271;
178178 }
179179
502502 return NGX_DECLINED;
503503 }
504504
505 if (h->body_start > c->body_start) {
505 if ((size_t) h->body_start > c->body_start) {
506506 ngx_log_error(NGX_LOG_CRIT, r->connection->log, 0,
507507 "cache file \"%s\" has too long header",
508508 c->file.name.data);
713713 size = b->last - b->pos;
714714
715715 if ((off_t) size > rb->chunked->size) {
716 b->pos += rb->chunked->size;
716 b->pos += (size_t) rb->chunked->size;
717717 rb->chunked->size = 0;
718718
719719 } else {
752752 size = b->last - b->pos;
753753
754754 if ((off_t) size > r->headers_in.content_length_n) {
755 b->pos += r->headers_in.content_length_n;
755 b->pos += (size_t) r->headers_in.content_length_n;
756756 r->headers_in.content_length_n = 0;
757757
758758 } else {
865865 rb->rest -= size;
866866
867867 } else {
868 cl->buf->pos += rb->rest;
868 cl->buf->pos += (size_t) rb->rest;
869869 rb->rest = 0;
870870 b->last = cl->buf->pos;
871871 b->last_buf = 1;
971971 size = cl->buf->last - cl->buf->pos;
972972
973973 if ((off_t) size > rb->chunked->size) {
974 cl->buf->pos += rb->chunked->size;
974 cl->buf->pos += (size_t) rb->chunked->size;
975975 r->headers_in.content_length_n += rb->chunked->size;
976976 rb->chunked->size = 0;
977977
145145 typedef int dev_t;
146146 typedef unsigned int ino_t;
147147
148 #elif __BORLANDC__
149
150 /* off_t is redefined by sys/types.h used by zlib.h */
151 #define __TYPES_H
152
153 typedef int dev_t;
154 typedef unsigned int ino_t;
155
148156 #endif
149157
150158