Mark max_blen as static constexpr and use in test

This commit is contained in:
Abdelhakim Qbaich 2026-04-05 19:27:19 -04:00
parent 0c24c83535
commit f21a6470b1
2 changed files with 7 additions and 4 deletions

View File

@ -26,6 +26,7 @@
#include "dbLayoutDiff.h"
#include "dbTextWriter.h"
#include "dbTestSupport.h"
#include "tlDeflate.h"
#include "tlLog.h"
#include "tlUnitTest.h"
#include "tlStream.h"
@ -706,7 +707,7 @@ TEST(CBlockLargePropertyString)
unsigned int layer = layout_org.insert_layer (db::LayerProperties (1, 0));
db::Cell &top = layout_org.cell (layout_org.add_cell ("TOP"));
std::string large_value (42000, 'a');
std::string large_value (tl::InflateFilter::max_blen () + 1, 'a');
db::PropertiesSet ps;
ps.insert (db::property_names_id (tl::Variant ("blob")), tl::Variant (large_value));

View File

@ -195,6 +195,8 @@ private:
class TL_PUBLIC InflateFilter
{
public:
static constexpr size_t buffer_size = 65536;
/**
* @brief Constructor
*
@ -218,9 +220,9 @@ public:
/**
* @brief Obtain the maximum number of bytes available for a single get() call
*/
size_t max_blen () const
static constexpr size_t max_blen ()
{
return sizeof (m_buffer) / 2 - 1;
return buffer_size / 2 - 1;
}
/**
@ -240,7 +242,7 @@ public:
private:
BitStream m_input;
char m_buffer[65536];
char m_buffer[buffer_size];
unsigned int m_b_insert;
unsigned int m_b_read;
bool m_at_end;