File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed
lib/inc/sys_string/impl/platforms Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -108,7 +108,7 @@ namespace sysstr::util
108108 class bstr_buffer
109109 {
110110 private:
111- static constexpr size_t size_in_pointers = 3 ;
111+ static constexpr size_t total_size = std::max( 3 * sizeof ( void *), size_t ( 24 )) ;
112112
113113 union data
114114 {
@@ -120,18 +120,18 @@ namespace sysstr::util
120120 struct
121121 {
122122 UINT value;
123- std::byte unused[size_in_pointers * sizeof ( void *) - sizeof (UINT)];
123+ std::byte unused[total_size - sizeof (UINT)];
124124 } flags;
125125 struct
126126 {
127- void * unused[size_in_pointers - 1 ];
127+ void * unused[total_size / sizeof ( void *) - 1 ];
128128 dynamic_bstr * ptr;
129129 } dynamic_data;
130130 struct embedded_data_t
131131 {
132132 UINT unused;
133133 UINT size;
134- char16_t chars[(size_in_pointers * sizeof (dynamic_bstr *) - 2 * sizeof (UINT)) / sizeof (char16_t )];
134+ char16_t chars[(total_size - 2 * sizeof (UINT)) / sizeof (char16_t )];
135135 } embedded_data;
136136 public:
137137 static constexpr UINT max_small_length = std::extent_v<decltype (embedded_data_t ::chars)> - 1 ;
@@ -320,7 +320,7 @@ namespace sysstr::util
320320 }
321321 }
322322 };
323- static_assert (sizeof (data) == size_in_pointers * sizeof ( void *) );
323+ static_assert (sizeof (data) == total_size );
324324
325325 public:
326326 bstr_buffer () noexcept
You can’t perform that action at this time.
0 commit comments