size_t writeString(WriteStream &stream, const Common::UString &str, Encoding encoding, bool terminate) { ScopedPtr<MemoryReadStream> data(convertString(str, encoding, terminate)); const size_t n = stream.writeStream(*data); return n; }
void writeStringFixed(WriteStream &stream, const Common::UString &str, Encoding encoding, size_t length) { if (length == 0) return; ScopedPtr<MemoryReadStream> data(convertString(str, encoding, false)); size_t n = stream.writeStream(*data, length); while (n++ < length) stream.writeByte(0); }
void writeStringFixed(WriteStream &stream, const Common::UString &str, Encoding encoding, size_t length) { MemoryReadStream *data = 0; try { data = convertString(str, encoding, false); size_t n = stream.writeStream(*data, length); while (n++ < length) stream.writeByte(0); } catch (...) { delete data; throw; } delete data; }
size_t writeString(WriteStream &stream, const Common::UString &str, Encoding encoding, bool terminate) { size_t n = 0; MemoryReadStream *data = 0; try { data = convertString(str, encoding, terminate); n = stream.writeStream(*data); } catch (...) { delete data; throw; } delete data; return n; }