summaryrefslogtreecommitdiff
path: root/src/utils
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-10-30 01:19:46 +0300
committerAndrei Karas <akaras@inbox.ru>2012-10-30 13:11:34 +0300
commit6b1684d33dec02eb6308bb3d8d3707f4d5252ba5 (patch)
tree4a0a5fd220828b92ef96446fe38dbe67ff446c6c /src/utils
parent2a70a50c785ce639b76141a3a6887836d22fe12c (diff)
downloadmanaplus-6b1684d33dec02eb6308bb3d8d3707f4d5252ba5.tar.gz
manaplus-6b1684d33dec02eb6308bb3d8d3707f4d5252ba5.tar.bz2
manaplus-6b1684d33dec02eb6308bb3d8d3707f4d5252ba5.tar.xz
manaplus-6b1684d33dec02eb6308bb3d8d3707f4d5252ba5.zip
Add unused warnings to some files.
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/langs.h8
-rw-r--r--src/utils/mathutils.h10
-rw-r--r--src/utils/paths.h14
-rw-r--r--src/utils/physfsrwops.h10
-rw-r--r--src/utils/sha256.h4
-rw-r--r--src/utils/specialfolder.h4
-rw-r--r--src/utils/stringutils.h65
-rw-r--r--src/utils/xml.h17
8 files changed, 77 insertions, 55 deletions
diff --git a/src/utils/langs.h b/src/utils/langs.h
index 5cde62927..38fa2c8e1 100644
--- a/src/utils/langs.h
+++ b/src/utils/langs.h
@@ -27,13 +27,15 @@
#include <set>
#include <vector>
+#include "localconsts.h"
+
typedef std::vector<std::string> LangVect;
typedef LangVect::const_iterator LangIter;
-LangVect getLang();
+LangVect getLang() A_WARN_UNUSED;
-std::string getLangSimple();
+std::string getLangSimple() A_WARN_UNUSED;
-std::string getLangShort();
+std::string getLangShort() A_WARN_UNUSED;
#endif // UTILS_LANGS_H
diff --git a/src/utils/mathutils.h b/src/utils/mathutils.h
index aa6dcecea..1fc55e859 100644
--- a/src/utils/mathutils.h
+++ b/src/utils/mathutils.h
@@ -27,6 +27,8 @@
#include <stdint.h>
#include <cstring>
+#include "localconsts.h"
+
static const uint16_t crc_table[256] =
{
0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50a5, 0x60c6, 0x70e7,
@@ -63,6 +65,14 @@ static const uint16_t crc_table[256] =
0x6e17, 0x7e36, 0x4e55, 0x5e74, 0x2e93, 0x3eb2, 0x0ed1, 0x1ef0
};
+inline uint16_t getCrc16(const std::string &str) A_WARN_UNUSED;
+inline float fastInvSqrt(float x) A_WARN_UNUSED;
+inline float fastSqrt(const float x) A_WARN_UNUSED;
+inline float weightedAverage(const float n1, const float n2,
+ const float w) A_WARN_UNUSED;
+inline int roundDouble(const double v) A_WARN_UNUSED;
+inline int powerOfTwo(const int input) A_WARN_UNUSED;
+
inline uint16_t getCrc16(const std::string &str)
{
size_t f = str.size();
diff --git a/src/utils/paths.h b/src/utils/paths.h
index 05b4fef07..82e7c6a17 100644
--- a/src/utils/paths.h
+++ b/src/utils/paths.h
@@ -23,18 +23,20 @@
#include <string>
-std::string getRealPath(const std::string &str);
+#include "localconsts.h"
-bool isRealPath(const std::string &str);
+std::string getRealPath(const std::string &str) A_WARN_UNUSED;
-bool checkPath(std::string path);
+bool isRealPath(const std::string &str) A_WARN_UNUSED;
+
+bool checkPath(std::string path) A_WARN_UNUSED;
std::string &fixDirSeparators(std::string &str);
-std::string removeLast(std::string str);
+std::string removeLast(std::string str) A_WARN_UNUSED;
-std::string getSelfName();
+std::string getSelfName() A_WARN_UNUSED;
-std::string getDesktopDir();
+std::string getDesktopDir() A_WARN_UNUSED;
#endif // UTILS_PATHS_H
diff --git a/src/utils/physfsrwops.h b/src/utils/physfsrwops.h
index 1f52f40aa..f6d335390 100644
--- a/src/utils/physfsrwops.h
+++ b/src/utils/physfsrwops.h
@@ -28,6 +28,8 @@
#include <physfs.h>
#include <SDL.h>
+#include "localconsts.h"
+
/**
* Open a platform-independent filename for reading, and make it accessible
* via an SDL_RWops structure. The file will be closed in PhysicsFS when the
@@ -38,7 +40,7 @@
* @return A valid SDL_RWops structure on success, NULL on error. Specifics
* of the error can be gleaned from PHYSFS_getLastError().
*/
-SDL_RWops *PHYSFSRWOPS_openRead(const char *fname);
+SDL_RWops *PHYSFSRWOPS_openRead(const char *fname) A_WARN_UNUSED;
/**
* Open a platform-independent filename for writing, and make it accessible
@@ -50,7 +52,7 @@ SDL_RWops *PHYSFSRWOPS_openRead(const char *fname);
* @return A valid SDL_RWops structure on success, NULL on error. Specifics
* of the error can be gleaned from PHYSFS_getLastError().
*/
-SDL_RWops *PHYSFSRWOPS_openWrite(const char *fname);
+SDL_RWops *PHYSFSRWOPS_openWrite(const char *fname) A_WARN_UNUSED;
/**
* Open a platform-independent filename for appending, and make it accessible
@@ -62,7 +64,7 @@ SDL_RWops *PHYSFSRWOPS_openWrite(const char *fname);
* @return A valid SDL_RWops structure on success, NULL on error. Specifics
* of the error can be gleaned from PHYSFS_getLastError().
*/
-SDL_RWops *PHYSFSRWOPS_openAppend(const char *fname);
+SDL_RWops *PHYSFSRWOPS_openAppend(const char *fname) A_WARN_UNUSED;
/**
* Make a SDL_RWops from an existing PhysicsFS file handle. You should
@@ -74,7 +76,7 @@ SDL_RWops *PHYSFSRWOPS_openAppend(const char *fname);
* @return A valid SDL_RWops structure on success, NULL on error. Specifics
* of the error can be gleaned from PHYSFS_getLastError().
*/
-SDL_RWops *PHYSFSRWOPS_makeRWops(PHYSFS_file *handle);
+SDL_RWops *PHYSFSRWOPS_makeRWops(PHYSFS_file *handle) A_WARN_UNUSED;
#endif /* include-once blocker */
diff --git a/src/utils/sha256.h b/src/utils/sha256.h
index 54bb92f3c..a2a852614 100644
--- a/src/utils/sha256.h
+++ b/src/utils/sha256.h
@@ -25,12 +25,14 @@
#include <string>
+#include "localconsts.h"
+
/**
* Returns the SHA-256 hash for the given string.
*
* @param string the string to create the SHA-256 hash for
* @return the SHA-256 hash for the given string.
*/
-std::string sha256(const std::string &string);
+std::string sha256(const std::string &string) A_WARN_UNUSED;
#endif // UTILS_SHA256_H
diff --git a/src/utils/specialfolder.h b/src/utils/specialfolder.h
index 8eb00a637..f8de79ebe 100644
--- a/src/utils/specialfolder.h
+++ b/src/utils/specialfolder.h
@@ -25,7 +25,9 @@
#ifdef WIN32
#include <shlobj.h>
#include <string>
-std::string getSpecialFolderLocation(int folderId);
+
+#include "localconsts.h"
+std::string getSpecialFolderLocation(int folderId) A_WARN_UNUSED;
#endif
#endif
diff --git a/src/utils/stringutils.h b/src/utils/stringutils.h
index 2b10b7631..cef7a9ccf 100644
--- a/src/utils/stringutils.h
+++ b/src/utils/stringutils.h
@@ -62,9 +62,9 @@ std::string &toUpper(std::string &str);
* @param str the hex string to convert to an int
* @return the integer representation of the hex string
*/
-unsigned int atox(const std::string &str);
+unsigned int atox(const std::string &str) A_WARN_UNUSED;
-template<typename T> std::string toString(const T &arg);
+template<typename T> std::string toString(const T &arg) A_WARN_UNUSED;
/**
* Converts the given value to a string using std::stringstream.
@@ -88,12 +88,12 @@ template<typename T> std::string toString(const T &arg)
* @param address the address to convert to a string
* @return the string representation of the address
*/
-const char *ipToString(const int address);
+const char *ipToString(const int address) A_WARN_UNUSED;
/**
* A safe version of sprintf that returns a std::string of the result.
*/
-std::string strprintf(const char *const format, ...)
+std::string strprintf(const char *const format, ...) A_WARN_UNUSED
#ifdef __GNUC__
/* This attribute is nice: it even works through gettext invokation. For
example, gcc will complain that strprintf(_("%s"), 42) is ill-formed. */
@@ -115,7 +115,7 @@ std::string strprintf(const char *const format, ...)
* @param msg the string to remove the colors from
* @return string without colors
*/
-std::string removeColors(std::string msg);
+std::string removeColors(std::string msg) A_WARN_UNUSED;
const std::string findSameSubstring(const std::string &str1,
const std::string &str2);
@@ -131,32 +131,33 @@ const std::string findSameSubstringI(const std::string &str1,
* @return 0 if the strings are equal, positive if the first is greater,
* negative if the second is greater
*/
-int compareStrI(const std::string &a, const std::string &b);
+int compareStrI(const std::string &a, const std::string &b) A_WARN_UNUSED;
/**
* Tells wether the character is a word separator.
*/
-bool isWordSeparator(const signed char chr);
+bool isWordSeparator(const signed char chr) A_WARN_UNUSED;
-size_t findI(std::string str, std::string subStr);
+size_t findI(std::string str, std::string subStr) A_WARN_UNUSED;
-size_t findI(std::string text, StringVect &list);
+size_t findI(std::string text, StringVect &list) A_WARN_UNUSED;
-const std::string encodeStr(unsigned int value, const unsigned int size = 0);
+const std::string encodeStr(unsigned int value,
+ const unsigned int size = 0) A_WARN_UNUSED;
-unsigned int decodeStr(const std::string &str);
+unsigned int decodeStr(const std::string &str) A_WARN_UNUSED;
-std::string extractNameFromSprite(std::string str);
+std::string extractNameFromSprite(std::string str) A_WARN_UNUSED;
-std::string removeSpriteIndex(std::string str);
+std::string removeSpriteIndex(std::string str) A_WARN_UNUSED;
-const char* getSafeUtf8String(std::string text);
+const char* getSafeUtf8String(std::string text) A_WARN_UNUSED;
void getSafeUtf8String(std::string text, char *const buf);
-std::string getFileName(std::string path);
+std::string getFileName(std::string path) A_WARN_UNUSED;
-std::string getFileDir(std::string path);
+std::string getFileDir(std::string path) A_WARN_UNUSED;
std::string& replaceAll(std::string& context, const std::string& from,
const std::string& to);
@@ -167,23 +168,23 @@ std::string& replaceAll(std::string& context, const std::string& from,
* @param text the string used to get the bool value
* @return a boolean value..
*/
-bool getBoolFromString(const std::string &text);
+bool getBoolFromString(const std::string &text) A_WARN_UNUSED;
void replaceSpecialChars(std::string &text);
/**
* Normalize a string, which means lowercase and trim it.
*/
-std::string normalize(const std::string &name);
+std::string normalize(const std::string &name) A_WARN_UNUSED;
std::set<int> splitToIntSet(const std::string &text,
- const char separator);
+ const char separator) A_WARN_UNUSED;
std::list<int> splitToIntList(const std::string &text,
- const char separator);
+ const char separator) A_WARN_UNUSED;
std::list<std::string> splitToStringList(const std::string &text,
- const char separator);
+ const char separator) A_WARN_UNUSED;
void splitToStringVector(StringVect &tokens,
const std::string &text, const char separator);
@@ -194,30 +195,30 @@ void splitToStringSet(std::set<std::string> &tokens,
void splitToIntVector(std::vector<int> &tokens,
const std::string &text, const char separator);
-std::string combineDye(std::string file, std::string dye);
+std::string combineDye(std::string file, std::string dye) A_WARN_UNUSED;
-std::string combineDye2(std::string file, std::string dye);
+std::string combineDye2(std::string file, std::string dye) A_WARN_UNUSED;
-std::string packList(std::list<std::string> &list);
+std::string packList(std::list<std::string> &list) A_WARN_UNUSED;
-std::list<std::string> unpackList(const std::string &str);
+std::list<std::string> unpackList(const std::string &str) A_WARN_UNUSED;
-std::string stringToHexPath(const std::string &str);
+std::string stringToHexPath(const std::string &str) A_WARN_UNUSED;
void deleteCharLeft(std::string &str, unsigned *const pos);
-bool findLast(const std::string &str1, const std::string &str2);
+bool findLast(const std::string &str1, const std::string &str2) A_WARN_UNUSED;
-bool findFirst(const std::string &str1, const std::string &str2);
+bool findFirst(const std::string &str1, const std::string &str2) A_WARN_UNUSED;
-bool findCutLast(std::string &str1, std::string str2);
+bool findCutLast(std::string &str1, std::string str2) A_WARN_UNUSED;
-bool findCutFirst(std::string &str1, std::string str2);
+bool findCutFirst(std::string &str1, std::string str2) A_WARN_UNUSED;
std::string &removeProtocol(std::string &url);
-bool strStartWith(std::string str, std::string start);
+bool strStartWith(std::string str, std::string start) A_WARN_UNUSED;
-std::string getDateString();
+std::string getDateString() A_WARN_UNUSED;
#endif // UTILS_STRINGUTILS_H
diff --git a/src/utils/xml.h b/src/utils/xml.h
index cba9e0a0e..ee010dde0 100644
--- a/src/utils/xml.h
+++ b/src/utils/xml.h
@@ -87,7 +87,7 @@ namespace XML
* Returns the root node of the document (or NULL if there was a
* load error).
*/
- XmlNodePtr rootNode();
+ XmlNodePtr rootNode() A_WARN_UNUSED;
private:
xmlDocPtr mDoc;
@@ -97,42 +97,43 @@ namespace XML
* Gets an floating point property from an XmlNodePtr.
*/
double getFloatProperty(const XmlNodePtr node, const char *const name,
- double def);
+ double def) A_WARN_UNUSED;
/**
* Gets an integer property from an XmlNodePtr.
*/
- int getProperty(const XmlNodePtr node, const char *const name, int def);
+ int getProperty(const XmlNodePtr node, const char *const name,
+ int def) A_WARN_UNUSED;
/**
* Gets an integer property from an XmlNodePtr.
*/
int getIntProperty(const XmlNodePtr node, const char *const name, int def,
- const int min, const int max);
+ const int min, const int max) A_WARN_UNUSED;
/**
* Gets a string property from an XmlNodePtr.
*/
std::string getProperty(const XmlNodePtr node, const char *const name,
- const std::string &def);
+ const std::string &def) A_WARN_UNUSED;
/**
* Gets a translated string property from an XmlNodePtr.
*/
std::string langProperty(const XmlNodePtr node, const char *const name,
- const std::string &def);
+ const std::string &def) A_WARN_UNUSED;
/**
* Gets a boolean property from an XmlNodePtr.
*/
bool getBoolProperty(const XmlNodePtr node, const char *const name,
- const bool def);
+ const bool def) A_WARN_UNUSED;
/**
* Finds the first child node with the given name
*/
XmlNodePtr findFirstChildByName(const XmlNodePtr parent,
- const char *const name);
+ const char *const name) A_WARN_UNUSED;
void initXML();