mirror of
https://gitlab.com/qemu-project/openbios.git
synced 2024-02-13 08:34:06 +08:00
Reduce warnings by 29%
git-svn-id: svn://coreboot.org/openbios/openbios-devel@273 f158a5a8-5612-0410-a976-696ce0be7e32
This commit is contained in:
@@ -137,11 +137,5 @@ DIR;
|
||||
#ifndef NULL
|
||||
#define NULL 0
|
||||
#endif
|
||||
extern DIR *opendir ();
|
||||
extern struct direct *readdir ();
|
||||
extern int telldir ();
|
||||
extern void seekdir ();
|
||||
#define rewinddir(dirp) seekdir((dirp), (long)0)
|
||||
extern void closedir ();
|
||||
#endif /* not KERNEL */
|
||||
#endif /* _BOOT_UFS_DIR_H_ */
|
||||
|
||||
@@ -56,7 +56,7 @@ struct PartitionBlock
|
||||
unsigned long pb_Flags;
|
||||
unsigned long pb_Reserved1[2];
|
||||
unsigned long pb_DevFlags;
|
||||
unsigned char pb_DriveName[32];
|
||||
char pb_DriveName[32];
|
||||
unsigned long pb_Reserved2[15];
|
||||
unsigned long pb_Environment[20];
|
||||
unsigned long pb_EReserved[12];
|
||||
@@ -201,7 +201,7 @@ struct ReadData {
|
||||
unsigned int filesize;
|
||||
};
|
||||
|
||||
#warning "Big vs. little endian for configure needed"
|
||||
//#warning "Big vs. little endian for configure needed"
|
||||
#define AROS_BE2LONG(l) \
|
||||
( \
|
||||
((((unsigned long)(l)) >> 24) & 0x000000FFUL) | \
|
||||
@@ -240,7 +240,8 @@ int blockoffset; /* offset if there is an embedded RDB partition */
|
||||
int rootb; /* block number of root block */
|
||||
int rdbb; /* block number of rdb block */
|
||||
|
||||
void initCache() {
|
||||
static void initCache(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i=0;i<MAX_CACHE_BLOCKS;i++)
|
||||
@@ -251,7 +252,8 @@ int i;
|
||||
}
|
||||
}
|
||||
|
||||
struct CacheBlock *getBlock(unsigned int block) {
|
||||
static struct CacheBlock *getBlock(unsigned int block)
|
||||
{
|
||||
struct CacheBlock *freeblock;
|
||||
int i;
|
||||
|
||||
@@ -278,7 +280,8 @@ int i;
|
||||
return freeblock;
|
||||
}
|
||||
|
||||
unsigned int calcChkSum(unsigned short SizeBlock, unsigned int *buffer) {
|
||||
static unsigned int calcChkSum(unsigned short SizeBlock, unsigned int *buffer)
|
||||
{
|
||||
unsigned int sum=0,count=0;
|
||||
|
||||
for (count=0;count<SizeBlock;count++)
|
||||
@@ -337,7 +340,8 @@ int i;
|
||||
return 1;
|
||||
}
|
||||
|
||||
int seek(unsigned long offset) {
|
||||
static int seek(unsigned long offset)
|
||||
{
|
||||
struct CacheBlock *cblock;
|
||||
unsigned long block;
|
||||
unsigned long togo;
|
||||
@@ -391,7 +395,7 @@ unsigned int readbytes = 0;
|
||||
{
|
||||
cblock = getBlock(fsysb->file.current.block);
|
||||
}
|
||||
#warning "else shouldn't occour"
|
||||
//#warning "else shouldn't occour"
|
||||
}
|
||||
size = 512;
|
||||
size -= fsysb->file.current.byte;
|
||||
@@ -405,7 +409,7 @@ unsigned int readbytes = 0;
|
||||
extensionBlock(cblock)->filekey_table
|
||||
[fsysb->file.current.filekey]
|
||||
)+blockoffset,
|
||||
fsysb->file.current.byte, size, (char *)((int)buf+readbytes)
|
||||
fsysb->file.current.byte, size, (char *)((long)buf+readbytes)
|
||||
);
|
||||
fsysb->file.current.byte += size;
|
||||
}
|
||||
@@ -418,7 +422,7 @@ unsigned int readbytes = 0;
|
||||
extensionBlock(cblock)->filekey_table
|
||||
[fsysb->file.current.filekey]
|
||||
)+blockoffset,
|
||||
fsysb->file.current.byte, size, (char *)((int)buf+readbytes)
|
||||
fsysb->file.current.byte, size, (char *)((long)buf+readbytes)
|
||||
);
|
||||
fsysb->file.current.byte = 0;
|
||||
fsysb->file.current.filekey--;
|
||||
@@ -432,7 +436,8 @@ unsigned int readbytes = 0;
|
||||
return readbytes;
|
||||
}
|
||||
|
||||
unsigned char capitalch(unsigned char ch, unsigned char flags) {
|
||||
static unsigned char capitalch(unsigned char ch, unsigned char flags)
|
||||
{
|
||||
|
||||
if ((flags==0) || (flags==1))
|
||||
return (unsigned char)((ch>='a') && (ch<='z') ? ch-('a'-'A') : ch);
|
||||
@@ -442,7 +447,8 @@ unsigned char capitalch(unsigned char ch, unsigned char flags) {
|
||||
}
|
||||
|
||||
// str2 is a BCPL string
|
||||
int noCaseStrCmp(char *str1, char *str2, unsigned char flags) {
|
||||
static int noCaseStrCmp(char *str1, char *str2, unsigned char flags)
|
||||
{
|
||||
unsigned char length;
|
||||
|
||||
length=str2++[0];
|
||||
@@ -456,7 +462,8 @@ unsigned char length;
|
||||
return (*str1) ? 1 : -1;
|
||||
}
|
||||
|
||||
unsigned int getHashKey(char *name,unsigned int tablesize, unsigned char flags) {
|
||||
static unsigned int getHashKey(char *name,unsigned int tablesize, unsigned char flags)
|
||||
{
|
||||
unsigned int length;
|
||||
|
||||
length=0;
|
||||
@@ -467,7 +474,8 @@ unsigned int length;
|
||||
return length%tablesize;
|
||||
}
|
||||
|
||||
grub_error_t getHeaderBlock(char *name, struct CacheBlock **dirh) {
|
||||
static grub_error_t getHeaderBlock(char *name, struct CacheBlock **dirh)
|
||||
{
|
||||
int key;
|
||||
|
||||
key = getHashKey(name, 72, 1);
|
||||
@@ -501,8 +509,8 @@ printf("ghb2: %d\n", (*dirh)->blocknum);
|
||||
return 0;
|
||||
}
|
||||
|
||||
char *copyPart(char *src, char *dst) {
|
||||
|
||||
static char *copyPart(char *src, char *dst)
|
||||
{
|
||||
while ((*src != '/') && (*src))
|
||||
*dst++ = *src++;
|
||||
if (*src == '/')
|
||||
@@ -514,7 +522,8 @@ char *copyPart(char *src, char *dst) {
|
||||
return src;
|
||||
}
|
||||
|
||||
grub_error_t findBlock(char *name, struct CacheBlock **dirh) {
|
||||
static grub_error_t findBlock(char *name, struct CacheBlock **dirh)
|
||||
{
|
||||
char dname[32];
|
||||
int block;
|
||||
|
||||
@@ -571,7 +580,8 @@ int block;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void checkPossibility(char *filename, char *bstr) {
|
||||
static void checkPossibility(char *filename, char *bstr)
|
||||
{
|
||||
|
||||
#ifndef STAGE1_5
|
||||
char cstr[32];
|
||||
@@ -668,7 +678,7 @@ int affs_dir(char *dirname)
|
||||
fname = filename;
|
||||
while (*fname)
|
||||
*current++ = *fname++;
|
||||
#warning "TODO: add some more chars until posibilities differ"
|
||||
//#warning "TODO: add some more chars until possibilities differ"
|
||||
if (print_possibilities>0)
|
||||
errnum = ERR_FILE_NOT_FOUND;
|
||||
return (print_possibilities<0);
|
||||
|
||||
@@ -587,7 +587,7 @@ ext2fs_dir (char *dirname)
|
||||
log2 (EXT2_BLOCK_SIZE (SUPERBLOCK) / sizeof (struct ext2_inode)));
|
||||
printf ("ext2fs_dir: inode table fsblock=%d\n", ino_blk);
|
||||
#endif /* E2DEBUG */
|
||||
if (!ext2_rdfsb (ino_blk, INODE))
|
||||
if (!ext2_rdfsb (ino_blk, (char *)INODE))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -30,8 +30,8 @@ static struct dir_entry *vstafs_nextdir (void);
|
||||
|
||||
|
||||
#define FIRST_SECTOR ((struct first_sector *) FSYS_BUF)
|
||||
#define FILE_INFO ((struct fs_file *) (int) FIRST_SECTOR + 8192)
|
||||
#define DIRECTORY_BUF ((struct dir_entry *) (int) FILE_INFO + 512)
|
||||
#define FILE_INFO ((struct fs_file *) (long) FIRST_SECTOR + 8192)
|
||||
#define DIRECTORY_BUF ((struct dir_entry *) (long) FILE_INFO + 512)
|
||||
|
||||
#define ROOT_SECTOR 1
|
||||
|
||||
@@ -39,7 +39,6 @@ static struct dir_entry *vstafs_nextdir (void);
|
||||
* In f_sector we store the sector number in which the information about
|
||||
* the found file is.
|
||||
*/
|
||||
extern int filepos;
|
||||
static int f_sector;
|
||||
|
||||
int
|
||||
@@ -63,7 +62,7 @@ get_file_info (int sector)
|
||||
}
|
||||
|
||||
static int curr_ext, current_direntry, current_blockpos;
|
||||
static struct alloc *a;
|
||||
static struct alloc *a1;
|
||||
|
||||
static struct dir_entry *
|
||||
vstafs_readdir (long sector)
|
||||
@@ -78,9 +77,9 @@ vstafs_readdir (long sector)
|
||||
return 0;
|
||||
}
|
||||
|
||||
a = FILE_INFO->blocks;
|
||||
a1 = FILE_INFO->blocks;
|
||||
curr_ext = 0;
|
||||
devread (a[curr_ext].a_start, 0, 512, (char *) DIRECTORY_BUF);
|
||||
devread (a1[curr_ext].a_start, 0, 512, (char *) DIRECTORY_BUF);
|
||||
current_direntry = 11;
|
||||
current_blockpos = 0;
|
||||
|
||||
@@ -93,7 +92,7 @@ vstafs_nextdir (void)
|
||||
if (current_direntry > 15)
|
||||
{
|
||||
current_direntry = 0;
|
||||
if (++current_blockpos > (a[curr_ext].a_len - 1))
|
||||
if (++current_blockpos > (a1[curr_ext].a_len - 1))
|
||||
{
|
||||
current_blockpos = 0;
|
||||
curr_ext++;
|
||||
@@ -101,8 +100,8 @@ vstafs_nextdir (void)
|
||||
|
||||
if (curr_ext < FILE_INFO->extents)
|
||||
{
|
||||
devread (a[curr_ext].a_start + current_blockpos, 0,
|
||||
512, (char *) DIRECTORY_BUF);
|
||||
devread (a1[curr_ext].a_start + current_blockpos, 0,
|
||||
512, (char *) DIRECTORY_BUF);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -188,35 +187,35 @@ vstafs_dir (char *dirname)
|
||||
int
|
||||
vstafs_read (char *addr, int len)
|
||||
{
|
||||
struct alloc *a;
|
||||
struct alloc *a2;
|
||||
int size, ret = 0, offset, curr_len = 0;
|
||||
int curr_ext;
|
||||
int curr_ext2;
|
||||
char extent;
|
||||
int ext_size;
|
||||
char *curr_pos;
|
||||
|
||||
get_file_info (f_sector);
|
||||
size = FILE_INFO->len-VSTAFS_START_DATA;
|
||||
a = FILE_INFO->blocks;
|
||||
a2 = FILE_INFO->blocks;
|
||||
|
||||
if (filepos > 0)
|
||||
{
|
||||
if (filepos < a[0].a_len * 512 - VSTAFS_START_DATA)
|
||||
if (filepos < a2[0].a_len * 512 - VSTAFS_START_DATA)
|
||||
{
|
||||
offset = filepos + VSTAFS_START_DATA;
|
||||
extent = 0;
|
||||
curr_len = a[0].a_len * 512 - offset - filepos;
|
||||
curr_len = a2[0].a_len * 512 - offset - filepos;
|
||||
}
|
||||
else
|
||||
{
|
||||
ext_size = a[0].a_len * 512 - VSTAFS_START_DATA;
|
||||
ext_size = a2[0].a_len * 512 - VSTAFS_START_DATA;
|
||||
offset = filepos - ext_size;
|
||||
extent = 1;
|
||||
do
|
||||
{
|
||||
curr_len -= ext_size;
|
||||
offset -= ext_size;
|
||||
ext_size = a[extent+1].a_len * 512;
|
||||
ext_size = a2[extent+1].a_len * 512;
|
||||
}
|
||||
while (extent < FILE_INFO->extents && offset>ext_size);
|
||||
}
|
||||
@@ -225,16 +224,16 @@ vstafs_read (char *addr, int len)
|
||||
{
|
||||
offset = VSTAFS_START_DATA;
|
||||
extent = 0;
|
||||
curr_len = a[0].a_len * 512 - offset;
|
||||
curr_len = a2[0].a_len * 512 - offset;
|
||||
}
|
||||
|
||||
curr_pos = addr;
|
||||
if (curr_len > len)
|
||||
curr_len = len;
|
||||
|
||||
for (curr_ext=extent;
|
||||
curr_ext < FILE_INFO->extents;
|
||||
curr_len = a[curr_ext].a_len * 512, curr_pos += curr_len, curr_ext++)
|
||||
for (curr_ext2=extent;
|
||||
curr_ext2 < FILE_INFO->extents;
|
||||
curr_len = a2[curr_ext].a_len * 512, curr_pos += curr_len, curr_ext2++)
|
||||
{
|
||||
ret += curr_len;
|
||||
size -= curr_len;
|
||||
@@ -244,7 +243,7 @@ vstafs_read (char *addr, int len)
|
||||
curr_len += size;
|
||||
}
|
||||
|
||||
devread (a[curr_ext].a_start,offset, curr_len, curr_pos);
|
||||
devread (a2[curr_ext2].a_start,offset, curr_len, curr_pos);
|
||||
offset = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -97,7 +97,7 @@ ino2offset (xfs_ino_t ino)
|
||||
return ino & XFS_INO_MASK(XFS_INO_OFFSET_BITS);
|
||||
}
|
||||
|
||||
static inline __const__ __uint16_t
|
||||
static inline __uint16_t
|
||||
le16 (__uint16_t x)
|
||||
{
|
||||
#ifdef __i386__
|
||||
@@ -110,7 +110,7 @@ le16 (__uint16_t x)
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline __const__ __uint32_t
|
||||
static inline __uint32_t
|
||||
le32 (__uint32_t x)
|
||||
{
|
||||
#ifdef __i386__
|
||||
@@ -130,7 +130,7 @@ le32 (__uint32_t x)
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline __const__ __uint64_t
|
||||
static inline __uint64_t
|
||||
le64 (__uint64_t x)
|
||||
{
|
||||
__uint32_t h = x >> 32;
|
||||
@@ -195,7 +195,7 @@ fsb2daddr (xfs_fsblock_t fsbno)
|
||||
}
|
||||
|
||||
#undef offsetof
|
||||
#define offsetof(t,m) ((int)&(((t *)0)->m))
|
||||
#define offsetof(t,m) ((long)&(((t *)0)->m))
|
||||
|
||||
static inline int
|
||||
btroot_maxrecs (void)
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
*
|
||||
* return pointer after reading the structure
|
||||
*/
|
||||
static void* btree_readnode(btree* bt, btree_node_desc* node, void *p)
|
||||
static void* btree_readnode(btree_node_desc* node, void *p)
|
||||
{
|
||||
node->next = bswabU32_inc(p);
|
||||
node->prev = bswabU32_inc(p);
|
||||
@@ -53,7 +53,7 @@ static void* btree_readnode(btree* bt, btree_node_desc* node, void *p)
|
||||
*
|
||||
* return pointer after reading the structure
|
||||
*/
|
||||
static void* btree_readhead(btree* bt, btree_head* head, void *p)
|
||||
static void* btree_readhead(btree_head* head, void *p)
|
||||
{
|
||||
UInt32 *q;
|
||||
head->depth = bswabU16_inc(p);
|
||||
@@ -153,7 +153,7 @@ static node_buf* node_cache_load_buf
|
||||
return NULL; // evil ...
|
||||
|
||||
result->index = node_index;
|
||||
btree_readnode(bt, &result->desc, p);
|
||||
btree_readnode(&result->desc, p);
|
||||
|
||||
e -> priority = result->desc.height * DEPTH_FACTOR;
|
||||
e -> index = node_index;
|
||||
@@ -229,10 +229,10 @@ static int btree_init(btree* bt, volume* vol, hfsp_fork_raw* fork)
|
||||
HFSP_EXTENT_DATA, bt->cnid);
|
||||
if (!p)
|
||||
return -1;
|
||||
p = btree_readnode(bt, &node, p);
|
||||
p = btree_readnode(&node, p);
|
||||
if (node.kind != HFSP_NODE_HEAD)
|
||||
return -1; // should not happen ?
|
||||
p = btree_readhead(bt, &bt->head, p);
|
||||
p = btree_readhead(&bt->head, p);
|
||||
|
||||
node_size = bt->head.node_size;
|
||||
bt->blkpernode = node_size / vol->blksize;
|
||||
|
||||
@@ -98,7 +98,7 @@ root_search_files( fs_ops_t *fs, int recursive, match_proc_t proc, const void *m
|
||||
static int
|
||||
match_file( record *r, record *parent, const void *match_data, hfsp_file_t *pt )
|
||||
{
|
||||
unsigned char *p = (char*)match_data;
|
||||
const char *p = (const char*)match_data;
|
||||
char name[256];
|
||||
int ret=1;
|
||||
|
||||
@@ -340,7 +340,7 @@ file_read( file_desc_t *fd, void *buf, size_t count )
|
||||
max -= t->pos - curpos;
|
||||
}
|
||||
size = (count-act_count > max)? max : count-act_count;
|
||||
memcpy( buf + act_count, &buf2[add], size );
|
||||
memcpy( (char *)buf + act_count, &buf2[add], size );
|
||||
|
||||
curpos += blksize;
|
||||
act_count += size;
|
||||
|
||||
@@ -79,8 +79,8 @@ SInt32 fast_unicode_compare ( const hfsp_unistr255 *ustr1,
|
||||
register UInt16 length1 = ustr1->strlen;
|
||||
register UInt16 length2 = ustr2->strlen;
|
||||
register const UInt16* lowerCaseTable = gLowerCaseTable;
|
||||
register UInt16* str1 = ustr1->name;
|
||||
register UInt16* str2 = ustr2->name;
|
||||
register const UInt16* str1 = ustr1->name;
|
||||
register const UInt16* str2 = ustr2->name;
|
||||
|
||||
while (1) {
|
||||
// Set default values for c1, c2 in case there are no more valid chars
|
||||
|
||||
@@ -115,7 +115,7 @@ volume_readfork(void *p, hfsp_fork_raw* f)
|
||||
* ToDo: add more consitency checks.
|
||||
*/
|
||||
static int
|
||||
volume_readbuf(volume * vol, hfsp_vh* vh, void* p)
|
||||
volume_readbuf(volume * vol, hfsp_vh* vh, char * p)
|
||||
{
|
||||
if( (vh->signature = bswabU16_inc(p)) != HFSP_VOLHEAD_SIG)
|
||||
HFSP_ERROR(-1, "This is not a HFS+ volume");
|
||||
@@ -168,7 +168,7 @@ volume_read_wrapper(volume * vol, hfsp_vh* vh)
|
||||
{
|
||||
UInt16 signature;
|
||||
char buf[vol->blksize];
|
||||
void *p = buf;
|
||||
char *p = buf;
|
||||
|
||||
if( volume_readinbuf(vol, buf, 2) ) // Wrapper or volume header starts here
|
||||
return -1;
|
||||
|
||||
Reference in New Issue
Block a user