Skip to content

Commit

Permalink
modules: fixed signedness warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
uyjulian committed Jun 11, 2021
1 parent 65d2571 commit cdbbe84
Show file tree
Hide file tree
Showing 23 changed files with 53 additions and 50 deletions.
2 changes: 1 addition & 1 deletion modules/debug/ioptrap/ioptrap.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ exception_type_t dbg_setjmp()
typedef struct _smod_mod_info
{
struct _smod_mod_info *next;
u8 *name;
char *name;
u16 version;
u16 newflags; /* For modload shipped with games. */
u16 id;
Expand Down
2 changes: 1 addition & 1 deletion modules/debug/ps2link/cmdHandler.c
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ cmdPowerOff(void *arg)
reset.cmd = htonl(PKO_RESET_CMD);
reset.len = 0;

pkoReset((char *)&reset, sizeof(reset));
pkoReset((unsigned char *)&reset, sizeof(reset));
#endif
}

Expand Down
2 changes: 1 addition & 1 deletion modules/debug/ps2link/excepHandler.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ extern int excepscrdump;
typedef struct _smod_mod_info
{
struct _smod_mod_info *next;
u8 *name;
char *name;
u16 version;
u16 newflags; /* For modload shipped with games. */
u16 id;
Expand Down
8 changes: 4 additions & 4 deletions modules/ds34bt/iop/ds34bt.c
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,7 @@ static void HCI_event_task(int result)
}
DPRINTF("\n");
for (i = 0; i < MAX_PADS; i++) {
if (strncmp(ds34pad[i].bdaddr, hci_buf + 5, 6) == 0) {
if (memcmp(ds34pad[i].bdaddr, hci_buf + 5, 6) == 0) {
// store the handle for the ACL connection
ds34pad[i].hci_handle = hci_buf[3] | ((hci_buf[4] & 0x0F) << 8);
break;
Expand Down Expand Up @@ -666,14 +666,14 @@ static void HCI_event_task(int result)
DPRINTF("\t Status = 0x%02X \n", hci_buf[2]);
if (!hci_buf[2]) {
for (i = 0; i < MAX_PADS; i++) {
if (strncmp(ds34pad[i].bdaddr, hci_buf + 3, 6) == 0) {
if (memcmp(ds34pad[i].bdaddr, hci_buf + 3, 6) == 0) {
break;
}
}
if (i >= MAX_PADS) {
break;
}
if (strncmp(hci_buf + 9, "Wireless Controller", 19) == 0) {
if (memcmp(hci_buf + 9, "Wireless Controller", 19) == 0) {
ds34pad[i].type = DS4;
ds34pad[i].isfake = 0;
DPRINTF("\t Type: Dualshock 4 \n");
Expand Down Expand Up @@ -1654,7 +1654,7 @@ void *rpc_sf(int cmd, void *data, int size)
ds34bt_set_led((u8 *)(data + 1), *(u8 *)data);
break;
case DS34BT_GET_DATA:
ds34bt_get_data((u8 *)data, 18, *(u8 *)data);
ds34bt_get_data((char *)data, 18, *(u8 *)data);
break;
case DS34BT_RESET:
ds34bt_reset();
Expand Down
1 change: 1 addition & 0 deletions modules/ds34bt/iop/imports.lst
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ stdio_IMPORTS_end

sysclib_IMPORTS_start
I_strncmp
I_memcmp
sysclib_IMPORTS_end

thsemap_IMPORTS_start
Expand Down
2 changes: 1 addition & 1 deletion modules/ds34usb/iop/ds34usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -728,7 +728,7 @@ void *rpc_sf(int cmd, void *data, int size)
ds34usb_set_led((u8 *)(data + 1), *(u8 *)data);
break;
case DS34USB_GET_DATA:
ds34usb_get_data((u8 *)data, 18, *(u8 *)data);
ds34usb_get_data((char *)data, 18, *(u8 *)data);
break;
case DS34USB_RESET:
ds34usb_reset();
Expand Down
2 changes: 1 addition & 1 deletion modules/iopcore/cdvdman/ioplib_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ static struct FakeModule modulefake_list[] = {
{NULL, NULL, 0, 0}};

//--------------------------------------------------------------
int getModInfo(u8 *modname, modinfo_t *info)
int getModInfo(char *modname, modinfo_t *info)
{
iop_library_t *libptr;
register int i;
Expand Down
2 changes: 1 addition & 1 deletion modules/iopcore/cdvdman/ioplib_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ typedef struct
void **exports;
} modinfo_t;

int getModInfo(u8 *modname, modinfo_t *info);
int getModInfo(char *modname, modinfo_t *info);
void hookMODLOAD(void);

#endif /* IOPLIB_UTIL_H */
14 changes: 7 additions & 7 deletions modules/iopcore/cdvdman/smb.c
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ static int asciiToUtf16(char *out, const char *in)
{
int len;
const char *pIn;
u8 *pOut;
char *pOut;

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

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

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

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

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

SSR->ByteCount = offset;

Expand Down Expand Up @@ -466,7 +466,7 @@ int smb_TreeConnectAndX(char *ShareName)
}

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

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

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

nb_SetSessionMessage(sizeof(OpenAndXRequest_t) + offset + 1);
Expand Down
12 changes: 6 additions & 6 deletions modules/iopcore/common/cdvd_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,18 @@ struct cdvdman_settings_hdd
struct cdvdman_settings_smb
{
struct cdvdman_settings_common common;
s8 filename[80];
char filename[80];
union
{
struct
{
//Please keep the string lengths in-sync with the limits within the UI.
s8 smb_ip[16];
char smb_ip[16];
u16 smb_port;
s8 smb_share[32];
s8 smb_prefix[32];
s8 smb_user[32];
s8 smb_password[32];
char smb_share[32];
char smb_prefix[32];
char smb_user[32];
char smb_password[32];
};
u16 FIDs[ISO_MAX_PARTS];
};
Expand Down
4 changes: 2 additions & 2 deletions modules/iopcore/common/oplsmb.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ typedef struct
{
u32 MaxBufferSize;
u32 SessionKey;
u8 PrimaryDomainServerName[32];
char PrimaryDomainServerName[32];
u8 EncryptionKey[8];
u32 Capabilities;
u16 MaxMpxCount;
u8 SecurityMode; // 0 = share level, 1 = user level
u8 PasswordType; // 0 = PlainText passwords, 1 = use challenge/response
char Username[36];
u8 Password[48]; // either PlainText, either hashed
char Password[48]; // either PlainText, either hashed
int PasswordLen;
int HashedFlag;
void *IOPaddr;
Expand Down
2 changes: 1 addition & 1 deletion modules/iopcore/imgdrv/imgdrv.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ iop_device_ops_t my_device_ops =
dummy_fs,//chstat*/
};

const u8 name[] = "img";
const char name[] = "img";
iop_device_t my_device = {
name,
IOP_DT_FS,
Expand Down
2 changes: 1 addition & 1 deletion modules/iopcore/udnl-t300/udnl.c
Original file line number Diff line number Diff line change
Expand Up @@ -801,7 +801,7 @@ static void ParseIOPBTCONF(const struct ImageData *ImageDataBuffer, unsigned int
{
unsigned int FilesRemaining, i, NumModules;
const char *ptr;
unsigned char filename_temp[16];
char filename_temp[16];
struct RomdirFileStat FileStat;
struct RomdirFileStat ModuleFileStat;
const void **ModList;
Expand Down
2 changes: 1 addition & 1 deletion modules/iopcore/udnl/udnl.c
Original file line number Diff line number Diff line change
Expand Up @@ -702,7 +702,7 @@ static void ParseIOPBTCONF(const struct ImageData *ImageDataBuffer, unsigned int
{
unsigned int FilesRemaining, i, NumModules;
const char *ptr;
unsigned char filename_temp[16];
char filename_temp[16];
struct RomdirFileStat FileStat;
struct RomdirFileStat ModuleFileStat;
const void **ModList;
Expand Down
1 change: 1 addition & 0 deletions modules/isofs/imports.lst
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ stdio_IMPORTS_end

sysclib_IMPORTS_start
I_memset
I_memcmp
I_memcpy
I_strcmp
I_strncmp
Expand Down
2 changes: 1 addition & 1 deletion modules/isofs/isofs.c
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ static int ProbeISO9660(int fd, unsigned int sector, layer_info_t *layer_info)

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

layer_info->maxLBA = *(u32 *)&cdvdman_buf[0x50];
Expand Down
2 changes: 1 addition & 1 deletion modules/mcemu/mcemu_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ void mips_memset(void *, int, unsigned);

#define oplutils_IMPORTS_start DECLARE_IMPORT_TABLE(oplutils, 1, 2)

int getModInfo(u8 *modname, modinfo_t *info);
int getModInfo(char *modname, modinfo_t *info);
#define I_getModInfo DECLARE_IMPORT(4, getModInfo)

int oplRegisterShutdownCallback(oplShutdownCb_t cb);
Expand Down
10 changes: 5 additions & 5 deletions modules/network/common/httpclient.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
int HttpInit(void);
void HttpDeinit(void);

int HttpEstabConnection(s8 *server, u16 port);
int HttpEstabConnection(char *server, u16 port);
void HttpCloseConnection(s32 HttpSocket);

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

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

#define HTTP_CLIENT_SERVER_NAME_MAX 30
#define HTTP_CLIENT_USER_AGENT_MAX 16
Expand All @@ -41,12 +41,12 @@ struct HttpClientConnCloseArgs
struct HttpClientSendGetArgs
{
s32 socket;
s8 UserAgent[HTTP_CLIENT_USER_AGENT_MAX];
s8 host[HTTP_CLIENT_SERVER_NAME_MAX];
char UserAgent[HTTP_CLIENT_USER_AGENT_MAX];
char host[HTTP_CLIENT_SERVER_NAME_MAX];
s8 mode;
u8 hasMtime;
u8 mtime[6];
s8 uri[HTTP_CLIENT_URI_MAX];
char uri[HTTP_CLIENT_URI_MAX];
u16 out_len;
void *output;
};
Expand Down
6 changes: 3 additions & 3 deletions modules/network/httpclient/httpclient.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ static void HttpParseEntityLine(const char *line)
HeaderLineNumber++;
}

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

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

int HttpSendGetRequest(s32 HttpSocket, const s8 *UserAgent, const s8 *host, s8 *mode, const u8 *mtime, const s8 *uri, u8 *output, u16 *out_len)
int HttpSendGetRequest(s32 HttpSocket, const char *UserAgent, const char *host, s8 *mode, const u8 *mtime, const char *uri, char *output, u16 *out_len)
{
const char *months[] = {
"Jan",
Expand Down
2 changes: 1 addition & 1 deletion modules/network/httpclient/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ static void *SifRpc_handler(int fno, void *buffer, int nbytes)
((struct HttpClientSendGetArgs *)buffer)->out_len = sizeof(DmaBuffer);
}

((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);
((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);
((struct HttpClientSendGetResult *)SifServerTxBuffer)->mode = ((struct HttpClientSendGetArgs *)buffer)->mode;
((struct HttpClientSendGetResult *)SifServerTxBuffer)->out_len = ((struct HttpClientSendGetArgs *)buffer)->out_len;

Expand Down
16 changes: 8 additions & 8 deletions modules/network/smbinit/smbauth.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
/*
* LM_Password_Hash: this function create a LM password hash from a given password
*/
static unsigned char *LM_Password_Hash(const unsigned char *password, unsigned char *cipher)
static unsigned char *LM_Password_Hash(const char *password, unsigned char *cipher)
{
unsigned char tmp_pass[14] = {"\0\0\0\0\0\0\0\0\0\0\0\0\0\0"};
char tmp_pass[14] = {"\0\0\0\0\0\0\0\0\0\0\0\0\0\0"};
unsigned char K1[7];
unsigned char K2[7];
int i;
Expand All @@ -38,18 +38,18 @@ static unsigned char *LM_Password_Hash(const unsigned char *password, unsigned c
memcpy(K2, &tmp_pass[7], 7);

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

return (unsigned char *)cipher;
}

/*
* NTLM_Password_Hash: this function create a NTLM password hash from a given password
*/
static unsigned char *NTLM_Password_Hash(const unsigned char *password, unsigned char *cipher)
static unsigned char *NTLM_Password_Hash(const char *password, unsigned char *cipher)
{
u8 passwd_buf[512];
char passwd_buf[512];
int i, j;

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

/* get the message digest */
MD4(passwd_buf, j, cipher);
MD4((unsigned char *)passwd_buf, j, cipher);

return (unsigned char *)cipher;
}
Expand Down Expand Up @@ -93,7 +93,7 @@ static unsigned char *LM_Response(const unsigned char *LMpasswordhash, unsigned
/*
* GenerateLMHashes: function used to generate LM/NTLM hashes
*/
static void GenerateLMHashes(char *Password, int PasswordType, u8 *EncryptionKey, int *PasswordLen, u8 *Buffer)
static void GenerateLMHashes(char *Password, int PasswordType, u8 *EncryptionKey, int *PasswordLen, char *Buffer)
{
u8 LMpasswordhash[16];
u8 NTLMpasswordhash[16];
Expand Down
6 changes: 3 additions & 3 deletions modules/pademu/ds34bt.c
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@ static void HCI_event_task(int result)
}
DPRINTF("\n");
for (i = 0; i < MAX_PADS; i++) {
if (strncmp(ds34pad[i].bdaddr, hci_buf + 5, 6) == 0) {
if (memcmp(ds34pad[i].bdaddr, hci_buf + 5, 6) == 0) {
// store the handle for the ACL connection
ds34pad[i].hci_handle = hci_buf[3] | ((hci_buf[4] & 0x0F) << 8);
break;
Expand Down Expand Up @@ -603,14 +603,14 @@ static void HCI_event_task(int result)
DPRINTF("\t Status = 0x%02X \n", hci_buf[2]);
if (!hci_buf[2]) {
for (i = 0; i < MAX_PADS; i++) {
if (strncmp(ds34pad[i].bdaddr, hci_buf + 3, 6) == 0) {
if (memcmp(ds34pad[i].bdaddr, hci_buf + 3, 6) == 0) {
break;
}
}
if (i >= MAX_PADS) {
break;
}
if (strncmp(hci_buf + 9, "Wireless Controller", 19) == 0) {
if (memcmp(hci_buf + 9, "Wireless Controller", 19) == 0) {
ds34pad[i].type = DS4;
ds34pad[i].isfake = 0;
DPRINTF("\t Type: Dualshock 4 \n");
Expand Down
Loading

0 comments on commit cdbbe84

Please sign in to comment.