From 604295e6d504f6e41ec2f91500479edbf2838a2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Sun, 11 Feb 2018 01:21:32 +0100 Subject: NOISSUE fix some warnings --- api/logic/minecraft/ComponentUpdateTask.cpp | 3 +++ application/pages/VersionPage.cpp | 3 ++- libraries/classparser/src/annotations.h | 1 + libraries/classparser/src/constants.h | 16 +++++++++------- 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/api/logic/minecraft/ComponentUpdateTask.cpp b/api/logic/minecraft/ComponentUpdateTask.cpp index e03318c5..2d6ceb91 100644 --- a/api/logic/minecraft/ComponentUpdateTask.cpp +++ b/api/logic/minecraft/ComponentUpdateTask.cpp @@ -124,6 +124,8 @@ static LoadResult loadComponent(ComponentPtr component, shared_qobject_ptr return result; } +// FIXME: dead code. determine if this can still be useful? +/* static LoadResult loadComponentList(ComponentPtr component, shared_qobject_ptr& loadTask, Net::Mode netmode) { if(component->m_loaded) @@ -147,6 +149,7 @@ static LoadResult loadComponentList(ComponentPtr component, shared_qobject_ptr& loadTask, Net::Mode netmode) { diff --git a/application/pages/VersionPage.cpp b/application/pages/VersionPage.cpp index b4e20246..00ae0a7e 100644 --- a/application/pages/VersionPage.cpp +++ b/application/pages/VersionPage.cpp @@ -354,7 +354,8 @@ void VersionPage::on_downloadBtn_clicked() } ProgressDialog tDialog(this); connect(updateTask.get(), SIGNAL(failed(QString)), SLOT(onGameUpdateError(QString))); - int ret = tDialog.execWithTask(updateTask.get()); + // FIXME: unused return value + tDialog.execWithTask(updateTask.get()); updateButtons(); m_container->refreshContainer(); } diff --git a/libraries/classparser/src/annotations.h b/libraries/classparser/src/annotations.h index aa25d241..dd603af3 100644 --- a/libraries/classparser/src/annotations.h +++ b/libraries/classparser/src/annotations.h @@ -42,6 +42,7 @@ protected: public: element_value(element_value_type type, constant_pool &pool) : type(type), pool(pool) {}; + virtual ~element_value() {} element_value_type getElementValueType() { diff --git a/libraries/classparser/src/constants.h b/libraries/classparser/src/constants.h index 242b943e..9c74ab20 100644 --- a/libraries/classparser/src/constants.h +++ b/libraries/classparser/src/constants.h @@ -21,14 +21,12 @@ public: j_methodref = 10, j_interface_methodref = 11, j_nameandtype = 12 + // FIXME: missing some constant types, see https://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html#jvms-4.4 } type; constant(util::membuffer &buf) { buf.read(type); - // invalid constant type! - if (type > j_nameandtype || type == (type_t)0 || type == (type_t)2) - throw new classfile_exception(); // load data depending on type switch (type) @@ -65,10 +63,13 @@ public: buf.read_be(name_and_type.name_index); buf.read_be(name_and_type.descriptor_index); break; + default: + // invalid constant type! + throw new classfile_exception(); } } - constant(int fake) + constant(int) { type = j_hole; } @@ -115,6 +116,9 @@ public: ss << "NameAndType: " << name_and_type.name_index << " " << name_and_type.descriptor_index; break; + default: + ss << "Invalid entry (" << int(type) << ")"; + break; } return ss.str(); } @@ -166,10 +170,10 @@ public: */ void load(util::membuffer &buf) { + // FIXME: @SANITY this should check for the end of buffer. uint16_t length = 0; buf.read_be(length); length--; - uint16_t index = 1; const constant *last_constant = nullptr; while (length) { @@ -182,12 +186,10 @@ public: // push in a fake constant to preserve indexing constants.push_back(constant(0)); length -= 2; - index += 2; } else { length--; - index++; } } } -- cgit v1.2.3