bool Writer::writeHeader(const QJsonObject &customMetadata) { if(m_encoding == Encoding::Binary) return writeRecordingHeader(m_file, customMetadata); else return writeTextHeader(m_file, customMetadata); }
afs_int32 writeText(struct ubik_trans *ut, int fid, int textType) { struct textBlock *tbPtr; afs_int32 textSize, writeSize; dbadr dbAddr; struct block block; afs_int32 code = 0; /* check lock is free */ code = checkLock(textType); if (code) ERROR(code); /* ensure that this block has the correct type */ code = checkText(ut, textType); if (code) { LogError(0, "writeText: text type %d damaged\n", textType); ERROR(code); } tbPtr = &db.h.textBlock[textType]; textSize = ntohl(tbPtr->size); dbAddr = ntohl(tbPtr->textAddr); if (!dbAddr) goto error_exit; /* Don't save anything if no blocks */ writeTextHeader(fid, textType); while (dbAddr) { code = cdbread(ut, text_BLOCK, dbAddr, (char *)&block, sizeof(block)); if (code) ERROR(code); writeSize = MIN(textSize, BLOCK_DATA_SIZE); if (!writeSize) break; if (canWrite(fid) <= 0) ERROR(BUDB_DUMPFAILED); if (write(fid, &block.a[0], writeSize) != writeSize) ERROR(BUDB_IO); haveWritten(writeSize); textSize -= writeSize; dbAddr = ntohl(block.h.next); } error_exit: return (code); }