mirror of
https://git.savannah.gnu.org/git/grub.git
synced 2026-10-28 01:59:49 +00:00
Merge branch 'master' into phcoder/ports/alpha
This commit is contained in:
commit
7cb450b45e
8 files changed
+125
-75
No files matched your search
@@ -1,3 +1,38 @@
|
|||||||
|
2013-10-25 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
* grub-core/video/bitmap_scale.c: Use unsigned arithmetics when
|
||||||
|
appropriate.
|
||||||
|
|
||||||
|
2013-10-25 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
* grub-core/video/fb/fbblit.c: Use (255 ^ x) rather than (255 - x).
|
||||||
|
Use unsigned divisions rather than signed variants.
|
||||||
|
|
||||||
|
2013-10-25 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
* grub-core/video/readers/png.c (grub_png_convert_image): Use
|
||||||
|
unsigned arithmetics.
|
||||||
|
Add missing break.
|
||||||
|
|
||||||
|
2013-10-25 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
* grub-core/video/readers/jpeg.c: Use unsigned where appropriate.
|
||||||
|
|
||||||
|
2013-10-25 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
* grub-core/fs/zfs/zfs.c (xor_out): Use unsigned modular arithmetics
|
||||||
|
rather than signed one.
|
||||||
|
(recovery): Likewise.
|
||||||
|
|
||||||
|
2013-10-25 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
* grub-core/net/dns.c (hash): Use unsigned arithmetic.
|
||||||
|
|
||||||
|
2013-10-25 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
* grub-core/io/gzio.c (test_zlib_header): Use undigned modulo rather
|
||||||
|
than signed.
|
||||||
|
|
||||||
2013-10-25 Jon McCune <jonmccune@google.com>
|
2013-10-25 Jon McCune <jonmccune@google.com>
|
||||||
|
|
||||||
* docs/grub.texi: Cleanup security documentation around signatures.
|
* docs/grub.texi: Cleanup security documentation around signatures.
|
||||||
|
|||||||
@@ -1278,9 +1278,9 @@ static const grub_uint8_t poly = 0x1d;
|
|||||||
/* perform the operation a ^= b * (x ** (known_idx * recovery_pow) ) */
|
/* perform the operation a ^= b * (x ** (known_idx * recovery_pow) ) */
|
||||||
static inline void
|
static inline void
|
||||||
xor_out (grub_uint8_t *a, const grub_uint8_t *b, grub_size_t s,
|
xor_out (grub_uint8_t *a, const grub_uint8_t *b, grub_size_t s,
|
||||||
int known_idx, int recovery_pow)
|
unsigned known_idx, unsigned recovery_pow)
|
||||||
{
|
{
|
||||||
int add;
|
unsigned add;
|
||||||
|
|
||||||
/* Simple xor. */
|
/* Simple xor. */
|
||||||
if (known_idx == 0 || recovery_pow == 0)
|
if (known_idx == 0 || recovery_pow == 0)
|
||||||
@@ -1307,7 +1307,7 @@ gf_mul (grub_uint8_t a, grub_uint8_t b)
|
|||||||
static grub_err_t
|
static grub_err_t
|
||||||
recovery (grub_uint8_t *bufs[4], grub_size_t s, const int nbufs,
|
recovery (grub_uint8_t *bufs[4], grub_size_t s, const int nbufs,
|
||||||
const unsigned *powers,
|
const unsigned *powers,
|
||||||
const int *idx)
|
const unsigned *idx)
|
||||||
{
|
{
|
||||||
grub_dprintf ("zfs", "recovering %u buffers\n", nbufs);
|
grub_dprintf ("zfs", "recovering %u buffers\n", nbufs);
|
||||||
/* Now we have */
|
/* Now we have */
|
||||||
@@ -1494,7 +1494,7 @@ read_device (grub_uint64_t offset, struct grub_zfs_device_desc *desc,
|
|||||||
grub_size_t orig_len = len;
|
grub_size_t orig_len = len;
|
||||||
grub_uint8_t *recovery_buf[4];
|
grub_uint8_t *recovery_buf[4];
|
||||||
grub_size_t recovery_len[4];
|
grub_size_t recovery_len[4];
|
||||||
int recovery_idx[4];
|
unsigned recovery_idx[4];
|
||||||
unsigned failed_devices = 0;
|
unsigned failed_devices = 0;
|
||||||
int idx, orig_idx;
|
int idx, orig_idx;
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1178,7 +1178,7 @@ test_zlib_header (grub_gzio_t gzio)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((cmf * 256 + flg) % 31)
|
if ((cmf * 256U + flg) % 31U)
|
||||||
{
|
{
|
||||||
grub_error (GRUB_ERR_BAD_COMPRESSED_DATA, N_("unsupported gzip format"));
|
grub_error (GRUB_ERR_BAD_COMPRESSED_DATA, N_("unsupported gzip format"));
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
+1
-1
@@ -114,7 +114,7 @@ struct recv_data
|
|||||||
static inline int
|
static inline int
|
||||||
hash (const char *str)
|
hash (const char *str)
|
||||||
{
|
{
|
||||||
int v = 0, xn = 1;
|
unsigned v = 0, xn = 1;
|
||||||
const char *ptr;
|
const char *ptr;
|
||||||
for (ptr = str; *ptr; )
|
for (ptr = str; *ptr; )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -123,10 +123,16 @@ grub_video_bitmap_create_scaled (struct grub_video_bitmap **dst,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static grub_err_t
|
static grub_err_t
|
||||||
make_h_align (int *x, int *w, int new_w,
|
make_h_align (unsigned *x, unsigned *w, unsigned new_w,
|
||||||
grub_video_bitmap_h_align_t h_align)
|
grub_video_bitmap_h_align_t h_align)
|
||||||
{
|
{
|
||||||
grub_err_t ret = GRUB_ERR_NONE;
|
grub_err_t ret = GRUB_ERR_NONE;
|
||||||
|
if (new_w >= *w)
|
||||||
|
{
|
||||||
|
*x = 0;
|
||||||
|
*w = new_w;
|
||||||
|
return GRUB_ERR_NONE;
|
||||||
|
}
|
||||||
switch (h_align)
|
switch (h_align)
|
||||||
{
|
{
|
||||||
case GRUB_VIDEO_BITMAP_H_ALIGN_LEFT:
|
case GRUB_VIDEO_BITMAP_H_ALIGN_LEFT:
|
||||||
@@ -147,10 +153,16 @@ make_h_align (int *x, int *w, int new_w,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static grub_err_t
|
static grub_err_t
|
||||||
make_v_align (int *y, int *h, int new_h,
|
make_v_align (unsigned *y, unsigned *h, unsigned new_h,
|
||||||
grub_video_bitmap_v_align_t v_align)
|
grub_video_bitmap_v_align_t v_align)
|
||||||
{
|
{
|
||||||
grub_err_t ret = GRUB_ERR_NONE;
|
grub_err_t ret = GRUB_ERR_NONE;
|
||||||
|
if (new_h >= *h)
|
||||||
|
{
|
||||||
|
*y = 0;
|
||||||
|
*h = new_h;
|
||||||
|
return GRUB_ERR_NONE;
|
||||||
|
}
|
||||||
switch (v_align)
|
switch (v_align)
|
||||||
{
|
{
|
||||||
case GRUB_VIDEO_BITMAP_V_ALIGN_TOP:
|
case GRUB_VIDEO_BITMAP_V_ALIGN_TOP:
|
||||||
@@ -194,14 +206,14 @@ grub_video_bitmap_scale_proportional (struct grub_video_bitmap **dst,
|
|||||||
if (ret != GRUB_ERR_NONE)
|
if (ret != GRUB_ERR_NONE)
|
||||||
return ret; /* Error. */
|
return ret; /* Error. */
|
||||||
|
|
||||||
int dx0 = 0;
|
unsigned dx0 = 0;
|
||||||
int dy0 = 0;
|
unsigned dy0 = 0;
|
||||||
int dw = dst_width;
|
unsigned dw = dst_width;
|
||||||
int dh = dst_height;
|
unsigned dh = dst_height;
|
||||||
int sx0 = 0;
|
unsigned sx0 = 0;
|
||||||
int sy0 = 0;
|
unsigned sy0 = 0;
|
||||||
int sw = src->mode_info.width;
|
unsigned sw = src->mode_info.width;
|
||||||
int sh = src->mode_info.height;
|
unsigned sh = src->mode_info.height;
|
||||||
|
|
||||||
switch (selection_method)
|
switch (selection_method)
|
||||||
{
|
{
|
||||||
@@ -345,26 +357,26 @@ scale_nn (struct grub_video_bitmap *dst, struct grub_video_bitmap *src)
|
|||||||
|
|
||||||
grub_uint8_t *ddata = dst->data;
|
grub_uint8_t *ddata = dst->data;
|
||||||
grub_uint8_t *sdata = src->data;
|
grub_uint8_t *sdata = src->data;
|
||||||
int dw = dst->mode_info.width;
|
unsigned dw = dst->mode_info.width;
|
||||||
int dh = dst->mode_info.height;
|
unsigned dh = dst->mode_info.height;
|
||||||
int sw = src->mode_info.width;
|
unsigned sw = src->mode_info.width;
|
||||||
int sh = src->mode_info.height;
|
unsigned sh = src->mode_info.height;
|
||||||
int dstride = dst->mode_info.pitch;
|
unsigned dstride = dst->mode_info.pitch;
|
||||||
int sstride = src->mode_info.pitch;
|
unsigned sstride = src->mode_info.pitch;
|
||||||
/* bytes_per_pixel is the same for both src and dst. */
|
/* bytes_per_pixel is the same for both src and dst. */
|
||||||
int bytes_per_pixel = dst->mode_info.bytes_per_pixel;
|
unsigned bytes_per_pixel = dst->mode_info.bytes_per_pixel;
|
||||||
|
|
||||||
int dy;
|
unsigned dy;
|
||||||
for (dy = 0; dy < dh; dy++)
|
for (dy = 0; dy < dh; dy++)
|
||||||
{
|
{
|
||||||
int dx;
|
unsigned dx;
|
||||||
for (dx = 0; dx < dw; dx++)
|
for (dx = 0; dx < dw; dx++)
|
||||||
{
|
{
|
||||||
grub_uint8_t *dptr;
|
grub_uint8_t *dptr;
|
||||||
grub_uint8_t *sptr;
|
grub_uint8_t *sptr;
|
||||||
int sx;
|
unsigned sx;
|
||||||
int sy;
|
unsigned sy;
|
||||||
int comp;
|
unsigned comp;
|
||||||
|
|
||||||
/* Compute the source coordinate that the destination coordinate
|
/* Compute the source coordinate that the destination coordinate
|
||||||
maps to. Note: sx/sw = dx/dw => sx = sw*dx/dw. */
|
maps to. Note: sx/sw = dx/dw => sx = sw*dx/dw. */
|
||||||
@@ -402,25 +414,25 @@ scale_bilinear (struct grub_video_bitmap *dst, struct grub_video_bitmap *src)
|
|||||||
|
|
||||||
grub_uint8_t *ddata = dst->data;
|
grub_uint8_t *ddata = dst->data;
|
||||||
grub_uint8_t *sdata = src->data;
|
grub_uint8_t *sdata = src->data;
|
||||||
int dw = dst->mode_info.width;
|
unsigned dw = dst->mode_info.width;
|
||||||
int dh = dst->mode_info.height;
|
unsigned dh = dst->mode_info.height;
|
||||||
int sw = src->mode_info.width;
|
unsigned sw = src->mode_info.width;
|
||||||
int sh = src->mode_info.height;
|
unsigned sh = src->mode_info.height;
|
||||||
int dstride = dst->mode_info.pitch;
|
int dstride = dst->mode_info.pitch;
|
||||||
int sstride = src->mode_info.pitch;
|
int sstride = src->mode_info.pitch;
|
||||||
/* bytes_per_pixel is the same for both src and dst. */
|
/* bytes_per_pixel is the same for both src and dst. */
|
||||||
int bytes_per_pixel = dst->mode_info.bytes_per_pixel;
|
int bytes_per_pixel = dst->mode_info.bytes_per_pixel;
|
||||||
|
|
||||||
int dy;
|
unsigned dy;
|
||||||
for (dy = 0; dy < dh; dy++)
|
for (dy = 0; dy < dh; dy++)
|
||||||
{
|
{
|
||||||
int dx;
|
unsigned dx;
|
||||||
for (dx = 0; dx < dw; dx++)
|
for (dx = 0; dx < dw; dx++)
|
||||||
{
|
{
|
||||||
grub_uint8_t *dptr;
|
grub_uint8_t *dptr;
|
||||||
grub_uint8_t *sptr;
|
grub_uint8_t *sptr;
|
||||||
int sx;
|
unsigned sx;
|
||||||
int sy;
|
unsigned sy;
|
||||||
int comp;
|
int comp;
|
||||||
|
|
||||||
/* Compute the source coordinate that the destination coordinate
|
/* Compute the source coordinate that the destination coordinate
|
||||||
|
|||||||
+27
-27
@@ -1191,11 +1191,11 @@ grub_video_fbblit_blend (struct grub_video_fbblit_info *dst,
|
|||||||
&dst_green, &dst_blue, &dst_alpha);
|
&dst_green, &dst_blue, &dst_alpha);
|
||||||
|
|
||||||
dst_red = (((src_red * src_alpha)
|
dst_red = (((src_red * src_alpha)
|
||||||
+ (dst_red * (255 - src_alpha))) / 255);
|
+ (dst_red * (255 ^ src_alpha))) / 255U);
|
||||||
dst_green = (((src_green * src_alpha)
|
dst_green = (((src_green * src_alpha)
|
||||||
+ (dst_green * (255 - src_alpha))) / 255);
|
+ (dst_green * (255 ^ src_alpha))) / 255U);
|
||||||
dst_blue = (((src_blue * src_alpha)
|
dst_blue = (((src_blue * src_alpha)
|
||||||
+ (dst_blue * (255 - src_alpha))) / 255);
|
+ (dst_blue * (255 ^ src_alpha))) / 255U);
|
||||||
|
|
||||||
dst_alpha = src_alpha;
|
dst_alpha = src_alpha;
|
||||||
dst_color = grub_video_fb_map_rgba (dst_red, dst_green, dst_blue,
|
dst_color = grub_video_fb_map_rgba (dst_red, dst_green, dst_blue,
|
||||||
@@ -1270,11 +1270,11 @@ grub_video_fbblit_blend_BGRA8888_RGBA8888 (struct grub_video_fbblit_info *dst,
|
|||||||
color = *dstptr;
|
color = *dstptr;
|
||||||
|
|
||||||
dr = (color >> 16) & 0xFF;
|
dr = (color >> 16) & 0xFF;
|
||||||
dr = (dr * (255 - a) + sr * a) / 255;
|
dr = (dr * (255 ^ a) + sr * a) / 255U;
|
||||||
dg = (color >> 8) & 0xFF;
|
dg = (color >> 8) & 0xFF;
|
||||||
dg = (dg * (255 - a) + sg * a) / 255;
|
dg = (dg * (255 ^ a) + sg * a) / 255U;
|
||||||
db = (color >> 0) & 0xFF;
|
db = (color >> 0) & 0xFF;
|
||||||
db = (db * (255 - a) + sb * a) / 255;
|
db = (db * (255 ^ a) + sb * a) / 255U;
|
||||||
}
|
}
|
||||||
|
|
||||||
color = (a << 24) | (dr << 16) | (dg << 8) | db;
|
color = (a << 24) | (dr << 16) | (dg << 8) | db;
|
||||||
@@ -1360,9 +1360,9 @@ grub_video_fbblit_blend_BGR888_RGBA8888 (struct grub_video_fbblit_info *dst,
|
|||||||
db = dstptr[2];
|
db = dstptr[2];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
db = (db * (255 - a) + sb * a) / 255;
|
db = (db * (255 ^ a) + sb * a) / 255U;
|
||||||
dg = (dg * (255 - a) + sg * a) / 255;
|
dg = (dg * (255 ^ a) + sg * a) / 255U;
|
||||||
dr = (dr * (255 - a) + sr * a) / 255;
|
dr = (dr * (255 ^ a) + sr * a) / 255U;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef GRUB_CPU_WORDS_BIGENDIAN
|
#ifndef GRUB_CPU_WORDS_BIGENDIAN
|
||||||
@@ -1440,9 +1440,9 @@ grub_video_fbblit_blend_RGBA8888_RGBA8888 (struct grub_video_fbblit_info *dst,
|
|||||||
dg = (color >> 8) & 0xFF;
|
dg = (color >> 8) & 0xFF;
|
||||||
db = (color >> 16) & 0xFF;
|
db = (color >> 16) & 0xFF;
|
||||||
|
|
||||||
dr = (dr * (255 - a) + sr * a) / 255;
|
dr = (dr * (255 ^ a) + sr * a) / 255U;
|
||||||
dg = (dg * (255 - a) + sg * a) / 255;
|
dg = (dg * (255 ^ a) + sg * a) / 255U;
|
||||||
db = (db * (255 - a) + sb * a) / 255;
|
db = (db * (255 ^ a) + sb * a) / 255U;
|
||||||
|
|
||||||
color = (a << 24) | (db << 16) | (dg << 8) | dr;
|
color = (a << 24) | (db << 16) | (dg << 8) | dr;
|
||||||
|
|
||||||
@@ -1525,9 +1525,9 @@ grub_video_fbblit_blend_RGB888_RGBA8888 (struct grub_video_fbblit_info *dst,
|
|||||||
dr = dstptr[2];
|
dr = dstptr[2];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
dr = (dr * (255 - a) + sr * a) / 255;
|
dr = (dr * (255 ^ a) + sr * a) / 255U;
|
||||||
dg = (dg * (255 - a) + sg * a) / 255;
|
dg = (dg * (255 ^ a) + sg * a) / 255U;
|
||||||
db = (db * (255 - a) + sb * a) / 255;
|
db = (db * (255 ^ a) + sb * a) / 255U;
|
||||||
|
|
||||||
#ifndef GRUB_CPU_WORDS_BIGENDIAN
|
#ifndef GRUB_CPU_WORDS_BIGENDIAN
|
||||||
*dstptr++ = dr;
|
*dstptr++ = dr;
|
||||||
@@ -1601,9 +1601,9 @@ grub_video_fbblit_blend_index_RGBA8888 (struct grub_video_fbblit_info *dst,
|
|||||||
|
|
||||||
grub_video_fb_unmap_color_int (dst, *dstptr, &dr, &dg, &db, &da);
|
grub_video_fb_unmap_color_int (dst, *dstptr, &dr, &dg, &db, &da);
|
||||||
|
|
||||||
dr = (dr * (255 - a) + sr * a) / 255;
|
dr = (dr * (255 ^ a) + sr * a) / 255U;
|
||||||
dg = (dg * (255 - a) + sg * a) / 255;
|
dg = (dg * (255 ^ a) + sg * a) / 255U;
|
||||||
db = (db * (255 - a) + sb * a) / 255;
|
db = (db * (255 ^ a) + sb * a) / 255U;
|
||||||
|
|
||||||
color = grub_video_fb_map_rgb(dr, dg, db);
|
color = grub_video_fb_map_rgb(dr, dg, db);
|
||||||
|
|
||||||
@@ -1683,9 +1683,9 @@ grub_video_fbblit_blend_XXXA8888_1bit (struct grub_video_fbblit_info *dst,
|
|||||||
grub_uint8_t d2 = (*dstptr >> 8) & 0xFF;
|
grub_uint8_t d2 = (*dstptr >> 8) & 0xFF;
|
||||||
grub_uint8_t d3 = (*dstptr >> 16) & 0xFF;
|
grub_uint8_t d3 = (*dstptr >> 16) & 0xFF;
|
||||||
|
|
||||||
d1 = (d1 * (255 - a) + s1 * a) / 255;
|
d1 = (d1 * (255 ^ a) + s1 * a) / 255U;
|
||||||
d2 = (d2 * (255 - a) + s2 * a) / 255;
|
d2 = (d2 * (255 ^ a) + s2 * a) / 255U;
|
||||||
d3 = (d3 * (255 - a) + s3 * a) / 255;
|
d3 = (d3 * (255 ^ a) + s3 * a) / 255U;
|
||||||
|
|
||||||
*dstptr = (a << 24) | (d3 << 16) | (d2 << 8) | d1;
|
*dstptr = (a << 24) | (d3 << 16) | (d2 << 8) | d1;
|
||||||
}
|
}
|
||||||
@@ -1791,9 +1791,9 @@ grub_video_fbblit_blend_XXX888_1bit (struct grub_video_fbblit_info *dst,
|
|||||||
grub_uint8_t d2 = (*(grub_uint32_t *) dstptr >> 8) & 0xFF;
|
grub_uint8_t d2 = (*(grub_uint32_t *) dstptr >> 8) & 0xFF;
|
||||||
grub_uint8_t d3 = (*(grub_uint32_t *) dstptr >> 16) & 0xFF;
|
grub_uint8_t d3 = (*(grub_uint32_t *) dstptr >> 16) & 0xFF;
|
||||||
|
|
||||||
((grub_uint8_t *) dstptr)[0] = (d1 * (255 - a) + s1 * a) / 255;
|
((grub_uint8_t *) dstptr)[0] = (d1 * (255 ^ a) + s1 * a) / 255U;
|
||||||
((grub_uint8_t *) dstptr)[1] = (d2 * (255 - a) + s2 * a) / 255;
|
((grub_uint8_t *) dstptr)[1] = (d2 * (255 ^ a) + s2 * a) / 255U;
|
||||||
((grub_uint8_t *) dstptr)[2] = (d3 * (255 - a) + s3 * a) / 255;
|
((grub_uint8_t *) dstptr)[2] = (d3 * (255 ^ a) + s3 * a) / 255U;
|
||||||
}
|
}
|
||||||
|
|
||||||
srcmask >>= 1;
|
srcmask >>= 1;
|
||||||
@@ -1887,9 +1887,9 @@ grub_video_fbblit_blend_XXX565_1bit (struct grub_video_fbblit_info *dst,
|
|||||||
grub_uint8_t d2 = (*dstptr >> 5) & 0x3F;
|
grub_uint8_t d2 = (*dstptr >> 5) & 0x3F;
|
||||||
grub_uint8_t d3 = (*dstptr >> 11) & 0x1F;
|
grub_uint8_t d3 = (*dstptr >> 11) & 0x1F;
|
||||||
|
|
||||||
d1 = (d1 * (255 - a) + s1 * a) / 255;
|
d1 = (d1 * (255 ^ a) + s1 * a) / 255U;
|
||||||
d2 = (d2 * (255 - a) + s2 * a) / 255;
|
d2 = (d2 * (255 ^ a) + s2 * a) / 255U;
|
||||||
d3 = (d3 * (255 - a) + s3 * a) / 255;
|
d3 = (d3 * (255 ^ a) + s3 * a) / 255U;
|
||||||
|
|
||||||
*dstptr = (d1 & 0x1f) | ((d2 & 0x3f) << 5) | ((d3 & 0x1f) << 11);
|
*dstptr = (d1 & 0x1f) | ((d2 & 0x3f) << 5) | ((d3 & 0x1f) << 11);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -80,8 +80,8 @@ struct grub_jpeg_data
|
|||||||
struct grub_video_bitmap **bitmap;
|
struct grub_video_bitmap **bitmap;
|
||||||
grub_uint8_t *bitmap_ptr;
|
grub_uint8_t *bitmap_ptr;
|
||||||
|
|
||||||
int image_width;
|
unsigned image_width;
|
||||||
int image_height;
|
unsigned image_height;
|
||||||
|
|
||||||
grub_uint8_t *huff_value[4];
|
grub_uint8_t *huff_value[4];
|
||||||
int huff_offset[4][16];
|
int huff_offset[4][16];
|
||||||
@@ -94,9 +94,9 @@ struct grub_jpeg_data
|
|||||||
jpeg_data_unit_t crdu;
|
jpeg_data_unit_t crdu;
|
||||||
jpeg_data_unit_t cbdu;
|
jpeg_data_unit_t cbdu;
|
||||||
|
|
||||||
int vs, hs;
|
unsigned vs, hs;
|
||||||
int dri;
|
int dri;
|
||||||
int r1;
|
unsigned r1;
|
||||||
|
|
||||||
int dc_value[3];
|
int dc_value[3];
|
||||||
|
|
||||||
@@ -613,7 +613,7 @@ grub_jpeg_decode_sos (struct grub_jpeg_data *data)
|
|||||||
static grub_err_t
|
static grub_err_t
|
||||||
grub_jpeg_decode_data (struct grub_jpeg_data *data)
|
grub_jpeg_decode_data (struct grub_jpeg_data *data)
|
||||||
{
|
{
|
||||||
int c1, vb, hb, nr1, nc1;
|
unsigned c1, vb, hb, nr1, nc1;
|
||||||
int rst = data->dri;
|
int rst = data->dri;
|
||||||
|
|
||||||
vb = data->vs * 8;
|
vb = data->vs * 8;
|
||||||
@@ -626,7 +626,7 @@ grub_jpeg_decode_data (struct grub_jpeg_data *data)
|
|||||||
for (c1 = 0; c1 < nc1 && (!data->dri || rst);
|
for (c1 = 0; c1 < nc1 && (!data->dri || rst);
|
||||||
c1++, rst--, data->bitmap_ptr += hb * 3)
|
c1++, rst--, data->bitmap_ptr += hb * 3)
|
||||||
{
|
{
|
||||||
int r2, c2, nr2, nc2;
|
unsigned r2, c2, nr2, nc2;
|
||||||
grub_uint8_t *ptr2;
|
grub_uint8_t *ptr2;
|
||||||
|
|
||||||
for (r2 = 0; r2 < data->vs; r2++)
|
for (r2 = 0; r2 < data->vs; r2++)
|
||||||
@@ -649,7 +649,8 @@ grub_jpeg_decode_data (struct grub_jpeg_data *data)
|
|||||||
for (r2 = 0; r2 < nr2; r2++, ptr2 += (data->image_width - nc2) * 3)
|
for (r2 = 0; r2 < nr2; r2++, ptr2 += (data->image_width - nc2) * 3)
|
||||||
for (c2 = 0; c2 < nc2; c2++, ptr2 += 3)
|
for (c2 = 0; c2 < nc2; c2++, ptr2 += 3)
|
||||||
{
|
{
|
||||||
int i0, yy;
|
unsigned i0;
|
||||||
|
int yy;
|
||||||
|
|
||||||
i0 = (r2 / data->vs) * 8 + (c2 / data->hs);
|
i0 = (r2 / data->vs) * 8 + (c2 / data->hs);
|
||||||
yy = data->ydu[(r2 / 8) * 2 + (c2 / 8)][(r2 % 8) * 8 + (c2 % 8)];
|
yy = data->ydu[(r2 / 8) * 2 + (c2 / 8)][(r2 % 8) * 8 + (c2 % 8)];
|
||||||
|
|||||||
@@ -97,7 +97,8 @@ struct grub_png_data
|
|||||||
|
|
||||||
grub_uint32_t next_offset;
|
grub_uint32_t next_offset;
|
||||||
|
|
||||||
int image_width, image_height, bpp, is_16bit;
|
unsigned image_width, image_height;
|
||||||
|
int bpp, is_16bit;
|
||||||
int raw_bytes, is_gray, is_alpha, is_palette;
|
int raw_bytes, is_gray, is_alpha, is_palette;
|
||||||
int row_bytes, color_bits;
|
int row_bytes, color_bits;
|
||||||
grub_uint8_t *image_data;
|
grub_uint8_t *image_data;
|
||||||
@@ -818,7 +819,7 @@ static const grub_uint8_t png_magic[8] =
|
|||||||
static void
|
static void
|
||||||
grub_png_convert_image (struct grub_png_data *data)
|
grub_png_convert_image (struct grub_png_data *data)
|
||||||
{
|
{
|
||||||
int i;
|
unsigned i;
|
||||||
grub_uint8_t *d1, *d2;
|
grub_uint8_t *d1, *d2;
|
||||||
|
|
||||||
d1 = (*data->bitmap)->data;
|
d1 = (*data->bitmap)->data;
|
||||||
@@ -848,11 +849,11 @@ grub_png_convert_image (struct grub_png_data *data)
|
|||||||
grub_uint8_t *d1c, *d2c;
|
grub_uint8_t *d1c, *d2c;
|
||||||
int shift;
|
int shift;
|
||||||
int mask = (1 << data->color_bits) - 1;
|
int mask = (1 << data->color_bits) - 1;
|
||||||
int j;
|
unsigned j;
|
||||||
if (data->is_gray)
|
if (data->is_gray)
|
||||||
for (i = 0; i < (1 << data->color_bits); i++)
|
for (i = 0; i < (1U << data->color_bits); i++)
|
||||||
{
|
{
|
||||||
grub_uint8_t col = (0xff * i) / ((1 << data->color_bits) - 1);
|
grub_uint8_t col = (0xff * i) / ((1U << data->color_bits) - 1);
|
||||||
palette[i][0] = col;
|
palette[i][0] = col;
|
||||||
palette[i][1] = col;
|
palette[i][1] = col;
|
||||||
palette[i][2] = col;
|
palette[i][2] = col;
|
||||||
@@ -910,6 +911,7 @@ grub_png_convert_image (struct grub_png_data *data)
|
|||||||
d1[B4] = d2[3];
|
d1[B4] = d2[3];
|
||||||
d1[A4] = d2[1];
|
d1[A4] = d2[1];
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
if (data->is_16bit)
|
if (data->is_16bit)
|
||||||
/* 16-bit gray without alpha. */
|
/* 16-bit gray without alpha. */
|
||||||
|
|||||||
Reference in new issue
Block a user