summaryrefslogtreecommitdiff
path: root/src/resources
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-04-23 04:04:00 +0300
committerAndrei Karas <akaras@inbox.ru>2016-04-23 04:04:00 +0300
commit45a17142524b79254b0b87a8385ee36cbfac79ce (patch)
tree04865c94ae41a9740dc4a52f693cbd830f4c125d /src/resources
parent7e8f6e26d5e2d1c560092cf72bc4f7f98f7fba07 (diff)
downloadmv-45a17142524b79254b0b87a8385ee36cbfac79ce.tar.gz
mv-45a17142524b79254b0b87a8385ee36cbfac79ce.tar.bz2
mv-45a17142524b79254b0b87a8385ee36cbfac79ce.tar.xz
mv-45a17142524b79254b0b87a8385ee36cbfac79ce.zip
Fix code style.
Diffstat (limited to 'src/resources')
-rw-r--r--src/resources/db/palettedb.cpp17
-rw-r--r--src/resources/dye/dyepalette.cpp2
-rw-r--r--src/resources/memorymanager.cpp6
-rw-r--r--src/resources/memorymanager.h2
-rw-r--r--src/resources/resource.cpp4
5 files changed, 9 insertions, 22 deletions
diff --git a/src/resources/db/palettedb.cpp b/src/resources/db/palettedb.cpp
index 88f90a1fc..4a233d67b 100644
--- a/src/resources/db/palettedb.cpp
+++ b/src/resources/db/palettedb.cpp
@@ -82,18 +82,6 @@ void PaletteDB::loadPalette()
if (line.empty() || line[0] == '#')
continue;
-#ifdef ADVGCC
- unsigned char r;
- unsigned char g;
- unsigned char b;
-
- if (sscanf(line.c_str(), "%10hhu %10hhu %10hhu\t%100s",
- &r, &g, &b, name) == 4)
- {
- name[100] = 0;
- mColors[name] = DyeColor(r, g, b);
- }
-#else
unsigned int r;
unsigned int g;
unsigned int b;
@@ -102,9 +90,10 @@ void PaletteDB::loadPalette()
&r, &g, &b, name) == 4)
{
name[100] = 0;
- mColors[name] = DyeColor(r, g, b);
+ mColors[name] = DyeColor(CAST_U8(r),
+ CAST_U8(g),
+ CAST_U8(b));
}
-#endif
}
}
diff --git a/src/resources/dye/dyepalette.cpp b/src/resources/dye/dyepalette.cpp
index 401eaf7ca..5884554ed 100644
--- a/src/resources/dye/dyepalette.cpp
+++ b/src/resources/dye/dyepalette.cpp
@@ -69,7 +69,7 @@ DyePalette::DyePalette(const std::string &restrict description,
{
if (str.size() != 3)
continue;
- alpha = (hexDecode(str[1]) << 4) + hexDecode(str[2]);
+ alpha = CAST_U8((hexDecode(str[1]) << 4) + hexDecode(str[2]));
continue;
}
const DyeColor *const color = PaletteDB::getColor(str);
diff --git a/src/resources/memorymanager.cpp b/src/resources/memorymanager.cpp
index 546c19c45..758504326 100644
--- a/src/resources/memorymanager.cpp
+++ b/src/resources/memorymanager.cpp
@@ -31,12 +31,12 @@ MemoryManager::MemoryManager()
}
-int MemoryManager::getSurfaceSize(SDL_Surface *const surface)
+int MemoryManager::getSurfaceSize(const SDL_Surface *const surface)
{
if (!surface)
return 0;
- return sizeof(SDL_Surface) +
- sizeof(SDL_PixelFormat) +
+ return CAST_S32(sizeof(SDL_Surface)) +
+ CAST_S32(sizeof(SDL_PixelFormat)) +
// aproximation for sizeof(SDL_BlitMap)
28 +
// pixels
diff --git a/src/resources/memorymanager.h b/src/resources/memorymanager.h
index 8773d849a..88b55e617 100644
--- a/src/resources/memorymanager.h
+++ b/src/resources/memorymanager.h
@@ -35,7 +35,7 @@ class MemoryManager final
~MemoryManager()
{ }
- int getSurfaceSize(SDL_Surface *const surface);
+ int getSurfaceSize(const SDL_Surface *const surface);
void printMemory(const int level,
const int localSum,
diff --git a/src/resources/resource.cpp b/src/resources/resource.cpp
index 40d44a7ec..a16f088a3 100644
--- a/src/resources/resource.cpp
+++ b/src/resources/resource.cpp
@@ -24,8 +24,6 @@
#include "logger.h"
-#include "resources/memorycounter.h"
-#include "resources/memorymanager.h"
#include "resources/resourcemanager.h"
#include "debug.h"
@@ -73,7 +71,7 @@ void Resource::decRef()
int Resource::calcMemoryLocal()
{
- return sizeof(Resource) +
+ return CAST_S32(sizeof(Resource)) +
CAST_S32(mIdPath.size()) +
CAST_S32(mSource.size());
}