mirror of
https://github.com/Rockbox/rockbox.git
synced 2026-07-10 13:29:52 -04:00
utils: Fix a small pile of warnings
Change-Id: Idf95fc0a6ce94ebb2282bc3b017bc7ba8aeb42fc
This commit is contained in:
parent
3403e3cfb9
commit
0fc352da0f
4 changed files with 12 additions and 21 deletions
|
|
@ -890,7 +890,7 @@ static void dfuapi_destroy(struct dfuDev *dfuh)
|
|||
|
||||
static struct dfuDev *dfuapi_create(void)
|
||||
{
|
||||
return calloc(sizeof(struct dfuDev), 1);
|
||||
return calloc(1, sizeof(struct dfuDev));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@ static int g_nvp_node = -1;
|
|||
|
||||
#define errorf(...) do { cprintf(GREY, __VA_ARGS__); return __LINE__; } while(0)
|
||||
|
||||
#if 0
|
||||
static void print_hex(void *p, int size, int unit)
|
||||
{
|
||||
uint8_t *p8 = p;
|
||||
|
|
@ -63,6 +64,7 @@ static void print_hex(void *p, int size, int unit)
|
|||
printf(" %08x", *p32);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#define SECTOR 512u
|
||||
#define EMMC_MINIBOOT_START 0
|
||||
|
|
|
|||
|
|
@ -90,13 +90,7 @@ static void init_keys(const char* passwd,unsigned long* pkeys,const z_crc_t FAR
|
|||
# define ZCR_SEED2 3141592654UL /* use PI as default pattern */
|
||||
# endif
|
||||
|
||||
static int crypthead(passwd, buf, bufSize, pkeys, pcrc_32_tab, crcForCrypting)
|
||||
const char *passwd; /* password string */
|
||||
unsigned char *buf; /* where to write header */
|
||||
int bufSize;
|
||||
unsigned long* pkeys;
|
||||
const z_crc_t FAR * pcrc_32_tab;
|
||||
unsigned long crcForCrypting;
|
||||
static int crypthead(const char *passwd, unsigned char *buf, int bufSize, unsigned long *pkeys, const z_crc_t FAR *pcrc_32_tab, unsigned long crcForCrypting)
|
||||
{
|
||||
int n; /* index in random header */
|
||||
int t; /* temporary */
|
||||
|
|
|
|||
|
|
@ -144,11 +144,7 @@ int sansa_read_partinfo(struct sansa_t* sansa, int silent)
|
|||
|
||||
/* Return the first occurrence of NEEDLE in HAYSTACK. */
|
||||
static void *
|
||||
sansa_memmem (haystack, haystack_len, needle, needle_len)
|
||||
const void *haystack;
|
||||
size_t haystack_len;
|
||||
const void *needle;
|
||||
size_t needle_len;
|
||||
sansa_memmem (const void *haystack, size_t haystack_len, const void *needle, size_t needle_len)
|
||||
{
|
||||
const char *begin;
|
||||
const char *const last_possible
|
||||
|
|
@ -248,7 +244,7 @@ static const uint32_t keys[][4] = {
|
|||
{ 0xe494e96e, 0x3ee32966, 0x6f48512b, 0xa93fbb42 }, /* "sansa" */
|
||||
{ 0xd7b10538, 0xc662945b, 0x1b3fce68, 0xf389c0e6 }, /* "sansa_gh" */
|
||||
{ 0x1d29ddc0, 0x2579c2cd, 0xce339e1a, 0x75465dfe }, /* sansa 103 */
|
||||
|
||||
|
||||
{ 0x2a7968de, 0x15127979, 0x142e60a7, 0xe49c1893 }, /* c200 1.00.03 */
|
||||
{ 0xbf2d06fa, 0xf0e23d59, 0x29738132, 0xe2d04ca7 }, /* c200 1.00.04 and up*/
|
||||
{ 0xa913d139, 0xf842f398, 0x3e03f1a6, 0x060ee012 }, /* c200 1.01.05 and up*/
|
||||
|
|
@ -396,7 +392,7 @@ int is_sansa(struct sansa_t* sansa)
|
|||
(sansa->pinfo[0].type != 0x0c) &&
|
||||
(sansa->pinfo[0].type != 0x0e)) ||
|
||||
(sansa->pinfo[1].type != 0x84) ||
|
||||
(sansa->pinfo[2].type != 0x00) ||
|
||||
(sansa->pinfo[2].type != 0x00) ||
|
||||
(sansa->pinfo[3].type != 0x00)) {
|
||||
/* Bad partition layout, abort */
|
||||
return -1;
|
||||
|
|
@ -617,7 +613,7 @@ static int load_original_firmware(struct sansa_t* sansa, unsigned char* buf, str
|
|||
{
|
||||
int ppmi_length;
|
||||
int n;
|
||||
|
||||
|
||||
/* Read 512 bytes from PPMI_OFFSET - the PPMI header plus the mi4 header */
|
||||
if (sansa_seek_and_read(sansa, sansa->start + PPMI_OFFSET, buf, 512) < 0) {
|
||||
return -1;
|
||||
|
|
@ -835,7 +831,7 @@ int sansa_update_of(struct sansa_t* sansa, const char* filename)
|
|||
struct mi4header_t mi4header;
|
||||
unsigned char buf[512];
|
||||
|
||||
/* Step 1 - check we have an OF on the Sansa to upgrade. We expect the
|
||||
/* Step 1 - check we have an OF on the Sansa to upgrade. We expect the
|
||||
Rockbox bootloader to be installed and the OF to be after it on disk. */
|
||||
|
||||
/* Read 512 bytes from PPMI_OFFSET - the PPMI header */
|
||||
|
|
@ -905,7 +901,7 @@ int sansa_update_of(struct sansa_t* sansa, const char* filename)
|
|||
fprintf(stderr,"[ERR] Short write in sansa_update_of\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
/* Step 4 - zero out the nvparams section - we have to do this or we end up
|
||||
with multiple copies of the nvparams data and don't know which one to
|
||||
work with for the database rebuild disabling trick in our bootloader */
|
||||
|
|
@ -916,7 +912,7 @@ int sansa_update_of(struct sansa_t* sansa, const char* filename)
|
|||
sansa->start+NVPARAMS_OFFSET+0x200);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
memset(sansa->sectorbuf,0,NVPARAMS_SIZE);
|
||||
n=sansa_write(sansa, NVPARAMS_SIZE);
|
||||
if (n < NVPARAMS_SIZE) {
|
||||
|
|
@ -924,7 +920,7 @@ int sansa_update_of(struct sansa_t* sansa, const char* filename)
|
|||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -971,4 +967,3 @@ int sansa_update_ppbl(struct sansa_t* sansa, const char* filename)
|
|||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue