comparison src/http/modules/ngx_http_mp4_module.c @ 5359:2fda9065d0f4

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.
author Maxim Dounin <mdounin@mdounin.ru>
date Wed, 04 Sep 2013 20:48:23 +0400
parents 670ceaba03d8
children 9d056f10fb99
comparison
equal deleted inserted replaced
5358:670ceaba03d8 5359:2fda9065d0f4
155 155
156 156
157 #define ngx_mp4_atom_header(mp4) (mp4->buffer_pos - 8) 157 #define ngx_mp4_atom_header(mp4) (mp4->buffer_pos - 8)
158 #define ngx_mp4_atom_data(mp4) mp4->buffer_pos 158 #define ngx_mp4_atom_data(mp4) mp4->buffer_pos
159 #define ngx_mp4_atom_data_size(t) (uint64_t) (sizeof(t) - 8) 159 #define ngx_mp4_atom_data_size(t) (uint64_t) (sizeof(t) - 8)
160 #define ngx_mp4_atom_next(mp4, n) mp4->buffer_pos += n; mp4->offset += n 160
161
162 #define ngx_mp4_atom_next(mp4, n) \
163 mp4->buffer_pos += (size_t) n; \
164 mp4->offset += n
161 165
162 166
163 #define ngx_mp4_set_atom_name(p, n1, n2, n3, n4) \ 167 #define ngx_mp4_set_atom_name(p, n1, n2, n3, n4) \
164 ((u_char *) (p))[4] = n1; \ 168 ((u_char *) (p))[4] = n1; \
165 ((u_char *) (p))[5] = n2; \ 169 ((u_char *) (p))[5] = n2; \
954 ngx_buf_t *atom; 958 ngx_buf_t *atom;
955 959
956 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, mp4->file.log, 0, "mp4 ftyp atom"); 960 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, mp4->file.log, 0, "mp4 ftyp atom");
957 961
958 if (atom_data_size > 1024 962 if (atom_data_size > 1024
959 || ngx_mp4_atom_data(mp4) + atom_data_size > mp4->buffer_end) 963 || ngx_mp4_atom_data(mp4) + (size_t) atom_data_size > mp4->buffer_end)
960 { 964 {
961 ngx_log_error(NGX_LOG_ERR, mp4->file.log, 0, 965 ngx_log_error(NGX_LOG_ERR, mp4->file.log, 0,
962 "\"%s\" mp4 ftyp atom is too large:%uL", 966 "\"%s\" mp4 ftyp atom is too large:%uL",
963 mp4->file.name.data, atom_data_size); 967 mp4->file.name.data, atom_data_size);
964 return NGX_ERROR; 968 return NGX_ERROR;
1302 atom->pos = atom_header; 1306 atom->pos = atom_header;
1303 atom->last = atom_header + sizeof(ngx_mp4_atom_header_t); 1307 atom->last = atom_header + sizeof(ngx_mp4_atom_header_t);
1304 1308
1305 trak->out[NGX_HTTP_MP4_TRAK_ATOM].buf = atom; 1309 trak->out[NGX_HTTP_MP4_TRAK_ATOM].buf = atom;
1306 1310
1307 atom_end = mp4->buffer_pos + atom_data_size; 1311 atom_end = mp4->buffer_pos + (size_t) atom_data_size;
1308 atom_file_end = mp4->offset + atom_data_size; 1312 atom_file_end = mp4->offset + atom_data_size;
1309 1313
1310 rc = ngx_http_mp4_read_atom(mp4, ngx_http_mp4_trak_atoms, atom_data_size); 1314 rc = ngx_http_mp4_read_atom(mp4, ngx_http_mp4_trak_atoms, atom_data_size);
1311 1315
1312 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, mp4->file.log, 0, 1316 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, mp4->file.log, 0,