void writeVector(QDataStream& out, char ch, QVector<T> vec) { // Minimum number of bytes to consider compressing const int ATTEMPT_COMPRESSION_THRESHOLD_BYTES = 2000; out.device()->write(&ch, 1); out << (int32_t)vec.length(); auto data { QByteArray::fromRawData((const char*)vec.constData(), vec.length() * sizeof(T)) }; if (data.size() >= ATTEMPT_COMPRESSION_THRESHOLD_BYTES) { auto compressedDataWithLength { qCompress(data) }; // qCompress packs a length uint32 at the beginning of the buffer, but the FBX format // does not expect it. This removes it. auto compressedData = QByteArray::fromRawData( compressedDataWithLength.constData() + sizeof(uint32_t), compressedDataWithLength.size() - sizeof(uint32_t)); if (compressedData.size() < data.size()) { out << FBX_PROPERTY_COMPRESSED_FLAG; out << (int32_t)compressedData.size(); out.writeRawData(compressedData.constData(), compressedData.size()); return; } } out << FBX_PROPERTY_UNCOMPRESSED_FLAG; out << (int32_t)0; out.writeRawData(data.constData(), data.size()); }
void Frame::write(QDataStream &stream) { QByteArray lenbuf; if (!encodeLength(lenbuf, _data.size())) { qCritical("qmqtt: Control packet bigger than 256 MB, dropped!"); return; } stream << (quint8)_header; if(_data.size() == 0) { stream << (quint8)0; return; } if (stream.writeRawData(lenbuf.data(), lenbuf.size()) != lenbuf.size()) { qCritical("qmqtt: Control packet write error!"); return; } if (stream.writeRawData(_data.data(), _data.size()) != _data.size()) { qCritical("qmqtt: Control packet write error!"); } }
bool IconCacheCreator::writeIconToCache(QDataStream &out, const QFileInfo &fileInfo) { QFile in(fileInfo.absoluteFilePath()); if (!in.open(QIODevice::ReadOnly)) { return false; } char buf[4096]; QDataStream inStream(&in); qint64 size = in.size(); out.writeRawData((const char *)&size, sizeof(qint64)); while (!inStream.atEnd()) { out.writeRawData(buf, inStream.readRawData(buf, 4096)); } in.close(); //QPixmap pixmap(f.absoluteFilePath()); //out << pixmap; //out << null; //QIcon iconFile(f.absoluteFilePath()); //out << iconFile; //out << null; //DPRINT("cache icon: %s", qPrintable(f.absoluteFilePath())); return true; }
/** Erases loaded data from memory */ PwHeaderV3::ErrorCode PwHeaderV3::write(QDataStream& outStream) { outStream << SIGNATURE_1 << SIGNATURE_2 << flags << DB_VERSION; outStream.writeRawData(masterSeed.constData(), masterSeed.size()); outStream.writeRawData(initialVector.constData(), initialVector.size()); outStream << groupCount << entryCount; outStream.writeRawData(contentHash.constData(), contentHash.size()); outStream.writeRawData(transformSeed.constData(), transformSeed.size()); outStream << transformRounds; return SUCCESS; }
void Frame::write(QDataStream &stream) { QByteArray lenbuf; stream << (quint8)_header; if(_data.size() == 0) { stream << (quint8)0; return; } encodeLength(lenbuf, _data.size()); stream.writeRawData(lenbuf.data(), lenbuf.size()); stream.writeRawData(_data.data(), _data.size()); }
bool copyFileToStream(const QString& source, QDataStream& target) { bool copySucceed = true; int bytesread, byteswrite; if (source.isEmpty()) return false; if (!QFile::exists(source)) return false; if (!target.device()->isOpen() || !target.device()->isWritable()) return false; QFile s(source); QByteArray bb( 65536, ' ' ); if (bb.size() <= 0) // Check for memory allocation failure return false; if (s.open(QIODevice::ReadOnly)) { bytesread = s.read( bb.data(), bb.size() ); while (bytesread > 0) { byteswrite = target.writeRawData(bb.data(), bytesread); copySucceed &= (byteswrite == bytesread); bytesread = s.read( bb.data(), bb.size() ); } copySucceed &= (s.error() == QFile::NoError); s.close(); } return copySucceed; }
template<typename T> void storeBulk(const RawConverter& converter, QDataStream& stream, StreamConnector *streamconnector, const BoundingBox& box, const IRasterCoverage& raster){ quint64 count = streamconnector->position(); if ( streamconnector->isFileBased()){ const UPGrid& grid = raster->grid(); quint32 blockCount = grid->blocks(); stream << blockCount; for(quint32 i = 0; i < blockCount; ++i){ const char * data = grid->blockAsMemory(i, false); quint64 blockSize = 8 * grid->blockSize(i); stream << i; stream << blockSize; stream.writeRawData(data, blockSize); } streamconnector->flush(true); }else { PixelIterator iter(raster, box); while(iter != iter.end()){ if ( count >= STREAMBLOCKSIZE - 9 ) { streamconnector->flush(false); count = 0; } count += sizeof(T); stream << (T)converter.real2raw(*iter); ++iter; } } }
void MaskChan::writeMaskList(QDataStream& dataOut, QList<MaskRay*>& list) { for (int i=0;i<list.size();i++) { dataOut.writeRawData( (const char *)&(list[i]->skipCount), sizeof(long)); long pairListSize=list[i]->endList.size(); dataOut.writeRawData( (const char *)&pairListSize, sizeof(long)); //qDebug() << "skip=" << list[i]->skipCount << " pairs=" << pairListSize; for(int j=0;j<list[i]->endList.size();j++) { long start=list[i]->startList[j]; dataOut.writeRawData( (const char *)&start, sizeof(long)); long end=list[i]->endList[j]; dataOut.writeRawData( (const char *)&end, sizeof(long)); //qDebug() << "start=" << start << " end=" << end; } } }
ContestantConnection::ContestantConnection ( ServerNetwork* sn, QTcpSocket* socket ) : QObject ( sn ) { m_snet = sn; m_answer_capable = true; m_hdr = NULL; m_authenticated = false; m_socket = socket; connect ( m_socket, SIGNAL ( error ( QAbstractSocket::SocketError ) ), this, SLOT ( error ( QAbstractSocket::SocketError ) ) ); connect ( m_socket, SIGNAL ( readyRead() ), this, SLOT ( ready() ) ); connect ( m_socket, SIGNAL ( disconnected() ), this, SLOT ( disconnected() ) ); // reply to client of the now established connection QByteArray block; QDataStream out ( &block, QIODevice::WriteOnly ); out.setVersion ( QDataStream::Qt_4_5 ); // construct the header p_header hdr; hdr.length = sizeof ( ushort ); hdr.command = NET_CONNECTION_RESULT; out.writeRawData ( ( const char* ) &hdr, sizeof ( p_header ) ); out << ( ushort ) true; m_socket->write ( block ); m_socket->flush(); m_qnum = m_snet->getQNumber(); m_qtime = m_snet->getQTime(); m_qstatus = m_snet->getQStatus(); }
QByteArray IQSMPPOptionalParameter<QString>::encode() const { QByteArray result; //Если не устанавливали значения для данной опции, то вернем пустой массив, т.к. данная опция //не используется if (!_valueSets) return result; if (tag() == IQSMPP::UndefinedOptionalParameter) return result; if (maxLength() == 0) return result; QDataStream stream (&result, QIODevice::WriteOnly); stream << (quint16) tag(); stream << (quint16) 0; //Запишим данные //Если это строка QByteArray stringBA = _value.toLatin1(); const char * stringShar = stringBA.constData(); int stringLength = stringBA.length(); stream.writeRawData(stringShar, stringLength); if (_cOctetString) stream << (quint8)0x00; //Сохраним размер stream.device()->seek(2); stream << (quint16) result.size() - 4; return result; }
// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- int AvizoUniformCoordinateWriter::writeData(QDataStream& out) { QString start("@1\n"); out << start; if(true == m_WriteBinaryFile) { out.writeRawData(reinterpret_cast<char*>(m_FeatureIds), m_FeatureIdsPtr.lock()->getNumberOfTuples() * sizeof(int32_t)); } else { // The "20 Items" is purely arbitrary and is put in to try and save some space in the ASCII file int64_t totalPoints = m_FeatureIdsPtr.lock()->getNumberOfTuples(); int count = 0; for (int64_t i = 0; i < totalPoints; ++i) { out << m_FeatureIds[i]; if(count < 20) { out << " "; count++; } else { out << "\n"; count = 0; } } // Pick up any remaining data that was not written because we did not have 20 items on a line. out << "\n"; } return 1; }
bool IconCacheCreator::writeCatesToCache(QDataStream &out, const QList<QString> &cates) { for (int i = 0; i < cates.size(); i++) { //out << qPrintable(cates.at(i)); out.writeRawData(qPrintable(cates.at(i)), cates.at(i).size() + 1); } return true; }
void ClientMessage::serializeString(const QString &string, QDataStream &stream){ //serializeByteArray(QByteArray(str.toStdString().c_str()), stream); //serializeByteArray(str.toUtf8(), stream); QByteArray dataArray = string.toUtf8(); stream.writeRawData(dataArray.data(), dataArray.size()); stream << quint8('\0'); // NUL TERMINATED }
bool IconCacheCreator::writeSizeToCache(QDataStream &out, const QList<int> &sizes) { for (int i = 0; i < sizes.size(); i++) { //out << sizes.at(i); DPRINT("size: %d", out.device()->size()); out.writeRawData((const char *)&(sizes.at(i)), sizeof(int)); DPRINT("size: %d", out.device()->size()); } return true; }
void QVRVNCViewer::serializeDynamicData(QDataStream& ds) const { ds << _vncWidth << _vncHeight; ds << _vncDirtyRectangles; for (int i = 0; i < _vncDirtyRectangles.size(); i++) { QRect r = _vncDirtyRectangles[i]; for (int y = r.y(); y < r.y() + r.height(); y++) { ds.writeRawData(reinterpret_cast<const char *>(&_vncFrame[y * _vncWidth]), r.width() * sizeof(unsigned int)); } } }
/** Save a QByteArray to a stream with only one leading byte instead of 4. */ void ShortSave (QDataStream &s, const QByteArray &str ) { if( str.size() > 255 ) { qWarning( "ShortSave will truncate QByteArray to 255 characters!" ); } quint8 len; len = qMin(str.size(), 255); s << len; s.writeRawData( str.data(), len ); }
bool IconCacheCreator::writeHashToCache(QDataStream &out, const QHash<QString, qint64> &hash, qint64 *ret) { QList<QString> keys = hash.keys(); struct HashData *data = new HashData[keys.size()]; DPRINT("keys size: %d", keys.size()); for (int i = 0; i < keys.size(); i++) { data[i].key = out.device()->pos(); out.writeRawData(qPrintable(keys.at(i)), keys.at(i).size() + 1); data[i].value = hash.value(keys.at(i), -1); DPRINT("value: %d", data[i].value); } *ret = out.device()->pos(); for (int i = 0; i < keys.size(); i++) { DPRINT("hash value: %lld, %lld - %d", data[i].key, data[i].value, i); out.writeRawData((const char *)&(data[i].key), sizeof(qint64)); out.writeRawData((const char *)&(data[i].value), sizeof(qint64)); } delete[] data; return true; }
bool CNetMsgBaseBuffered::WriteString(QString& str, QDataStream& out) { if (str.isEmpty()) { out << (quint16)0; return true; } QByteArray utf8 = str.toUtf8(); utf8.append((char)0);//null terminated string quint16 nSize = utf8.size(); out << nSize; out.writeRawData(utf8.constData(), utf8.size()); return true; }
//read stream data from socket。Becuase of the nature of socket,the function will run sevral times to finish reading //stream is often large-scale,so it must be processed while reading,otherwise the memory will run out bool receiveStreamData(QDataStream &out,QTcpSocket& tcpSocket,long long &streamLength,unsigned short &blockLength){ if(streamLength==0){ //don't know the size of stream,the ending-if is "shorter frame + FRAMELENGTH" if(blockLength==0){ if(tcpSocket.bytesAvailable()<2) return false; tcpSocket.read((char*)&blockLength,sizeof(unsigned short)); } while(true){ if(tcpSocket.bytesAvailable()<blockLength+2) return false; if(blockLength!=0){ QByteArray dat= tcpSocket.read(blockLength); out.writeRawData(dat.data(),dat.length()); } unsigned short tmpLen; tcpSocket.read((char*)&tmpLen,sizeof(unsigned short)); if(blockLength!=STREAMBLOCKSIZE && tmpLen==STREAMBLOCKSIZE) return true; blockLength=tmpLen; } } if(streamLength>0){ if(tcpSocket.bytesAvailable()>=streamLength){ QByteArray dat= tcpSocket.read(streamLength); out.writeRawData(dat.data(),dat.length()); streamLength=0; return true; } qint64 remain=tcpSocket.bytesAvailable(); QByteArray dat= tcpSocket.read(remain); out.writeRawData(dat.data(),dat.length()); streamLength -=remain; return false; } return false; }
void jo_write_tga(QDataStream &stream, const QImage &image, bool transparency) { // Convert QImage to rgb(a) int width = image.width(); int height = image.height(); int numChannels = transparency ? 4 : 3; unsigned char *rgba = (unsigned char *)malloc(width * height * numChannels); for(int y = 0; y < height; y++) { for(int x = 0; x < width; x++) { unsigned offset = numChannels * (y * width + x); QRgb pixel = image.pixel(x, y); rgba[offset] = qRed(pixel); rgba[offset+1] = qGreen(pixel); rgba[offset+2] = qBlue(pixel); if(transparency) rgba[offset+3] = qAlpha(pixel); } } // Header stream.writeRawData("\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00", 12); stream.writeRawData((const char*)(&width), 2); stream.writeRawData((const char*)(&height), 2); int bpc = numChannels * 8; // 8 bits per channel stream.writeRawData((const char*)(&bpc), 2); // Swap RGBA to BGRA if using 3 or more channels int remap[4] = {numChannels >= 3 ? 2 : 0, 1, numChannels >= 3 ? 0 : 2, 3}; char *s = (char *)rgba; for(int y = height-1; y >= 0; --y) { int i = (y * width) * numChannels; for(int x = i; x < i+width*numChannels; x += numChannels) { for(int j = 0; j < numChannels; ++j) { stream << (quint8)(s[x+remap[j]]); } } } // Free rgb(a) free(rgba); }
void FBXWriter::encodeNode(QDataStream& out, const FBXNode& node) { auto device = out.device(); auto nodeStartPos = device->pos(); // endOffset (temporary, updated later) out << (FBXEndOffset)0; // Property count out << (FBXPropertyCount)node.properties.size(); // Property list length (temporary, updated later) out << (FBXListLength)0; out << (quint8)node.name.size(); out.writeRawData(node.name, node.name.size()); auto nodePropertiesStartPos = device->pos(); for (const auto& prop : node.properties) { encodeFBXProperty(out, prop); } // Go back and write property list length auto nodePropertiesEndPos = device->pos(); device->seek(nodeStartPos + sizeof(FBXEndOffset) + sizeof(FBXPropertyCount)); out << (FBXListLength)(nodePropertiesEndPos - nodePropertiesStartPos); device->seek(nodePropertiesEndPos); for (auto& child : node.children) { encodeNode(out, child); } if (node.children.length() > 0) { encodeNode(out, FBXNode()); } // Go back and write actual endOffset auto nodeEndPos = device->pos(); device->seek(nodeStartPos); out << (FBXEndOffset)(nodeEndPos); device->seek(nodeEndPos); }
int Server::mysink(virStreamPtr st, const char *buf, long unsigned int nbytes, void *opaque) { //char **mBuf = (char **)opaque; //*mBuf = (char *)malloc(nbytes); //memset(*mBuf, 0, nbytes); //memcpy(*mBuf, buf, nbytes); //Server::blockSize = (quint32)nbytes; //QTextStream out(stdout); //out << tr("Server::blockSize = %1").arg(Server::blockSize); //QDataStream *out = (QDataStream *)opaque; //(*out) << buf; //return 0; //FILE *fp = (FILE *)opaque; //return fwrite(buf, 1, nbytes, fp); QDataStream *out = (QDataStream *)opaque; return out->writeRawData(buf, nbytes); }
static int write_bmp(QDataStream& stream, int width, int height, pixelRGBA* rgba) { int i, j; int bytesPerLine; struct BMPHeader bmph; /* The length of each line must be a multiple of 4 bytes */ bytesPerLine = (3 * (width + 1) / 4) * 4; bmph.bfType[0] = 'B'; bmph.bfType[1] = 'M'; bmph.bfOffBits = 54; bmph.bfSize = bmph.bfOffBits + bytesPerLine * height; bmph.bfReserved = 0; bmph.biSize = 40; bmph.biWidth = width; bmph.biHeight = height; bmph.biPlanes = 1; bmph.biBitCount = 24; bmph.biCompression = 0; bmph.biSizeImage = bytesPerLine * height; bmph.biXPelsPerMeter = 0; bmph.biYPelsPerMeter = 0; bmph.biClrUsed = 0; bmph.biClrImportant = 0; stream.writeRawData( (const char*)(&bmph), sizeof(BMPHeader) ); for (i = height - 1; i >= 0; i--) { for (j = 0; j < width; j++) { pixelRGBA pixel = rgba[width * i + j]; stream << (quint8)pixel.b; stream << (quint8)pixel.g; stream << (quint8)pixel.r; } } return 1; }
int PackageReader::SendList() { QDataStream socketStream; socketStream.setVersion(QDataStream::Qt_4_8); socketStream.setDevice(s); qDebug()<<__FUNCTION__; int count=0; struct User *user; QByteArray data; for(;;) { QDataStream stream(&data,QIODevice::WriteOnly); stream.setVersion(QDataStream::Qt_4_8); user=l->Next(); if(user==NULL) { qDebug()<<__FUNCTION__<<"end"; return count; } qDebug()<<user->name; stream<<VAL_USER <<user->name.length() <<user->name <<user->add.toIPv4Address() <<user->port <<user->online; socketStream.writeRawData(data.data(),data.size()); count++; qDebug()<<__FUNCTION__<<"count"<<count; } }
void writeCString( QDataStream &stream, QByteArray &str ) { stream.writeRawData( str.data(), str.length() ); stream << (quint8)0; }
int imagetopnm(opj_image_t * image, QBuffer &buffer) { int *red, *green, *blue, *alpha = NULL; int wr, hr, max; int i; unsigned int compno, ncomp; int adjustR, adjustG, adjustB, adjustA; int two, has_alpha, triple; int prec, v; char bufferLocal[1024]; QDataStream str (&buffer); if((prec = (int)image->comps[0].prec) > 16) { fprintf(stderr,"%s:%d:imagetopnm\n\tprecision %d is larger than 16" "\n\t: refused.\n",__FILE__,__LINE__,prec); return 1; } two = has_alpha = 0; ncomp = image->numcomps; if (ncomp == 2 /* GRAYA */ || (ncomp > 2 /* RGB, RGBA */ && image->comps[0].dx == image->comps[1].dx && image->comps[1].dx == image->comps[2].dx && image->comps[0].dy == image->comps[1].dy && image->comps[1].dy == image->comps[2].dy && image->comps[0].prec == image->comps[1].prec && image->comps[1].prec == image->comps[2].prec )) { two = (prec > 8); triple = (ncomp > 2); wr = (int)image->comps[0].w; hr = (int)image->comps[0].h; max = (1<<prec) - 1; has_alpha = (ncomp == 4 || ncomp == 2); red = image->comps[0].data; if(triple) { green = image->comps[1].data; blue = image->comps[2].data; } else green = blue = NULL; if(has_alpha) { const char *tt = (triple?"RGB_ALPHA":"GRAYSCALE_ALPHA"); sprintf(bufferLocal, "P7\n# OpenJPEG-%s\nWIDTH %d\nHEIGHT %d\nDEPTH %d\n" "MAXVAL %d\nTUPLTYPE %s\nENDHDR\n", opj_version(), wr, hr, ncomp, max, tt); str.writeRawData (bufferLocal, strlen (bufferLocal)); alpha = image->comps[ncomp - 1].data; adjustA = (image->comps[ncomp - 1].sgnd ? 1 << (image->comps[ncomp - 1].prec - 1) : 0); } else { sprintf(bufferLocal, "P6\n# OpenJPEG-%s\n%d %d\n%d\n", opj_version(), wr, hr, max); str.writeRawData (bufferLocal, strlen (bufferLocal)); adjustA = 0; } adjustR = (image->comps[0].sgnd ? 1 << (image->comps[0].prec - 1) : 0); if(triple) { adjustG = (image->comps[1].sgnd ? 1 << (image->comps[1].prec - 1) : 0); adjustB = (image->comps[2].sgnd ? 1 << (image->comps[2].prec - 1) : 0); } else adjustG = adjustB = 0; for(i = 0; i < wr * hr; ++i) { if(two) { v = *red + adjustR; ++red; if(v > 65535) v = 65535; else if(v < 0) v = 0; sprintf(bufferLocal, "%c%c", (unsigned char)(v>>8), (unsigned char)v); str.writeRawData (bufferLocal, 2); if(triple) { v = *green + adjustG; ++green; if(v > 65535) v = 65535; else if(v < 0) v = 0; sprintf(bufferLocal, "%c%c", (unsigned char)(v>>8), (unsigned char)v); str.writeRawData (bufferLocal, 2); v = *blue + adjustB; ++blue; if(v > 65535) v = 65535; else if(v < 0) v = 0; sprintf(bufferLocal, "%c%c", (unsigned char)(v>>8), (unsigned char)v); str.writeRawData (bufferLocal, 2); }/* if(triple) */ if(has_alpha) { v = *alpha + adjustA; ++alpha; if(v > 65535) v = 65535; else if(v < 0) v = 0; sprintf(bufferLocal, "%c%c", (unsigned char)(v>>8), (unsigned char)v); str.writeRawData (bufferLocal, 2); } continue; } /* if(two) */ /* prec <= 8: */ v = *red++; if(v > 255) v = 255; else if(v < 0) v = 0; sprintf(bufferLocal, "%c", (unsigned char)v); str.writeRawData (bufferLocal, 1); if(triple) { v = *green++; if(v > 255) v = 255; else if(v < 0) v = 0; sprintf(bufferLocal, "%c", (unsigned char)v); str.writeRawData (bufferLocal, 1); v = *blue++; if(v > 255) v = 255; else if(v < 0) v = 0; sprintf(bufferLocal, "%c", (unsigned char)v); str.writeRawData (bufferLocal, 1); } if(has_alpha) { v = *alpha++; if(v > 255) v = 255; else if(v < 0) v = 0; sprintf(bufferLocal, "%c", (unsigned char)v); str.writeRawData (bufferLocal, 1); } } /* for(i */ return 0; }
// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- int AvizoRectilinearCoordinateWriter::writeData(QDataStream& out) { DataContainer::Pointer m = getDataContainerArray()->getDataContainer(m_FeatureIdsArrayPath.getDataContainerName()); size_t dims[3]; m->getGeometryAs<ImageGeom>()->getDimensions(dims); float origin[3]; m->getGeometryAs<ImageGeom>()->getOrigin(origin); float res[3]; m->getGeometryAs<ImageGeom>()->getResolution(res); QString start("@1 # FeatureIds in z, y, x with X moving fastest, then Y, then Z\n"); out << start; if (true == m_WriteBinaryFile) { out.writeRawData(reinterpret_cast<char*>(m_FeatureIds), m_FeatureIdsPtr.lock()->getNumberOfTuples() * sizeof(int32_t)); //writer.writeArray(m_FeatureIds, getDataContainerArray()->getDataContainer(getDataContainerName())->getTotalPoints()); out << "\n"; } else { // The "20 Items" is purely arbitrary and is put in to try and save some space in the ASCII file int64_t totalPoints = m_FeatureIdsPtr.lock()->getNumberOfTuples(); int count = 0; QString ss; for (int64_t i = 0; i < totalPoints; ++i) { out << m_FeatureIds[i]; if(count < 20) { ss = ss.append(" "); count++; } else { out << "\n"; out << ss; ss.clear(); count = 0; } } ss = ss.append("\n"); // Make sure there is a new line at the end of the data block // Pick up any remaining data that was not written because we did not have 20 items on a line. out << ss; } start = "@2 # x coordinates, then y, then z\n"; out << start; if (true == m_WriteBinaryFile) { for (int d = 0; d < 3; ++d) { std::vector<float> coords(dims[d]); for (size_t i = 0; i < dims[d]; ++i) { coords[i] = origin[d] + (res[d] * i); } out.writeRawData(reinterpret_cast<char*>(&(coords.front())), dims[d] * sizeof(float)); out << "\n"; // This puts a new line character } } else { for (int d = 0; d < 3; ++d) { for (size_t i = 0; i < dims[d]; ++i) { out << (origin[d] + (res[d] * i)) << " "; } out << "\n"; } } return 1; }
static void qStreamNtlmBuffer(QDataStream& ds, const QByteArray& s) { ds.writeRawData(s.constData(), s.size()); }
void QMessageContentContainer::writeContent(QDataStream& out) const { QByteArray data(content()); out.writeRawData(data.constData(), data.length()); }
static size_t curl_write_func(char *buf, size_t size, size_t nmemb, void *p) { size_t n = size * nmemb; QDataStream *stream = (QDataStream *)p; return stream->writeRawData(buf, n); }