Fix a few warnings

I found these looking at ghactions output.
This commit is contained in:
Tamás Bálint Misius 2021-12-09 08:55:45 +01:00
parent c0e3818df3
commit ce84e60074
No known key found for this signature in database
GPG Key ID: 5B472A12F6ECA9F2
6 changed files with 11 additions and 28 deletions

View File

@ -168,7 +168,7 @@ bool Client::DoInstallation()
IShellLinkW *shellLink = NULL;
IPersistFile *shellLinkPersist = NULL;
int returnval;
int returnval = 0;
LONG rresult;
HKEY newkey;
ByteString currentfilename = Platform::ExecutableName();
@ -188,19 +188,16 @@ bool Client::DoInstallation()
//Create protocol entry
rresult = createKey("Software\\Classes\\ptsave", newkey);
if (rresult != ERROR_SUCCESS) {
returnval = 0;
goto finalise;
}
rresult = setValue(newkey, "Powder Toy Save");
if (rresult != ERROR_SUCCESS) {
RegCloseKey(newkey);
returnval = 0;
goto finalise;
}
rresult = RegSetValueExW(newkey, (LPWSTR)L"URL Protocol", 0, REG_SZ, (LPBYTE)L"", 1);
if (rresult != ERROR_SUCCESS) {
RegCloseKey(newkey);
returnval = 0;
goto finalise;
}
RegCloseKey(newkey);
@ -208,13 +205,11 @@ bool Client::DoInstallation()
//Set Protocol DefaultIcon
rresult = createKey("Software\\Classes\\ptsave\\DefaultIcon", newkey);
if (rresult != ERROR_SUCCESS) {
returnval = 0;
goto finalise;
}
rresult = setValue(newkey, iconname);
if (rresult != ERROR_SUCCESS) {
RegCloseKey(newkey);
returnval = 0;
goto finalise;
}
RegCloseKey(newkey);
@ -222,13 +217,11 @@ bool Client::DoInstallation()
//Set Protocol Launch command
rresult = createKey("Software\\Classes\\ptsave\\shell\\open\\command", newkey);
if (rresult != ERROR_SUCCESS) {
returnval = 0;
goto finalise;
}
rresult = setValue(newkey, protocolcommand);
if (rresult != ERROR_SUCCESS) {
RegCloseKey(newkey);
returnval = 0;
goto finalise;
}
RegCloseKey(newkey);
@ -236,26 +229,22 @@ bool Client::DoInstallation()
//Create extension entry
rresult = createKey("Software\\Classes\\.cps", newkey);
if (rresult != ERROR_SUCCESS) {
returnval = 0;
goto finalise;
}
rresult = setValue(newkey, "PowderToySave");
if (rresult != ERROR_SUCCESS) {
RegCloseKey(newkey);
returnval = 0;
goto finalise;
}
RegCloseKey(newkey);
rresult = createKey("Software\\Classes\\.stm", newkey);
if (rresult != ERROR_SUCCESS) {
returnval = 0;
goto finalise;
}
rresult = setValue(newkey, "PowderToySave");
if (rresult != ERROR_SUCCESS) {
RegCloseKey(newkey);
returnval = 0;
goto finalise;
}
RegCloseKey(newkey);
@ -263,13 +252,11 @@ bool Client::DoInstallation()
//Create program entry
rresult = createKey("Software\\Classes\\PowderToySave", newkey);
if (rresult != ERROR_SUCCESS) {
returnval = 0;
goto finalise;
}
rresult = setValue(newkey, "Powder Toy Save");
if (rresult != ERROR_SUCCESS) {
RegCloseKey(newkey);
returnval = 0;
goto finalise;
}
RegCloseKey(newkey);
@ -277,13 +264,11 @@ bool Client::DoInstallation()
//Set DefaultIcon
rresult = createKey("Software\\Classes\\PowderToySave\\DefaultIcon", newkey);
if (rresult != ERROR_SUCCESS) {
returnval = 0;
goto finalise;
}
rresult = setValue(newkey, iconname);
if (rresult != ERROR_SUCCESS) {
RegCloseKey(newkey);
returnval = 0;
goto finalise;
}
RegCloseKey(newkey);
@ -291,13 +276,11 @@ bool Client::DoInstallation()
//Set Launch command
rresult = createKey("Software\\Classes\\PowderToySave\\shell\\open\\command", newkey);
if (rresult != ERROR_SUCCESS) {
returnval = 0;
goto finalise;
}
rresult = setValue(newkey, opencommand);
if (rresult != ERROR_SUCCESS) {
RegCloseKey(newkey);
returnval = 0;
goto finalise;
}
RegCloseKey(newkey);

View File

@ -2253,7 +2253,7 @@ char * GameSave::serialiseOPS(unsigned int & dataLength)
partsData[partsDataLen++] = particles[i].type;
//Location of the field descriptor
int fieldDesc3Loc;
int fieldDesc3Loc = 0;
int fieldDescLoc = partsDataLen++;
partsDataLen++;

View File

@ -26,7 +26,7 @@ namespace ui
std::vector<wrap_record> records;
int word_begins_at = -1; // this is a pointer into records; we're not currently in a word
int word_width;
int word_width = 0;
int lines = 1;
int char_width;
int clear_count = 0;

View File

@ -49,8 +49,8 @@ void Element::Element_GLAS()
static int update(UPDATE_FUNC_ARGS)
{
auto press = sim->pv[y/CELL][x/CELL] * 64;
float diff = press - parts[i].tmp3;
auto press = int(sim->pv[y/CELL][x/CELL] * 64);
auto diff = press - parts[i].tmp3;
if (diff > 16 || diff < -16)
{
sim->part_change_type(i,x,y,PT_BGLA);
@ -61,5 +61,5 @@ static int update(UPDATE_FUNC_ARGS)
static void create(ELEMENT_CREATE_FUNC_ARGS)
{
sim->parts[i].tmp3 = sim->pv[y/CELL][x/CELL] * 64;
sim->parts[i].tmp3 = int(sim->pv[y/CELL][x/CELL] * 64);
}

View File

@ -54,7 +54,7 @@ int Element_QRTZ_update(UPDATE_FUNC_ARGS)
int r, tmp, trade, rx, ry, np, t = parts[i].type;
if (t == PT_QRTZ)
{
auto press = sim->pv[y/CELL][x/CELL] * 64;
auto press = int(sim->pv[y/CELL][x/CELL] * 64);
auto diffTolerance = parts[i].temp * 1.0666f;
if (press - parts[i].tmp3 > diffTolerance || press - parts[i].tmp3 < -diffTolerance)
{
@ -161,5 +161,5 @@ int Element_QRTZ_graphics(GRAPHICS_FUNC_ARGS)
static void create(ELEMENT_CREATE_FUNC_ARGS)
{
sim->parts[i].tmp2 = RNG::Ref().between(0, 10);
sim->parts[i].tmp3 = sim->pv[y/CELL][x/CELL] * 64;
sim->parts[i].tmp3 = int(sim->pv[y/CELL][x/CELL] * 64);
}

View File

@ -95,8 +95,8 @@ static int update(UPDATE_FUNC_ARGS)
parts[i].vy += RNG::Ref().between(-50, 50);
return 1;
}
auto press = sim->pv[y/CELL][x/CELL] * 64;
float diff = press - parts[i].tmp3;
auto press = int(sim->pv[y/CELL][x/CELL] * 64);
auto diff = press - parts[i].tmp3;
if (diff > 32 || diff < -32)
{
sim->part_change_type(i,x,y,PT_BRMT);
@ -132,5 +132,5 @@ static int graphics(GRAPHICS_FUNC_ARGS)
static void create(ELEMENT_CREATE_FUNC_ARGS)
{
sim->parts[i].tmp3 = sim->pv[y/CELL][x/CELL] * 64;
sim->parts[i].tmp3 = int(sim->pv[y/CELL][x/CELL] * 64);
}