Skip to content

Commit cdbbe84

Browse files
committedJun 11, 2021
modules: fixed signedness warnings
1 parent 65d2571 commit cdbbe84

File tree

23 files changed

+53
-50
lines changed

23 files changed

+53
-50
lines changed
 

‎modules/debug/ioptrap/ioptrap.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ exception_type_t dbg_setjmp()
7777
typedef struct _smod_mod_info
7878
{
7979
struct _smod_mod_info *next;
80-
u8 *name;
80+
char *name;
8181
u16 version;
8282
u16 newflags; /* For modload shipped with games. */
8383
u16 id;

‎modules/debug/ps2link/cmdHandler.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ cmdPowerOff(void *arg)
326326
reset.cmd = htonl(PKO_RESET_CMD);
327327
reset.len = 0;
328328

329-
pkoReset((char *)&reset, sizeof(reset));
329+
pkoReset((unsigned char *)&reset, sizeof(reset));
330330
#endif
331331
}
332332

‎modules/debug/ps2link/excepHandler.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ extern int excepscrdump;
2222
typedef struct _smod_mod_info
2323
{
2424
struct _smod_mod_info *next;
25-
u8 *name;
25+
char *name;
2626
u16 version;
2727
u16 newflags; /* For modload shipped with games. */
2828
u16 id;

‎modules/ds34bt/iop/ds34bt.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,7 @@ static void HCI_event_task(int result)
610610
}
611611
DPRINTF("\n");
612612
for (i = 0; i < MAX_PADS; i++) {
613-
if (strncmp(ds34pad[i].bdaddr, hci_buf + 5, 6) == 0) {
613+
if (memcmp(ds34pad[i].bdaddr, hci_buf + 5, 6) == 0) {
614614
// store the handle for the ACL connection
615615
ds34pad[i].hci_handle = hci_buf[3] | ((hci_buf[4] & 0x0F) << 8);
616616
break;
@@ -666,14 +666,14 @@ static void HCI_event_task(int result)
666666
DPRINTF("\t Status = 0x%02X \n", hci_buf[2]);
667667
if (!hci_buf[2]) {
668668
for (i = 0; i < MAX_PADS; i++) {
669-
if (strncmp(ds34pad[i].bdaddr, hci_buf + 3, 6) == 0) {
669+
if (memcmp(ds34pad[i].bdaddr, hci_buf + 3, 6) == 0) {
670670
break;
671671
}
672672
}
673673
if (i >= MAX_PADS) {
674674
break;
675675
}
676-
if (strncmp(hci_buf + 9, "Wireless Controller", 19) == 0) {
676+
if (memcmp(hci_buf + 9, "Wireless Controller", 19) == 0) {
677677
ds34pad[i].type = DS4;
678678
ds34pad[i].isfake = 0;
679679
DPRINTF("\t Type: Dualshock 4 \n");
@@ -1654,7 +1654,7 @@ void *rpc_sf(int cmd, void *data, int size)
16541654
ds34bt_set_led((u8 *)(data + 1), *(u8 *)data);
16551655
break;
16561656
case DS34BT_GET_DATA:
1657-
ds34bt_get_data((u8 *)data, 18, *(u8 *)data);
1657+
ds34bt_get_data((char *)data, 18, *(u8 *)data);
16581658
break;
16591659
case DS34BT_RESET:
16601660
ds34bt_reset();

‎modules/ds34bt/iop/imports.lst

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ stdio_IMPORTS_end
1111

1212
sysclib_IMPORTS_start
1313
I_strncmp
14+
I_memcmp
1415
sysclib_IMPORTS_end
1516

1617
thsemap_IMPORTS_start

‎modules/ds34usb/iop/ds34usb.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -728,7 +728,7 @@ void *rpc_sf(int cmd, void *data, int size)
728728
ds34usb_set_led((u8 *)(data + 1), *(u8 *)data);
729729
break;
730730
case DS34USB_GET_DATA:
731-
ds34usb_get_data((u8 *)data, 18, *(u8 *)data);
731+
ds34usb_get_data((char *)data, 18, *(u8 *)data);
732732
break;
733733
case DS34USB_RESET:
734734
ds34usb_reset();

‎modules/iopcore/cdvdman/ioplib_util.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ static struct FakeModule modulefake_list[] = {
8282
{NULL, NULL, 0, 0}};
8383

8484
//--------------------------------------------------------------
85-
int getModInfo(u8 *modname, modinfo_t *info)
85+
int getModInfo(char *modname, modinfo_t *info)
8686
{
8787
iop_library_t *libptr;
8888
register int i;

‎modules/iopcore/cdvdman/ioplib_util.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ typedef struct
1313
void **exports;
1414
} modinfo_t;
1515

16-
int getModInfo(u8 *modname, modinfo_t *info);
16+
int getModInfo(char *modname, modinfo_t *info);
1717
void hookMODLOAD(void);
1818

1919
#endif /* IOPLIB_UTIL_H */

‎modules/iopcore/cdvdman/smb.c

+7-7
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ static int asciiToUtf16(char *out, const char *in)
232232
{
233233
int len;
234234
const char *pIn;
235-
u8 *pOut;
235+
char *pOut;
236236

237237
for (pIn = in, pOut = out, len = 0; *pIn != '\0'; pIn++, pOut += 2, len += 2) {
238238
pOut[0] = *pIn;
@@ -381,26 +381,26 @@ int smb_SessionSetupAndX(u32 capabilities)
381381
}
382382

383383
// Add User name
384-
offset += setStringField(&SSR->ByteField[offset], server_specs.Username);
384+
offset += setStringField((char *)&SSR->ByteField[offset], server_specs.Username);
385385

386386
// PrimaryDomain, acquired from Negotiate Protocol Response data
387-
offset += setStringField(&SSR->ByteField[offset], server_specs.PrimaryDomainServerName);
387+
offset += setStringField((char *)&SSR->ByteField[offset], server_specs.PrimaryDomainServerName);
388388

389389
// NativeOS
390390
if (useUnicode && ((offset & 1) != 0)) {
391391
//If Unicode is used, the field must begin on a 16-bit aligned address.
392392
SSR->ByteField[offset] = '\0';
393393
offset++;
394394
}
395-
offset += setStringField(&SSR->ByteField[offset], "PlayStation 2");
395+
offset += setStringField((char *)&SSR->ByteField[offset], "PlayStation 2");
396396

397397
// NativeLanMan
398398
if (useUnicode && ((offset & 1) != 0)) {
399399
//If Unicode is used, the field must begin on a 16-bit aligned address.
400400
SSR->ByteField[offset] = '\0';
401401
offset++;
402402
}
403-
offset += setStringField(&SSR->ByteField[offset], "SMBMAN");
403+
offset += setStringField((char *)&SSR->ByteField[offset], "SMBMAN");
404404

405405
SSR->ByteCount = offset;
406406

@@ -466,7 +466,7 @@ int smb_TreeConnectAndX(char *ShareName)
466466
}
467467

468468
// Add share name
469-
offset += setStringField(&TCR->ByteField[offset], ShareName);
469+
offset += setStringField((char *)&TCR->ByteField[offset], ShareName);
470470

471471
mips_memcpy(&TCR->ByteField[offset], "?????\0", 6); // Service, any type of device
472472
offset += 6;
@@ -522,7 +522,7 @@ int smb_OpenAndX(char *filename, u16 *FID, int Write)
522522
}
523523

524524
// Add filename
525-
offset += setStringField(&OR->ByteField[offset], filename);
525+
offset += setStringField((char *)&OR->ByteField[offset], filename);
526526
OR->ByteCount = offset;
527527

528528
nb_SetSessionMessage(sizeof(OpenAndXRequest_t) + offset + 1);

‎modules/iopcore/common/cdvd_config.h

+6-6
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,18 @@ struct cdvdman_settings_hdd
2626
struct cdvdman_settings_smb
2727
{
2828
struct cdvdman_settings_common common;
29-
s8 filename[80];
29+
char filename[80];
3030
union
3131
{
3232
struct
3333
{
3434
//Please keep the string lengths in-sync with the limits within the UI.
35-
s8 smb_ip[16];
35+
char smb_ip[16];
3636
u16 smb_port;
37-
s8 smb_share[32];
38-
s8 smb_prefix[32];
39-
s8 smb_user[32];
40-
s8 smb_password[32];
37+
char smb_share[32];
38+
char smb_prefix[32];
39+
char smb_user[32];
40+
char smb_password[32];
4141
};
4242
u16 FIDs[ISO_MAX_PARTS];
4343
};

‎modules/iopcore/common/oplsmb.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@ typedef struct
22
{
33
u32 MaxBufferSize;
44
u32 SessionKey;
5-
u8 PrimaryDomainServerName[32];
5+
char PrimaryDomainServerName[32];
66
u8 EncryptionKey[8];
77
u32 Capabilities;
88
u16 MaxMpxCount;
99
u8 SecurityMode; // 0 = share level, 1 = user level
1010
u8 PasswordType; // 0 = PlainText passwords, 1 = use challenge/response
1111
char Username[36];
12-
u8 Password[48]; // either PlainText, either hashed
12+
char Password[48]; // either PlainText, either hashed
1313
int PasswordLen;
1414
int HashedFlag;
1515
void *IOPaddr;

‎modules/iopcore/imgdrv/imgdrv.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ iop_device_ops_t my_device_ops =
6868
dummy_fs,//chstat*/
6969
};
7070

71-
const u8 name[] = "img";
71+
const char name[] = "img";
7272
iop_device_t my_device = {
7373
name,
7474
IOP_DT_FS,

‎modules/iopcore/udnl-t300/udnl.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -801,7 +801,7 @@ static void ParseIOPBTCONF(const struct ImageData *ImageDataBuffer, unsigned int
801801
{
802802
unsigned int FilesRemaining, i, NumModules;
803803
const char *ptr;
804-
unsigned char filename_temp[16];
804+
char filename_temp[16];
805805
struct RomdirFileStat FileStat;
806806
struct RomdirFileStat ModuleFileStat;
807807
const void **ModList;

‎modules/iopcore/udnl/udnl.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -702,7 +702,7 @@ static void ParseIOPBTCONF(const struct ImageData *ImageDataBuffer, unsigned int
702702
{
703703
unsigned int FilesRemaining, i, NumModules;
704704
const char *ptr;
705-
unsigned char filename_temp[16];
705+
char filename_temp[16];
706706
struct RomdirFileStat FileStat;
707707
struct RomdirFileStat ModuleFileStat;
708708
const void **ModList;

‎modules/isofs/imports.lst

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ stdio_IMPORTS_end
2121

2222
sysclib_IMPORTS_start
2323
I_memset
24+
I_memcmp
2425
I_memcpy
2526
I_strcmp
2627
I_strncmp

‎modules/isofs/isofs.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,7 @@ static int ProbeISO9660(int fd, unsigned int sector, layer_info_t *layer_info)
488488

489489
longLseek(fd, sector);
490490
if (read(fd, cdvdman_buf, 2048) == 2048) {
491-
if ((cdvdman_buf[0x00] == 1) && (!strncmp(&cdvdman_buf[0x01], "CD001", 5))) {
491+
if ((cdvdman_buf[0x00] == 1) && (!memcmp(&cdvdman_buf[0x01], "CD001", 5))) {
492492
struct dirTocEntry *tocEntryPointer = (struct dirTocEntry *)&cdvdman_buf[0x9c];
493493

494494
layer_info->maxLBA = *(u32 *)&cdvdman_buf[0x50];

‎modules/mcemu/mcemu_utils.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ void mips_memset(void *, int, unsigned);
3232

3333
#define oplutils_IMPORTS_start DECLARE_IMPORT_TABLE(oplutils, 1, 2)
3434

35-
int getModInfo(u8 *modname, modinfo_t *info);
35+
int getModInfo(char *modname, modinfo_t *info);
3636
#define I_getModInfo DECLARE_IMPORT(4, getModInfo)
3737

3838
int oplRegisterShutdownCallback(oplShutdownCb_t cb);

‎modules/network/common/httpclient.h

+5-5
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
int HttpInit(void);
66
void HttpDeinit(void);
77

8-
int HttpEstabConnection(s8 *server, u16 port);
8+
int HttpEstabConnection(char *server, u16 port);
99
void HttpCloseConnection(s32 HttpSocket);
1010

1111
/* mtime[0] = Years since year 2000
@@ -15,7 +15,7 @@ void HttpCloseConnection(s32 HttpSocket);
1515
mtime[4] = Minute (0-59)
1616
mtime[5] = Second (0-59) */
1717

18-
int HttpSendGetRequest(s32 HttpSocket, const s8 *UserAgent, const s8 *host, s8 *mode, const u8 *mtime, const s8 *uri, u8 *output, u16 *out_len);
18+
int HttpSendGetRequest(s32 HttpSocket, const char *UserAgent, const char *host, s8 *mode, const u8 *mtime, const char *uri, char *output, u16 *out_len);
1919

2020
#define HTTP_CLIENT_SERVER_NAME_MAX 30
2121
#define HTTP_CLIENT_USER_AGENT_MAX 16
@@ -41,12 +41,12 @@ struct HttpClientConnCloseArgs
4141
struct HttpClientSendGetArgs
4242
{
4343
s32 socket;
44-
s8 UserAgent[HTTP_CLIENT_USER_AGENT_MAX];
45-
s8 host[HTTP_CLIENT_SERVER_NAME_MAX];
44+
char UserAgent[HTTP_CLIENT_USER_AGENT_MAX];
45+
char host[HTTP_CLIENT_SERVER_NAME_MAX];
4646
s8 mode;
4747
u8 hasMtime;
4848
u8 mtime[6];
49-
s8 uri[HTTP_CLIENT_URI_MAX];
49+
char uri[HTTP_CLIENT_URI_MAX];
5050
u16 out_len;
5151
void *output;
5252
};

‎modules/network/httpclient/httpclient.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ static void HttpParseEntityLine(const char *line)
119119
HeaderLineNumber++;
120120
}
121121

122-
static int HttpGetResponse(s32 socket, s8 *mode, s8 *buffer, u16 *length)
122+
static int HttpGetResponse(s32 socket, s8 *mode, char *buffer, u16 *length)
123123
{
124124
char work[HTTP_WORK_BUFFER_SIZE + 1], EndOfEntity, *ptr, *next_ptr, *PayloadPtr;
125125
int result, DataAvailable, PayloadAmount;
@@ -215,7 +215,7 @@ static int ResolveHostname(char *hostname, struct in_addr *ip)
215215
return 1;
216216
}
217217

218-
int HttpEstabConnection(s8 *server, u16 port)
218+
int HttpEstabConnection(char *server, u16 port)
219219
{
220220
struct in_addr ip;
221221
int result;
@@ -250,7 +250,7 @@ static const char *GetDayInWeek(const unsigned char *mtime)
250250
return dayLabels[(5 + days) % 7]; //2000/1/1 was a Saturday (5).
251251
}
252252

253-
int HttpSendGetRequest(s32 HttpSocket, const s8 *UserAgent, const s8 *host, s8 *mode, const u8 *mtime, const s8 *uri, u8 *output, u16 *out_len)
253+
int HttpSendGetRequest(s32 HttpSocket, const char *UserAgent, const char *host, s8 *mode, const u8 *mtime, const char *uri, char *output, u16 *out_len)
254254
{
255255
const char *months[] = {
256256
"Jan",

‎modules/network/httpclient/main.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ static void *SifRpc_handler(int fno, void *buffer, int nbytes)
4040
((struct HttpClientSendGetArgs *)buffer)->out_len = sizeof(DmaBuffer);
4141
}
4242

43-
((struct HttpClientSendGetResult *)SifServerTxBuffer)->result = HttpSendGetRequest(((struct HttpClientSendGetArgs *)buffer)->socket, ((struct HttpClientSendGetArgs *)buffer)->UserAgent, ((struct HttpClientSendGetArgs *)buffer)->host, &((struct HttpClientSendGetArgs *)buffer)->mode, ((struct HttpClientSendGetArgs *)buffer)->hasMtime ? ((struct HttpClientSendGetArgs *)buffer)->mtime : NULL, ((struct HttpClientSendGetArgs *)buffer)->uri, DmaBuffer, &((struct HttpClientSendGetArgs *)buffer)->out_len);
43+
((struct HttpClientSendGetResult *)SifServerTxBuffer)->result = HttpSendGetRequest(((struct HttpClientSendGetArgs *)buffer)->socket, ((struct HttpClientSendGetArgs *)buffer)->UserAgent, ((struct HttpClientSendGetArgs *)buffer)->host, &((struct HttpClientSendGetArgs *)buffer)->mode, ((struct HttpClientSendGetArgs *)buffer)->hasMtime ? ((struct HttpClientSendGetArgs *)buffer)->mtime : NULL, ((struct HttpClientSendGetArgs *)buffer)->uri, (char *)DmaBuffer, &((struct HttpClientSendGetArgs *)buffer)->out_len);
4444
((struct HttpClientSendGetResult *)SifServerTxBuffer)->mode = ((struct HttpClientSendGetArgs *)buffer)->mode;
4545
((struct HttpClientSendGetResult *)SifServerTxBuffer)->out_len = ((struct HttpClientSendGetArgs *)buffer)->out_len;
4646

‎modules/network/smbinit/smbauth.c

+8-8
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818
/*
1919
* LM_Password_Hash: this function create a LM password hash from a given password
2020
*/
21-
static unsigned char *LM_Password_Hash(const unsigned char *password, unsigned char *cipher)
21+
static unsigned char *LM_Password_Hash(const char *password, unsigned char *cipher)
2222
{
23-
unsigned char tmp_pass[14] = {"\0\0\0\0\0\0\0\0\0\0\0\0\0\0"};
23+
char tmp_pass[14] = {"\0\0\0\0\0\0\0\0\0\0\0\0\0\0"};
2424
unsigned char K1[7];
2525
unsigned char K2[7];
2626
int i;
@@ -38,18 +38,18 @@ static unsigned char *LM_Password_Hash(const unsigned char *password, unsigned c
3838
memcpy(K2, &tmp_pass[7], 7);
3939

4040
/* encrypt the magic string with the keys */
41-
DES(K1, "KGS!@#$%", &cipher[0]);
42-
DES(K2, "KGS!@#$%", &cipher[8]);
41+
DES(K1, (unsigned char *)"KGS!@#$%", &cipher[0]);
42+
DES(K2, (unsigned char *)"KGS!@#$%", &cipher[8]);
4343

4444
return (unsigned char *)cipher;
4545
}
4646

4747
/*
4848
* NTLM_Password_Hash: this function create a NTLM password hash from a given password
4949
*/
50-
static unsigned char *NTLM_Password_Hash(const unsigned char *password, unsigned char *cipher)
50+
static unsigned char *NTLM_Password_Hash(const char *password, unsigned char *cipher)
5151
{
52-
u8 passwd_buf[512];
52+
char passwd_buf[512];
5353
int i, j;
5454

5555
memset(passwd_buf, 0, sizeof(passwd_buf));
@@ -59,7 +59,7 @@ static unsigned char *NTLM_Password_Hash(const unsigned char *password, unsigned
5959
passwd_buf[j] = password[i];
6060

6161
/* get the message digest */
62-
MD4(passwd_buf, j, cipher);
62+
MD4((unsigned char *)passwd_buf, j, cipher);
6363

6464
return (unsigned char *)cipher;
6565
}
@@ -93,7 +93,7 @@ static unsigned char *LM_Response(const unsigned char *LMpasswordhash, unsigned
9393
/*
9494
* GenerateLMHashes: function used to generate LM/NTLM hashes
9595
*/
96-
static void GenerateLMHashes(char *Password, int PasswordType, u8 *EncryptionKey, int *PasswordLen, u8 *Buffer)
96+
static void GenerateLMHashes(char *Password, int PasswordType, u8 *EncryptionKey, int *PasswordLen, char *Buffer)
9797
{
9898
u8 LMpasswordhash[16];
9999
u8 NTLMpasswordhash[16];

‎modules/pademu/ds34bt.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,7 @@ static void HCI_event_task(int result)
547547
}
548548
DPRINTF("\n");
549549
for (i = 0; i < MAX_PADS; i++) {
550-
if (strncmp(ds34pad[i].bdaddr, hci_buf + 5, 6) == 0) {
550+
if (memcmp(ds34pad[i].bdaddr, hci_buf + 5, 6) == 0) {
551551
// store the handle for the ACL connection
552552
ds34pad[i].hci_handle = hci_buf[3] | ((hci_buf[4] & 0x0F) << 8);
553553
break;
@@ -603,14 +603,14 @@ static void HCI_event_task(int result)
603603
DPRINTF("\t Status = 0x%02X \n", hci_buf[2]);
604604
if (!hci_buf[2]) {
605605
for (i = 0; i < MAX_PADS; i++) {
606-
if (strncmp(ds34pad[i].bdaddr, hci_buf + 3, 6) == 0) {
606+
if (memcmp(ds34pad[i].bdaddr, hci_buf + 3, 6) == 0) {
607607
break;
608608
}
609609
}
610610
if (i >= MAX_PADS) {
611611
break;
612612
}
613-
if (strncmp(hci_buf + 9, "Wireless Controller", 19) == 0) {
613+
if (memcmp(hci_buf + 9, "Wireless Controller", 19) == 0) {
614614
ds34pad[i].type = DS4;
615615
ds34pad[i].isfake = 0;
616616
DPRINTF("\t Type: Dualshock 4 \n");

0 commit comments

Comments
 (0)