diff options
author | Dennis Syrovatsky <dennis@tightvnc.com> | 2005-12-18 15:22:13 +0000 |
---|---|---|
committer | Dennis Syrovatsky <dennis@tightvnc.com> | 2005-12-18 15:22:13 +0000 |
commit | 3db3c48caef9e26aa9d3134c080e70963fed7698 (patch) | |
tree | 4ef900e0d46110894e40c44166e8c61c89ffb2f5 /rfb | |
parent | d5a05536fc53b3ed308d02c02cafecb6cd3f6a48 (diff) | |
download | tigervnc-3db3c48caef9e26aa9d3134c080e70963fed7698.tar.gz tigervnc-3db3c48caef9e26aa9d3134c080e70963fed7698.zip |
Added SFTMsgWriter::writeFileListData method.
Deleted FileInfo::getAllFilenames() method.
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@465 3789f03b-4d11-0410-bbf8-ca57d06f2519
Diffstat (limited to 'rfb')
-rw-r--r-- | rfb/FileInfo.cxx | 20 | ||||
-rw-r--r-- | rfb/FileInfo.h | 1 | ||||
-rw-r--r-- | rfb/SFTMsgWriter.cxx | 38 |
3 files changed, 37 insertions, 22 deletions
diff --git a/rfb/FileInfo.cxx b/rfb/FileInfo.cxx index 0d770f39..5b151d96 100644 --- a/rfb/FileInfo.cxx +++ b/rfb/FileInfo.cxx @@ -237,23 +237,3 @@ FileInfo::getFilenamesSize() return filenamesSize; } - -char * -FileInfo::getAllFilenames(unsigned int *pFilenameSize) -{ - unsigned int filenameSize = getFilenamesSize() + getNumEntries(); - - char *pFilenames = new char[filenameSize]; - unsigned int pos = 0; - - for (unsigned int i = 0; i < getNumEntries(); i++) { - char *pName = getNameAt(i); - unsigned int len = strlen(pName); - - memcpy((void *)&pFilenames[pos], pName, len + 1); - pos += len + 2; - } - - *pFilenameSize = filenameSize; - return pFilenames; -} diff --git a/rfb/FileInfo.h b/rfb/FileInfo.h index c2b63ac5..4dccc955 100644 --- a/rfb/FileInfo.h +++ b/rfb/FileInfo.h @@ -55,7 +55,6 @@ namespace rfb { unsigned int getNumEntries(); unsigned int getFilenamesSize(); - char *getAllFilenames(unsigned int *pFilenameSize); void sort(); void free(); diff --git a/rfb/SFTMsgWriter.cxx b/rfb/SFTMsgWriter.cxx index 4ea85a8c..4edfc467 100644 --- a/rfb/SFTMsgWriter.cxx +++ b/rfb/SFTMsgWriter.cxx @@ -37,7 +37,43 @@ SFTMsgWriter::~SFTMsgWriter() bool SFTMsgWriter::writeFileListData(unsigned char flags, rfb::FileInfo *pFileInfo) { - return false; + unsigned int numFiles = pFileInfo->getNumEntries(); + + m_pOS->writeU8(msgTypeFileListData); + m_pOS->writeU8(flags); + m_pOS->writeU16(numFiles); + + if (numFiles == 0) { + m_pOS->writeU16(0); + m_pOS->writeU16(0); + } else { + unsigned int filenamesSize = pFileInfo->getFilenamesSize() + numFiles; + + m_pOS->writeU16(filenamesSize); + m_pOS->writeU16(filenamesSize); + + char *pFilenames = new char [filenamesSize]; + unsigned int pos = 0; + + for (unsigned int i = 0; i < numFiles; i++) { + char *pName = pFileInfo->getNameAt(i); + unsigned int len = strlen(pName); + + memcpy((void *)&pFilenames[pos], pName, len + 1); + pos += len + 2; + + m_pOS->writeU32(pFileInfo->getSizeAt(i)); + m_pOS->writeU32(pFileInfo->getDataAt(i)); + } + + m_pOS->writeBytes(pFilenames, filenamesSize); + + delete [] pFilenames; + } + + m_pOS->flush(); + + return true; } bool |