Fix compilation with older compilers.

* grub-core/Makefile.core.def (mpi): Add mpi-inline.c.
	* grub-core/lib/libgcrypt_wrap/cipher_wrap.h: Remove redundant
	declarations.
	* grub-core/lib/posix_wrap/string.h: Include sys/types.h.
	* grub-core/lib/posix_wrap/sys/types.h: Add common types.
	* grub-core/lib/xzembed/xz_dec_lzma2.c (dict_put): Replace byte
	identifier with b.
	* grub-core/lib/xzembed/xz_dec_stream.c (dec_vli): Likewise.
	* include/grub/crypto.h: Add type defines.
	* util/import_gcrypth.sed: Remove duplicate type defines.
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2013-01-13 21:06:25 +01:00
parent adcc602041
commit 4a9950ecb0
9 changed files with 39 additions and 17 deletions

View file

@ -34,12 +34,6 @@
#undef __GNU_LIBRARY__
#define __GNU_LIBRARY__ 1
typedef grub_uint64_t u64;
typedef grub_uint32_t u32;
typedef grub_uint16_t u16;
typedef grub_uint8_t byte;
typedef grub_size_t size_t;
#define U64_C(c) (c ## ULL)
#define PUBKEY_FLAG_NO_BLINDING (1 << 0)

View file

@ -20,6 +20,7 @@
#define GRUB_POSIX_STRING_H 1
#include <grub/misc.h>
#include <sys/types.h>
#define HAVE_STRCASECMP 1
@ -49,7 +50,7 @@ memcpy (void *dest, const void *src, grub_size_t n)
}
static inline int
memcmp (const void *s1, const void *s2, size_t n)
memcmp (const void *s1, const void *s2, grub_size_t n)
{
return grub_memcmp (s1, s2, n);
}

View file

@ -44,6 +44,12 @@ typedef grub_int64_t int64_t;
#define HAVE_U64_TYPEDEF 1
typedef grub_uint64_t u64;
#define HAVE_U32_TYPEDEF 1
typedef grub_uint32_t u32;
#define HAVE_U16_TYPEDEF 1
typedef grub_uint16_t u16;
#define HAVE_BYTE_TYPEDEF 1
typedef grub_uint8_t byte;
#define SIZEOF_UNSIGNED_LONG GRUB_CPU_SIZEOF_LONG
#define SIZEOF_UNSIGNED_INT 4

View file

@ -327,9 +327,9 @@ static inline uint32_t dict_get(
/*
* Put one byte into the dictionary. It is assumed that there is space for it.
*/
static inline void dict_put(struct dictionary *dict, uint8_t byte)
static inline void dict_put(struct dictionary *dict, uint8_t b)
{
dict->buf[dict->pos++] = byte;
dict->buf[dict->pos++] = b;
if (dict->full < dict->pos)
dict->full = dict->pos;

View file

@ -197,20 +197,20 @@ static bool fill_temp(struct xz_dec *s, struct xz_buf *b)
static enum xz_ret dec_vli(struct xz_dec *s,
const uint8_t *in, size_t *in_pos, size_t in_size)
{
uint8_t byte;
uint8_t b;
if (s->pos == 0)
s->vli = 0;
while (*in_pos < in_size) {
byte = in[*in_pos];
b = in[*in_pos];
++*in_pos;
s->vli |= (vli_type)(byte & 0x7F) << s->pos;
s->vli |= (vli_type)(b & 0x7F) << s->pos;
if ((byte & 0x80) == 0) {
if ((b & 0x80) == 0) {
/* Don't allow non-minimal encodings. */
if (byte == 0 && s->pos != 0)
if (b == 0 && s->pos != 0)
return XZ_DATA_ERROR;
s->pos = 0;