[api] Remove unused add_fixed_field template function

This commit is contained in:
J. Nick Koston 2025-07-20 18:05:21 -10:00
parent fc286c8bf4
commit 14e2c85028
No known key found for this signature in database
2 changed files with 3 additions and 23 deletions

View File

@ -225,11 +225,10 @@ void APIConnection::loop() {
if (this->image_reader_ && this->image_reader_->available() && this->helper_->can_write_without_blocking()) {
uint32_t to_send = std::min((size_t) MAX_BATCH_PACKET_SIZE, this->image_reader_->available());
bool done = this->image_reader_->available() == to_send;
uint32_t msg_size = 0;
ProtoSize::add_fixed_field<4>(msg_size, 1, true);
// partial message size calculated manually since its a special case
// 1 for the data field, varint for the data size, and the data itself
msg_size += 1 + ProtoSize::varint(to_send) + to_send;
// fixed32 key = 1 (1 byte for field header + 4 bytes for fixed32)
// bytes data = 2 (1 byte for field header + varint for data size + data itself)
uint32_t msg_size = 1 + 4 + 1 + ProtoSize::varint(to_send) + to_send;
ProtoSize::add_bool_field(msg_size, 1, done);
auto buffer = this->create_buffer(msg_size);

View File

@ -527,25 +527,6 @@ class ProtoSize {
total_size += field_id_size + 1;
}
/**
* @brief Calculates and adds the size of a fixed field to the total message size
*
* Fixed fields always take exactly N bytes (4 for fixed32/float, 8 for fixed64/double).
*
* @tparam NumBytes The number of bytes for this fixed field (4 or 8)
* @param is_nonzero Whether the value is non-zero
*/
template<uint32_t NumBytes>
static inline void add_fixed_field(uint32_t &total_size, uint32_t field_id_size, bool is_nonzero) {
// Skip calculation if value is zero
if (!is_nonzero) {
return; // No need to update total_size
}
// Fixed fields always take exactly NumBytes
total_size += field_id_size + NumBytes;
}
/**
* @brief Calculates and adds the size of a float field to the total message size
*/