mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-17 11:28:25 +00:00
Imported memory_buffer files from inv2 branch
This commit is contained in:
@@ -415,46 +415,3 @@ void find_replace(std::string& string_subject, const std::string& search_string,
|
||||
index = string_subject.find_first_of(search_string);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
|
||||
Copyright (C) 2001-2016 EQEMu Development Team (http://eqemulator.net)
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
are required to give you total support for your newly bought product;
|
||||
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
|
||||
void EQEmu::OutBuffer::overwrite(OutBuffer::pos_type position, const char *_Str, std::streamsize _Count)
|
||||
{
|
||||
auto last_pos = tellp();
|
||||
seekp(position);
|
||||
write(_Str, _Count);
|
||||
seekp(last_pos);
|
||||
}
|
||||
|
||||
uchar* EQEmu::OutBuffer::detach()
|
||||
{
|
||||
size_t buffer_size = tellp();
|
||||
if (buffer_size == 0)
|
||||
return nullptr;
|
||||
|
||||
auto out_buffer = new uchar[buffer_size];
|
||||
memcpy(out_buffer, str().c_str(), buffer_size);
|
||||
flush();
|
||||
|
||||
return out_buffer;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user