Fix uint64_t -> size-t warnings.

This commit is contained in:
vng 2011-07-03 16:03:11 +03:00 committed by Alex Zolotarev
parent 6caa5f4807
commit 282a7a576a
3 changed files with 20 additions and 20 deletions

View file

@ -220,7 +220,10 @@ private:
};
template <class T, size_t N>
void swap(buffer_vector<T, N> & r1, buffer_vector<T, N> & r2) { r1.swap(r2); }
void swap(buffer_vector<T, N> & r1, buffer_vector<T, N> & r2)
{
r1.swap(r2);
}
template <typename T, size_t N>
inline string debug_print(buffer_vector<T, N> const & v)
@ -234,25 +237,21 @@ inline bool operator==(buffer_vector<T, N1> const & v1, buffer_vector<T, N2> con
return (v1.size() == v2.size() && std::equal(v1.begin(), v1.end(), v2.begin()));
}
template <typename T, size_t N1, size_t N2>
inline bool operator<(buffer_vector<T, N1> const & v1, buffer_vector<T, N2> const & v2)
{
const int N = v1.size() > v2.size() ? v2.size() : v1.size();
for (size_t i = 0; i < N; ++i)
{
if (v1[i] == v2[i])
continue;
return v1[i] < v2[i];
}
if (v1.size() == v2.size())
return false;
if (v1.size() == N)
return true;
return false;
}
template <typename T, size_t N1, size_t N2>
inline bool operator!=(buffer_vector<T, N1> const & v1, buffer_vector<T, N2> const & v2)
{
return !(v1 == v2);
}
template <typename T, size_t N1, size_t N2>
inline bool operator<(buffer_vector<T, N1> const & v1, buffer_vector<T, N2> const & v2)
{
const size_t N = std::min(v1.size(), v2.size());
for (size_t i = 0; i < N; ++i)
{
if (!(v1[i] == v2[i]))
return v1[i] < v2[i];
}
return ((v1.size() != v2.size()) && (v1.size() == N));
}

View file

@ -6,7 +6,7 @@
void Reader::ReadAsString(string & s) const
{
s.clear();
size_t const sz = Size();
size_t const sz = static_cast<size_t>(Size());
s.resize(sz);
Read(0, &s[0], sz);
}

View file

@ -17,7 +17,8 @@ sl::SortedIndex::SortedIndex(Dictionary const & dictionary,
Reader const * pIndexReader,
StrFn const & strFn)
: m_Dictionary(dictionary), m_StrFn(strFn),
m_SortedVector(PolymorphReader(pIndexReader), pIndexReader->Size() / sizeof(DicId))
m_SortedVector( PolymorphReader(pIndexReader),
static_cast<DDVectorType::size_type>(pIndexReader->Size() / sizeof(DicId)))
{
STATIC_ASSERT(sizeof(sl::SortedIndex::DicId) == 3);
}