[win] Fixed some compilation errors. Only OpenGL errors left

This commit is contained in:
Alex Zolotarev 2012-09-06 13:46:06 +03:00 committed by Alex Zolotarev
parent 3aabb33fb2
commit 66afd37cc6
8 changed files with 57 additions and 6 deletions

View file

@ -103,7 +103,9 @@ win32-msvc* {
}
win32-msvc2010 {
DEFINES += _HAS_CPP0X=0 # disable tr1 and c++0x features to avoid build errors
# disable tr1 and c++0x features to avoid build errors
DEFINES += _HAS_CPP0X=0
DEFINES += BOOST_NO_CXX11_HDR_ARRAY BOOST_NO_CXX11_HDR_TYPEINDEX BOOST_NO_CXX11_SMART_PTR
QMAKE_CFLAGS_RELEASE += /GL
QMAKE_CXXFLAGS_RELEASE += /GL
QMAKE_LFLAGS_RELEASE += /LTCG

View file

@ -71,3 +71,8 @@ public:
/// Non-const category is needed to "edit" bookmark (actually, re-add it)
typedef pair<BookmarkCategory *, Bookmark const *> BookmarkAndCategory;
inline BookmarkAndCategory MakeEmptyBookmarkAndCategory()
{
return BookmarkAndCategory(reinterpret_cast<BookmarkAndCategory::first_type>(0),
reinterpret_cast<BookmarkAndCategory::second_type>(0));
}

View file

@ -356,7 +356,7 @@ BookmarkAndCategory Framework::GetBookmark(m2::PointD pt) const
{
// @TODO Refactor. Why bookmarks can't be retrieved? Change pixel point to global point.
if (m_renderPolicy == 0)
return BookmarkAndCategory(0, 0);
return MakeEmptyBookmarkAndCategory();
return GetBookmark(pt, m_renderPolicy->VisualScale());
}

View file

@ -32,7 +32,7 @@ ChunksDownloadStrategy::GetChunk(RangeT const & range)
else
{
LOG(LERROR, ("Downloader error. Invalid chunk range: ", range));
return pair<ChunkT *, int>(0, -1);
return pair<ChunkT *, int>(reinterpret_cast<ChunkT *>(0), -1);
}
}

View file

@ -108,3 +108,9 @@ UNIT_TEST(CpuCores)
TEST_GREATER(coresNum, 0, ());
TEST_LESS_OR_EQUAL(coresNum, 128, ());
}
UNIT_TEST(GetWritableStorageStatus)
{
TEST_EQUAL(Platform::STORAGE_OK, GetPlatform().GetWritableStorageStatus(100000), ());
TEST_EQUAL(Platform::NOT_ENOUGH_SPACE, GetPlatform().GetWritableStorageStatus(0xFFFFFFFFUL), ());
}

View file

@ -1,10 +1,12 @@
#include "platform.hpp"
#include "../base/scope_guard.hpp"
#include "../base/logging.hpp"
#include "../coding/file_writer.hpp"
#include "../std/windows.hpp"
#include "../std/bind.hpp"
#include <shlobj.h>
@ -119,3 +121,34 @@ void Platform::RunAsync(TFunctor const & fn, Priority p)
/// @todo
fn();
}
Platform::TStorageStatus Platform::GetWritableStorageStatus(uint64_t neededSize)
{
ULARGE_INTEGER freeSpace;
if (0 == ::GetDiskFreeSpaceExA(m_writableDir.c_str(), &freeSpace, NULL, NULL))
{
LOG(LWARNING, ("GetDiskFreeSpaceEx failed with error", GetLastError()));
return STORAGE_DISCONNECTED;
}
if (freeSpace.u.LowPart + (freeSpace.u.HighPart << 32) < neededSize)
return NOT_ENOUGH_SPACE;
return STORAGE_OK;
}
bool Platform::GetFileSizeByFullPath(string const & filePath, uint64_t & size)
{
HANDLE hFile = CreateFileA(filePath.c_str(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (hFile != INVALID_HANDLE_VALUE)
{
MY_SCOPE_GUARD(autoClose, bind(&CloseHandle, hFile));
LARGE_INTEGER fileSize;
if (0 != GetFileSizeEx(hFile, &fileSize))
{
size = fileSize.QuadPart;
return true;
}
}
return false;
}

View file

@ -55,7 +55,7 @@ namespace
enum LangIndexT { LANG_CURRENT = 0,
LANG_INPUT,
LANG_INTERNATIONAL,
LANG_ENGLISH,
LANG_EN,
LANG_DEFAULT,
LANG_COUNT };
@ -1165,7 +1165,7 @@ namespace impl
: m_vector(pMwm->m_cont, pMwm->GetHeader()), m_lang(lang),
m_query(q), m_isCancelled(isCancelled)
{
m_arrEn[0] = q.GetLanguage(LANG_ENGLISH);
m_arrEn[0] = q.GetLanguage(LANG_EN);
m_arrEn[1] = q.GetLanguage(LANG_INTERNATIONAL);
m_arrEn[2] = q.GetLanguage(LANG_DEFAULT);
}
@ -1516,7 +1516,7 @@ bool Query::MatchForSuggestionsImpl(strings::UniString const & token, int8_t lan
void Query::MatchForSuggestions(strings::UniString const & token, Results & res)
{
if (!MatchForSuggestionsImpl(token, GetLanguage(LANG_INPUT), res))
MatchForSuggestionsImpl(token, GetLanguage(LANG_ENGLISH), res);
MatchForSuggestionsImpl(token, GetLanguage(LANG_EN), res);
}
m2::RectD const & Query::GetViewport(int viewportID/* = -1*/) const

View file

@ -1,10 +1,15 @@
#pragma once
#include "common_defines.hpp"
#include "target_os.hpp"
#ifdef new
#undef new
#endif
#ifdef OMIM_OS_WINDOWS
#define BOOST_BIND_ENABLE_STDCALL
#endif
#include <boost/bind.hpp>
using boost::bind;
using boost::ref;