mirror of
https://github.com/luanti-org/luanti.git
synced 2025-07-02 16:38:41 +00:00
Introduce std::string_view
into wider use (#14368)
This commit is contained in:
parent
fa47af737f
commit
6ca214fefc
74 changed files with 501 additions and 456 deletions
|
@ -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),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue