From 6d2bdd849a38275e3a8a51800cda080108c61cb7 Mon Sep 17 00:00:00 2001 From: Don Gagne Date: Sat, 28 Jun 2014 10:52:47 -0700 Subject: [PATCH] Workaround odd Windows std::string problem --- src/qgcunittest/MockMavlinkFileServer.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/qgcunittest/MockMavlinkFileServer.cc b/src/qgcunittest/MockMavlinkFileServer.cc index 4e8d66fda..68ad1587f 100644 --- a/src/qgcunittest/MockMavlinkFileServer.cc +++ b/src/qgcunittest/MockMavlinkFileServer.cc @@ -69,15 +69,17 @@ void MockMavlinkFileServer::_listCommand(QGCUASFileManager::Request* request) ackResponse.hdr.session = 0; ackResponse.hdr.offset = request->hdr.offset; ackResponse.hdr.size = 0; + + qDebug() << _fileList; if (request->hdr.offset == 0) { // Requesting first batch of file names Q_ASSERT(_fileList.size()); char *bufPtr = (char *)&ackResponse.data[0]; for (int i=0; i<_fileList.size(); i++) { - const char *filename = _fileList[i].toStdString().c_str(); - size_t cchFilename = strlen(filename); - strcpy(bufPtr, filename); + strcpy(bufPtr, _fileList[i].toStdString().c_str()); + size_t cchFilename = strlen(bufPtr); + Q_ASSERT(cchFilename); ackResponse.hdr.size += cchFilename + 1; bufPtr += cchFilename + 1; } -- 2.22.0