mirror of
https://github.com/isledecomp/isle-portable.git
synced 2024-11-22 15:37:55 -05:00
use sizeof in more places where appropriate
This commit is contained in:
parent
6e18d1b41f
commit
4a41d3fd36
1 changed files with 9 additions and 11 deletions
|
@ -134,7 +134,7 @@ int readRegBool(LPCSTR name, BOOL *out)
|
||||||
{
|
{
|
||||||
char buffer[256];
|
char buffer[256];
|
||||||
|
|
||||||
BOOL read = readReg(name, buffer, 0x100);
|
BOOL read = readReg(name, buffer, sizeof(buffer));
|
||||||
if (read) {
|
if (read) {
|
||||||
if (strcmp("YES", buffer) == 0) {
|
if (strcmp("YES", buffer) == 0) {
|
||||||
*out = TRUE;
|
*out = TRUE;
|
||||||
|
@ -154,7 +154,7 @@ int readRegInt(LPCSTR name, int *out)
|
||||||
{
|
{
|
||||||
char buffer[256];
|
char buffer[256];
|
||||||
|
|
||||||
if (readReg(name, buffer, 0x100)) {
|
if (readReg(name, buffer, sizeof(buffer))) {
|
||||||
*out = atoi(buffer);
|
*out = atoi(buffer);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -165,11 +165,9 @@ int readRegInt(LPCSTR name, int *out)
|
||||||
// OFFSET: ISLE 0x4028d0
|
// OFFSET: ISLE 0x4028d0
|
||||||
void Isle::loadConfig()
|
void Isle::loadConfig()
|
||||||
{
|
{
|
||||||
#define BUFFER_SIZE 1024
|
char buffer[1024];
|
||||||
|
|
||||||
char buffer[BUFFER_SIZE];
|
if (!readReg("diskpath", buffer, sizeof(buffer))) {
|
||||||
|
|
||||||
if (!readReg("diskpath", buffer, BUFFER_SIZE)) {
|
|
||||||
strcpy(buffer, MxOmni::GetHD());
|
strcpy(buffer, MxOmni::GetHD());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -177,7 +175,7 @@ void Isle::loadConfig()
|
||||||
strcpy(m_hdPath, buffer);
|
strcpy(m_hdPath, buffer);
|
||||||
MxOmni::SetHD(m_hdPath);
|
MxOmni::SetHD(m_hdPath);
|
||||||
|
|
||||||
if (!readReg("cdpath", buffer, BUFFER_SIZE)) {
|
if (!readReg("cdpath", buffer, sizeof(buffer))) {
|
||||||
strcpy(buffer, MxOmni::GetCD());
|
strcpy(buffer, MxOmni::GetCD());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -208,22 +206,22 @@ void Isle::loadConfig()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!readReg("Island Quality", buffer, BUFFER_SIZE)) {
|
if (!readReg("Island Quality", buffer, sizeof(buffer))) {
|
||||||
strcpy(buffer, "1");
|
strcpy(buffer, "1");
|
||||||
}
|
}
|
||||||
m_islandQuality = atoi(buffer);
|
m_islandQuality = atoi(buffer);
|
||||||
|
|
||||||
if (!readReg("Island Texture", buffer, BUFFER_SIZE)) {
|
if (!readReg("Island Texture", buffer, sizeof(buffer))) {
|
||||||
strcpy(buffer, "1");
|
strcpy(buffer, "1");
|
||||||
}
|
}
|
||||||
m_islandTexture = atoi(buffer);
|
m_islandTexture = atoi(buffer);
|
||||||
|
|
||||||
if (readReg("3D Device ID", buffer, BUFFER_SIZE)) {
|
if (readReg("3D Device ID", buffer, sizeof(buffer))) {
|
||||||
m_deviceId = new char[strlen(buffer) + 1];
|
m_deviceId = new char[strlen(buffer) + 1];
|
||||||
strcpy(m_deviceId, buffer);
|
strcpy(m_deviceId, buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (readReg("savepath", buffer, BUFFER_SIZE)) {
|
if (readReg("savepath", buffer, sizeof(buffer))) {
|
||||||
m_savePath = new char[strlen(buffer) + 1];
|
m_savePath = new char[strlen(buffer) + 1];
|
||||||
strcpy(m_savePath, buffer);
|
strcpy(m_savePath, buffer);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue