mirror of
https://github.com/KingDuckZ/dindexer.git
synced 2025-10-19 17:09:25 +00:00
Don't scatter the casted type throughout the code.
This commit is contained in:
parent
45e5b7bc8d
commit
2b7d8a6783
2 changed files with 6 additions and 3 deletions
|
@ -25,10 +25,13 @@
|
||||||
#include <ciso646>
|
#include <ciso646>
|
||||||
#include <boost/range/adaptor/map.hpp>
|
#include <boost/range/adaptor/map.hpp>
|
||||||
#include <boost/range/algorithm/copy.hpp>
|
#include <boost/range/algorithm/copy.hpp>
|
||||||
|
#include <boost/lexical_cast.hpp>
|
||||||
|
|
||||||
namespace din {
|
namespace din {
|
||||||
namespace {
|
namespace {
|
||||||
IDDescMap fetch_existing_ids (pq::Connection& parConn, const std::vector<uint32_t>& parIDs) {
|
IDDescMap fetch_existing_ids (pq::Connection& parConn, const std::vector<uint32_t>& parIDs) {
|
||||||
|
using boost::lexical_cast;
|
||||||
|
|
||||||
IDDescMap retmap;
|
IDDescMap retmap;
|
||||||
if (parIDs.empty()) {
|
if (parIDs.empty()) {
|
||||||
return std::move(retmap);
|
return std::move(retmap);
|
||||||
|
@ -41,7 +44,7 @@ namespace din {
|
||||||
|
|
||||||
auto resultset = parConn.query(oss.str());
|
auto resultset = parConn.query(oss.str());
|
||||||
for (const auto& record : resultset) {
|
for (const auto& record : resultset) {
|
||||||
retmap[std::stoul(record["id"])] = record["desc"];
|
retmap[lexical_cast<IDDescMap::key_type>(record["id"])] = record["desc"];
|
||||||
}
|
}
|
||||||
return std::move(retmap);
|
return std::move(retmap);
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,8 +57,8 @@ namespace din {
|
||||||
for (const auto& record : result) {
|
for (const auto& record : result) {
|
||||||
retval.push_back(LocatedItem{
|
retval.push_back(LocatedItem{
|
||||||
record["path"],
|
record["path"],
|
||||||
std::stoull(record["id"]),
|
lexical_cast<decltype(LocatedItem::id)>(record["id"]),
|
||||||
lexical_cast<uint32_t>(record["group_id"])
|
lexical_cast<decltype(LocatedItem::group_id)>(record["group_id"])
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue