Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix some warnings, remove rtti requirement #483

Merged
merged 3 commits into from
Aug 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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