Introduce std::string_view into wider use (#14368)
This commit is contained in:
@@ -223,7 +223,7 @@ void MapDatabasePostgreSQL::initStatements()
|
||||
"SELECT posX, posY, posZ FROM blocks");
|
||||
}
|
||||
|
||||
bool MapDatabasePostgreSQL::saveBlock(const v3s16 &pos, const std::string &data)
|
||||
bool MapDatabasePostgreSQL::saveBlock(const v3s16 &pos, std::string_view data)
|
||||
{
|
||||
// Verify if we don't overflow the platform integer with the mapblock size
|
||||
if (data.size() > INT_MAX) {
|
||||
@@ -240,7 +240,7 @@ bool MapDatabasePostgreSQL::saveBlock(const v3s16 &pos, const std::string &data)
|
||||
y = htonl(pos.Y);
|
||||
z = htonl(pos.Z);
|
||||
|
||||
const void *args[] = { &x, &y, &z, data.c_str() };
|
||||
const void *args[] = { &x, &y, &z, data.data() };
|
||||
const int argLen[] = {
|
||||
sizeof(x), sizeof(y), sizeof(z), (int)data.size()
|
||||
};
|
||||
@@ -940,11 +940,11 @@ bool ModStorageDatabasePostgreSQL::hasModEntry(const std::string &modname,
|
||||
}
|
||||
|
||||
bool ModStorageDatabasePostgreSQL::setModEntry(const std::string &modname,
|
||||
const std::string &key, const std::string &value)
|
||||
const std::string &key, std::string_view value)
|
||||
{
|
||||
verifyDatabase();
|
||||
|
||||
const void *args[] = { modname.c_str(), key.c_str(), value.c_str() };
|
||||
const void *args[] = { modname.c_str(), key.c_str(), value.data() };
|
||||
const int argLen[] = {
|
||||
-1,
|
||||
(int)MYMIN(key.size(), INT_MAX),
|
||||
|
||||
Reference in New Issue
Block a user