QTfrontend/proto.cpp
changeset 4494 9585435e20f7
parent 3236 4ab3917d7d44
child 4897 11598e7aa7e6
--- a/QTfrontend/proto.cpp	Wed Dec 08 22:35:29 2010 +0100
+++ b/QTfrontend/proto.cpp	Thu Dec 09 11:59:07 2010 +0300
@@ -23,14 +23,19 @@
 
 }
 
+QByteArray & HWProto::addByteArrayToBuffer(QByteArray & buf, const QByteArray & msg)
+{
+    QByteArray bmsg = msg;
+    bmsg = bmsg.left(250);
+    quint8 sz = bmsg.size();
+    buf.append(QByteArray((char *)&sz, 1));
+    buf.append(bmsg);
+    return buf;
+}
+
 QByteArray & HWProto::addStringToBuffer(QByteArray & buf, const QString & string)
 {
-    QByteArray strmsg = string.toUtf8();
-    strmsg = strmsg.left(250);
-    quint8 sz = strmsg.size();
-    buf.append(QByteArray((char *)&sz, 1));
-    buf.append(strmsg);
-    return buf;
+    return addByteArrayToBuffer(buf, string.toUtf8());
 }
 
 QByteArray & HWProto::addStringListToBuffer(QByteArray & buf, const QStringList & strList)