mirror of
https://github.com/nothings/stb
synced 2024-12-15 12:22:55 +03:00
place const tables to protected .rdata section
This commit is contained in:
parent
9d9f75eb68
commit
c06c9fe6bc
22
stb_image.h
22
stb_image.h
@ -1790,7 +1790,7 @@ static void stbi__grow_buffer_unsafe(stbi__jpeg *j)
|
||||
}
|
||||
|
||||
// (1 << n) - 1
|
||||
static stbi__uint32 stbi__bmask[17]={0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535};
|
||||
static const stbi__uint32 stbi__bmask[17]={0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535};
|
||||
|
||||
// decode a jpeg huffman value from the bitstream
|
||||
stbi_inline static int stbi__jpeg_huff_decode(stbi__jpeg *j, stbi__huffman *h)
|
||||
@ -1843,7 +1843,7 @@ stbi_inline static int stbi__jpeg_huff_decode(stbi__jpeg *j, stbi__huffman *h)
|
||||
}
|
||||
|
||||
// bias[n] = (-1<<n) + 1
|
||||
static int const stbi__jbias[16] = {0,-1,-3,-7,-15,-31,-63,-127,-255,-511,-1023,-2047,-4095,-8191,-16383,-32767};
|
||||
static const int stbi__jbias[16] = {0,-1,-3,-7,-15,-31,-63,-127,-255,-511,-1023,-2047,-4095,-8191,-16383,-32767};
|
||||
|
||||
// combined JPEG 'receive' and JPEG 'extend', since baseline
|
||||
// always extends everything it receives.
|
||||
@ -1886,7 +1886,7 @@ stbi_inline static int stbi__jpeg_get_bit(stbi__jpeg *j)
|
||||
|
||||
// given a value that's at position X in the zigzag stream,
|
||||
// where does it appear in the 8x8 matrix coded as row-major?
|
||||
static stbi_uc stbi__jpeg_dezigzag[64+15] =
|
||||
static const stbi_uc stbi__jpeg_dezigzag[64+15] =
|
||||
{
|
||||
0, 1, 8, 16, 9, 2, 3, 10,
|
||||
17, 24, 32, 25, 18, 11, 4, 5,
|
||||
@ -2968,7 +2968,7 @@ static int stbi__process_frame_header(stbi__jpeg *z, int scan)
|
||||
|
||||
z->rgb = 0;
|
||||
for (i=0; i < s->img_n; ++i) {
|
||||
static unsigned char rgb[3] = { 'R', 'G', 'B' };
|
||||
static const unsigned char rgb[3] = { 'R', 'G', 'B' };
|
||||
z->img_comp[i].id = stbi__get8(s);
|
||||
if (s->img_n == 3 && z->img_comp[i].id == rgb[i])
|
||||
++z->rgb;
|
||||
@ -3912,18 +3912,18 @@ static int stbi__zexpand(stbi__zbuf *z, char *zout, int n) // need to make room
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int stbi__zlength_base[31] = {
|
||||
static const int stbi__zlength_base[31] = {
|
||||
3,4,5,6,7,8,9,10,11,13,
|
||||
15,17,19,23,27,31,35,43,51,59,
|
||||
67,83,99,115,131,163,195,227,258,0,0 };
|
||||
|
||||
static int stbi__zlength_extra[31]=
|
||||
static const int stbi__zlength_extra[31]=
|
||||
{ 0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0 };
|
||||
|
||||
static int stbi__zdist_base[32] = { 1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,
|
||||
static const int stbi__zdist_base[32] = { 1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,
|
||||
257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0};
|
||||
|
||||
static int stbi__zdist_extra[32] =
|
||||
static const int stbi__zdist_extra[32] =
|
||||
{ 0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13};
|
||||
|
||||
static int stbi__parse_huffman_block(stbi__zbuf *a)
|
||||
@ -3970,7 +3970,7 @@ static int stbi__parse_huffman_block(stbi__zbuf *a)
|
||||
|
||||
static int stbi__compute_huffman_codes(stbi__zbuf *a)
|
||||
{
|
||||
static stbi_uc length_dezigzag[19] = { 16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15 };
|
||||
static const stbi_uc length_dezigzag[19] = { 16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15 };
|
||||
stbi__zhuffman z_codelength;
|
||||
stbi_uc lencodes[286+32+137];//padding for maximum single op
|
||||
stbi_uc codelength_sizes[19];
|
||||
@ -4229,7 +4229,7 @@ static stbi__pngchunk stbi__get_chunk_header(stbi__context *s)
|
||||
|
||||
static int stbi__check_png_header(stbi__context *s)
|
||||
{
|
||||
static stbi_uc png_sig[8] = { 137,80,78,71,13,10,26,10 };
|
||||
static const stbi_uc png_sig[8] = { 137,80,78,71,13,10,26,10 };
|
||||
int i;
|
||||
for (i=0; i < 8; ++i)
|
||||
if (stbi__get8(s) != png_sig[i]) return stbi__err("bad png sig","Not a PNG");
|
||||
@ -4275,7 +4275,7 @@ static int stbi__paeth(int a, int b, int c)
|
||||
return c;
|
||||
}
|
||||
|
||||
static stbi_uc stbi__depth_scale_table[9] = { 0, 0xff, 0x55, 0, 0x11, 0,0,0, 0x01 };
|
||||
static const stbi_uc stbi__depth_scale_table[9] = { 0, 0xff, 0x55, 0, 0x11, 0,0,0, 0x01 };
|
||||
|
||||
// create the png data from post-deflated data
|
||||
static int stbi__create_png_image_raw(stbi__png *a, stbi_uc *raw, stbi__uint32 raw_len, int out_n, stbi__uint32 x, stbi__uint32 y, int depth, int color)
|
||||
|
Loading…
Reference in New Issue
Block a user