QTfrontend/proto.cpp
changeset 4494 9585435e20f7
parent 3236 4ab3917d7d44
child 4897 11598e7aa7e6
equal deleted inserted replaced
4493:45db8e97d282 4494:9585435e20f7
    21 HWProto::HWProto()
    21 HWProto::HWProto()
    22 {
    22 {
    23 
    23 
    24 }
    24 }
    25 
    25 
       
    26 QByteArray & HWProto::addByteArrayToBuffer(QByteArray & buf, const QByteArray & msg)
       
    27 {
       
    28     QByteArray bmsg = msg;
       
    29     bmsg = bmsg.left(250);
       
    30     quint8 sz = bmsg.size();
       
    31     buf.append(QByteArray((char *)&sz, 1));
       
    32     buf.append(bmsg);
       
    33     return buf;
       
    34 }
       
    35 
    26 QByteArray & HWProto::addStringToBuffer(QByteArray & buf, const QString & string)
    36 QByteArray & HWProto::addStringToBuffer(QByteArray & buf, const QString & string)
    27 {
    37 {
    28     QByteArray strmsg = string.toUtf8();
    38     return addByteArrayToBuffer(buf, string.toUtf8());
    29     strmsg = strmsg.left(250);
       
    30     quint8 sz = strmsg.size();
       
    31     buf.append(QByteArray((char *)&sz, 1));
       
    32     buf.append(strmsg);
       
    33     return buf;
       
    34 }
    39 }
    35 
    40 
    36 QByteArray & HWProto::addStringListToBuffer(QByteArray & buf, const QStringList & strList)
    41 QByteArray & HWProto::addStringListToBuffer(QByteArray & buf, const QStringList & strList)
    37 {
    42 {
    38     for (int i = 0; i < strList.size(); i++)
    43     for (int i = 0; i < strList.size(); i++)