diff --git a/libraries/shared/src/Logging.cpp b/libraries/shared/src/Logging.cpp index bc0d4af084..a9f71e346e 100644 --- a/libraries/shared/src/Logging.cpp +++ b/libraries/shared/src/Logging.cpp @@ -98,6 +98,9 @@ const char* stringForLogType(QtMsgType msgType) { const char DATE_STRING_FORMAT[] = "%F %H:%M:%S %z"; void Logging::verboseMessageHandler(QtMsgType type, const QMessageLogContext& context, const QString& message) { + if (message.isEmpty()) { + return; + } // log prefix is in the following format // [DEBUG] [TIMESTAMP] [PID:PARENT_PID] [TARGET] logged string diff --git a/libraries/shared/src/PacketHeaders.cpp b/libraries/shared/src/PacketHeaders.cpp index b46a57d4aa..b1f6ef1730 100644 --- a/libraries/shared/src/PacketHeaders.cpp +++ b/libraries/shared/src/PacketHeaders.cpp @@ -57,6 +57,9 @@ PacketVersion versionForPacketType(PacketType type) { case PacketTypeDataServerConfirm: case PacketTypeDataServerSend: return 1; + case PacketTypeVoxelSet: + case PacketTypeVoxelSetDestructive: + return 1; default: return 0; } diff --git a/libraries/voxels/src/VoxelTree.cpp b/libraries/voxels/src/VoxelTree.cpp index e29cfda41d..08ec2cfc3c 100644 --- a/libraries/voxels/src/VoxelTree.cpp +++ b/libraries/voxels/src/VoxelTree.cpp @@ -521,6 +521,8 @@ bool VoxelTree::handlesEditPacketType(PacketType packetType) const { } } +const unsigned int REPORT_OVERFLOW_WARNING_INTERVAL = 100; +unsigned int overflowWarnings = 0; int VoxelTree::processEditPacketData(PacketType packetType, const unsigned char* packetData, int packetLength, const unsigned char* editData, int maxLength, const SharedNodePointer& node) { @@ -532,9 +534,17 @@ int VoxelTree::processEditPacketData(PacketType packetType, const unsigned char* int octets = numberOfThreeBitSectionsInCode(editData, maxLength); if (octets == OVERFLOWED_OCTCODE_BUFFER) { - printf("WARNING! Got voxel edit record that would overflow buffer in numberOfThreeBitSectionsInCode(), "); - printf("bailing processing of packet!\n"); - return 0; + overflowWarnings++; + if (overflowWarnings % REPORT_OVERFLOW_WARNING_INTERVAL == 1) { + qDebug() << "WARNING! Got voxel edit record that would overflow buffer in numberOfThreeBitSectionsInCode()" + " [NOTE: this is warning number" << overflowWarnings << ", the next" << + (REPORT_OVERFLOW_WARNING_INTERVAL-1) << "will be suppressed.]"; + + QDebug debug = qDebug(); + debug << "edit data contents:"; + outputBufferBits(editData, maxLength, &debug); + } + return maxLength; } const int COLOR_SIZE_IN_BYTES = 3; @@ -542,9 +552,17 @@ int VoxelTree::processEditPacketData(PacketType packetType, const unsigned char* int voxelDataSize = voxelCodeSize + COLOR_SIZE_IN_BYTES; if (voxelDataSize > maxLength) { - printf("WARNING! Got voxel edit record that would overflow buffer, bailing processing of packet!\n"); - printf("bailing processing of packet!\n"); - return 0; + overflowWarnings++; + if (overflowWarnings % REPORT_OVERFLOW_WARNING_INTERVAL == 1) { + qDebug() << "WARNING! Got voxel edit record that would overflow buffer." + " [NOTE: this is warning number" << overflowWarnings << ", the next" << + (REPORT_OVERFLOW_WARNING_INTERVAL-1) << "will be suppressed.]"; + + QDebug debug = qDebug(); + debug << "edit data contents:"; + outputBufferBits(editData, maxLength, &debug); + } + return maxLength; } readCodeColorBufferToTree(editData, destructive);