Skip to content

Commit

Permalink
Code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
tumic0 committed Dec 10, 2023
1 parent 63d3558 commit 5525ba6
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/map/tileloader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
#include "tileloader.h"

#define SUBSTITUTE_CHAR '$'
#define IS_INT(zoom) \
((QMetaType::Type)((zoom).type()) == QMetaType::Int)

class TileImage
{
Expand All @@ -18,7 +20,8 @@ class TileImage
void load()
{
QImage img;
QByteArray z(_tile->zoom().toString().toLatin1());
QByteArray z(IS_INT(_tile->zoom())
? QByteArray::number(_tile->zoom().toInt()) : QByteArray());
QImageReader reader(_file, z);
if (_scaledSize)
reader.setScaledSize(QSize(_scaledSize, _scaledSize));
Expand Down Expand Up @@ -220,7 +223,7 @@ QUrl TileLoader::tileUrl(const FetchTile &tile) const

QString TileLoader::tileFile(const FetchTile &tile) const
{
QString zoom(((QMetaType::Type)(tile.zoom().type()) == QMetaType::Int)
QString zoom(IS_INT(tile.zoom())
? tile.zoom().toString() : fsSafeStr(tile.zoom().toString()));

return _dir + QLatin1Char('/') + zoom + QLatin1Char('-')
Expand Down

0 comments on commit 5525ba6

Please sign in to comment.