Skip to content

Commit

Permalink
Merge pull request #483 from Ghabry/fixes
Browse files Browse the repository at this point in the history
Fix some warnings, remove rtti requirement
  • Loading branch information
fdelapena authored Aug 30, 2024
2 parents 552c1bc + daaf2d6 commit 4483cb4
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/dbstring_struct.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class DbStringXmlHandler : public XmlHandler {
public:
DbStringXmlHandler(DBString& ref) :
ref(ref) {}
void StartElement(XmlReader& stream, const char* name, const char** /* atts */) {
void StartElement(XmlReader& /* stream */, const char* /* name */, const char** /* atts */) {
// no-op
}
void EndElement(XmlReader& /* stream */, const char* /* name */) {
Expand Down
2 changes: 1 addition & 1 deletion src/ldb_equipment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class EquipmentXmlHandler : public XmlHandler {
int16_t* field;
public:
EquipmentXmlHandler(rpg::Equipment& ref) : ref(ref), field(NULL) {}
void StartElement(XmlReader& stream, const char* name, const char** /* atts */) {
void StartElement(XmlReader& /* stream */, const char* name, const char** /* atts */) {
if (strcmp(name, "weapon_id") == 0)
field = &ref.weapon_id;
else if (strcmp(name, "shield_id") == 0)
Expand Down
2 changes: 1 addition & 1 deletion src/ldb_eventcommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class EventCommandXmlHandler : public XmlHandler {
} field;
public:
EventCommandXmlHandler(rpg::EventCommand& ref) : ref(ref), field(None) {}
void StartElement(XmlReader& stream, const char* name, const char** /* atts */) {
void StartElement(XmlReader& /* stream */, const char* name, const char** /* atts */) {
if (strcmp(name, "code") == 0)
field = Code;
else if (strcmp(name, "indent") == 0)
Expand Down
2 changes: 1 addition & 1 deletion src/ldb_parameters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class ParametersXmlHandler : public XmlHandler {
std::vector<int16_t>* field;
public:
ParametersXmlHandler(rpg::Parameters& ref) : ref(ref), field(NULL) {}
void StartElement(XmlReader& stream, const char* name, const char** /* atts */) {
void StartElement(XmlReader& /* stream */, const char* name, const char** /* atts */) {
if (strcmp(name, "maxhp") == 0)
field = &ref.maxhp;
else if (strcmp(name, "maxsp") == 0)
Expand Down
2 changes: 1 addition & 1 deletion src/lmt_rect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class RectXmlHandler : public XmlHandler {
uint32_t* field;
public:
RectXmlHandler(rpg::Rect& ref) : ref(ref), field(NULL) {}
void StartElement(XmlReader& stream, const char* name, const char** /* atts */) {
void StartElement(XmlReader& /* stream */, const char* name, const char** /* atts */) {
if (strcmp(name, "l") == 0)
field = &ref.l;
else if (strcmp(name, "t") == 0)
Expand Down
2 changes: 1 addition & 1 deletion src/lmu_movecommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ class MoveCommandXmlHandler : public XmlHandler {
public:
MoveCommandXmlHandler(rpg::MoveCommand& ref) :
ref(ref), field(NULL), parameter_string(false) {}
void StartElement(XmlReader& stream, const char* name, const char** /* atts */) {
void StartElement(XmlReader& /* stream */, const char* name, const char** /* atts */) {
if (strcmp(name, "command_id") == 0)
field = &ref.command_id;
else if (strcmp(name, "parameter_a") == 0)
Expand Down
2 changes: 1 addition & 1 deletion src/reader_flags.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ class FlagsXmlHandler : public XmlHandler {
FlagsXmlHandler(S& obj) : obj(obj), field(NULL) {
}

void StartElement(XmlReader& stream, const char* name, const char** /* atts */) {
void StartElement(XmlReader& /* stream */, const char* name, const char** /* atts */) {
const auto idx = Flags<S>::idx(name);
if (idx < 0) {
Log::Error("XML: Unrecognized field '%s'", name);
Expand Down
8 changes: 6 additions & 2 deletions src/reader_struct.h
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ struct Primitive {

if (dif != 0) {
// Fix incorrect read pointer position
Log::Warning("Invalid %s at %" PRIX32 "", typeid(T).name(), stream.Tell());
Log::Warning("Invalid Primitive at %" PRIX32 "", stream.Tell());
stream.Seek(dif, LcfReader::FromCurrent);
}
}
Expand Down Expand Up @@ -267,13 +267,17 @@ struct Primitive<int32_t> {
ref = stream.ReadInt();
#ifdef LCF_DEBUG_TRACE
fprintf(stderr, " %d\n", ref);
#endif
} else if (length == 0) {
ref = 0;
#ifdef LCF_DEBUG_TRACE
fprintf(stderr, " %d\n", ref);
#endif
} else {
ref = 0;
Log::Warning("Invalid integer at %X", stream.Tell());
stream.Seek(length, LcfReader::FromCurrent);
}

}
static void WriteLcf(const int32_t& ref, LcfWriter& stream) {
stream.WriteInt(ref);
Expand Down

0 comments on commit 4483cb4

Please sign in to comment.