Finished the job of splitting Narya into submodules.
The ActionScript code is now under aslib and is built via Maven (and Ant). The CPP code is under cpplib and is ignored by everything (other than service generation), but now at least it's not crufting up the Java submodule with its XCode project. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@6783 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
#include "presents/stable.h"
|
||||
#include "FramingOutputStream.h"
|
||||
|
||||
#include "presents/Util.h"
|
||||
|
||||
using namespace presents;
|
||||
|
||||
FramingOutputStream::FramingOutputStream (OutputStream* base)
|
||||
: _base(base)
|
||||
{}
|
||||
|
||||
// Returns bytes written
|
||||
size_t FramingOutputStream::write(const uint8* pData, size_t bytesToWrite)
|
||||
{
|
||||
uint8* bytes = (uint8*)pData;
|
||||
for (int ii = 0; ii < bytesToWrite; ii++) {
|
||||
_frameBuffer.push_back(bytes[ii]);
|
||||
}
|
||||
return bytesToWrite;
|
||||
}
|
||||
|
||||
|
||||
void FramingOutputStream::writeFrame()
|
||||
{
|
||||
int32 length = hostToPresents((int32)(_frameBuffer.size() + sizeof(int32)));
|
||||
_base->write((uint8*)&length, sizeof(int32));
|
||||
_base->write(&_frameBuffer[0], _frameBuffer.size());
|
||||
|
||||
_frameBuffer.clear();
|
||||
}
|
||||
Reference in New Issue
Block a user