• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

polserver / polserver / 21108840797

18 Jan 2026 08:35AM UTC coverage: 60.508% (+0.02%) from 60.492%
21108840797

push

github

web-flow
ClangTidy readability-else-after-return (#857)

* trigger tidy

* Automated clang-tidy change: readability-else-after-return

* compile test

* rerun

* Automated clang-tidy change: readability-else-after-return

* trigger..

* Automated clang-tidy change: readability-else-after-return

* manually removed a few

* Automated clang-tidy change: readability-else-after-return

* removed duplicate code

* fix remaining warnings

* fixed scope

---------

Co-authored-by: Clang Tidy <clang-tidy@users.noreply.github.com>

837 of 1874 new or added lines in 151 files covered. (44.66%)

46 existing lines in 25 files now uncovered.

44448 of 73458 relevant lines covered (60.51%)

525066.38 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

13.31
/pol-core/pol/packetscrobj.cpp
1
/** @file
2
 *
3
 * @par History
4
 * - 2005/09/12 Shinigami: added ObjMethods packet.GetIntxxFlipped and packet.SetIntxxFlipped (Byte
5
 * Order)
6
 * - 2006/09/16 Shinigami: added ObjMethods packet.GetUnicodeStringFlipped and
7
 * packet.SetUnicodeStringFlipped (Byte Order)
8
 * - 2006/09/16 Shinigami: fixed Memory Overwrite Bug in packet.SetUnicodeString* ->
9
 * convertArrayToUC
10
 * - 2008/12/17 MuadDib:   fixed Memory Leak in SetSize() where it returns BObjects back
11
 * - to calling Methods where they do not handle a return value.
12
 * - 2009/08/25 Shinigami: STLport-5.2.1 fix: oldsize not used
13
 * - 2009/12/21 Turley:    ._method() call fix
14
 */
15

16

17
#include "packetscrobj.h"
18

19
#include <iomanip>
20
#include <stddef.h>
21

22
#include "../bscript/berror.h"
23
#include "../bscript/bobject.h"
24
#include "../bscript/executor.h"
25
#include "../bscript/impstr.h"
26
#include "../bscript/objmembers.h"
27
#include "../bscript/objmethods.h"
28
#include "../clib/clib_endian.h"
29
#include "../clib/stlutil.h"
30
#include "../clib/strutil.h"
31
#include "base/position.h"
32
#include "globals/network.h"
33
#include "mobile/charactr.h"
34
#include "network/client.h"
35
#include "network/clienttransmit.h"
36
#include "realms/realm.h"
37
#include "realms/realms.h"
38
#include "uoexec.h"
39
#include "uworld.h"
40

41

42
namespace Pol::Core
43
{
44
using namespace Bscript;
45

46
BPacket::BPacket() : PolObjectImp( OTPacket ), is_variable_length( false ) {}
×
47
BPacket::BPacket( const BPacket& copyfrom )
×
48
    : PolObjectImp( OTPacket ),
49
      buffer( copyfrom.buffer ),
×
50
      is_variable_length( copyfrom.is_variable_length )
×
51
{
52
}
×
53
BPacket::BPacket( u8 type, signed short length ) : PolObjectImp( OTPacket )
4✔
54
{
55
  if ( length == -1 )
4✔
56
  {
57
    is_variable_length = true;
1✔
58
    buffer.resize( 1, type );
1✔
59
  }
60
  else
61
  {
62
    is_variable_length = false;
3✔
63
    if ( length > 0 )
3✔
64
    {
65
      buffer.resize( length, 0 );
1✔
66
      buffer[0] = type;
1✔
67
    }
68
  }
69
}
4✔
70
BPacket::BPacket( const unsigned char* data, unsigned short length, bool variable_len )
×
71
    : PolObjectImp( OTPacket ), buffer( data, data + length )
×
72
{
73
  is_variable_length = variable_len;
×
74
}
×
75
BPacket::~BPacket() = default;
8✔
76

77
BObjectRef BPacket::get_member_id( const int /*id*/ )  // id test
×
78
{
79
  return BObjectRef( new BLong( 0 ) );
×
80
}
81
BObjectRef BPacket::get_member( const char* membername )
×
82
{
83
  ObjMember* objmember = getKnownObjMember( membername );
×
84
  if ( objmember != nullptr )
×
85
    return this->get_member_id( objmember->id );
×
NEW
86
  return BObjectRef( UninitObject::create() );
×
87
}
88

89
BObjectImp* BPacket::call_polmethod_id( const int id, UOExecutor& ex, bool /*forcebuiltin*/ )
6✔
90
{
91
  switch ( id )
6✔
92
  {
93
  case MTH_SENDPACKET:
×
94
  {
95
    if ( ex.numParams() != 1 )
×
96
      return new BError( "SendPacket requires 1 parameter." );
×
97

98
    Mobile::Character* chr = nullptr;
×
99
    Network::Client* client = nullptr;
×
100
    if ( ex.getCharacterOrClientParam( 0, chr, client ) )
×
101
    {
102
      if ( chr != nullptr )
×
103
      {
104
        if ( !chr->has_active_client() )
×
105
          return new BLong( 0 );
×
106

107
        client = chr->client;
×
108
      }
109

110
      if ( client != nullptr )
×
111
      {
112
        if ( client->isConnected() )
×
113
        {
114
          Core::networkManager.clientTransmit->AddToQueue( client, (void*)( &buffer[0] ),
×
115
                                                           static_cast<int>( buffer.size() ) );
×
116
          return new BLong( 1 );
×
117
        }
NEW
118
        return new BLong( 0 );
×
119
      }
120
    }
121
    break;
×
122
  }
123

124
  case MTH_SENDAREAPACKET:
×
125
  {
126
    if ( ex.numParams() != 4 )
×
127
      return new BError( "SendAreaPacket requires 4 parameters." );
×
128
    Core::Pos2d pos;
×
129
    Realms::Realm* realm;
130
    unsigned short range;
131
    if ( ex.getRealmParam( 3, &realm ) && ex.getPos2dParam( 0, 1, &pos, realm ) &&
×
132
         ex.getParam( 2, range ) )
×
133
    {
134
      unsigned short num_sent_to = 0;
×
135
      Core::WorldIterator<Core::OnlinePlayerFilter>::InRange(
×
136
          pos, realm, range,
137
          [&]( Mobile::Character* chr )
×
138
          {
139
            Core::networkManager.clientTransmit->AddToQueue( chr->client, (void*)( &buffer[0] ),
×
140
                                                             static_cast<int>( buffer.size() ) );
×
141
            num_sent_to++;
×
142
          } );
×
143
      return new BLong( num_sent_to );
×
144
    }
145
    break;
×
146
  }
147

148
  case MTH_GETINT8:
×
149
  {
150
    if ( ex.numParams() != 1 )
×
151
      return new BError( "GetInt8 requires 1 parameter." );
×
152
    unsigned short offset;
153
    if ( ex.getParam( 0, offset ) )
×
154
    {
155
      if ( offset >= buffer.size() )  // don't allow getting bytes past end of buffer
×
156
        return new BError( "Offset too high" );
×
157
      u8* data = reinterpret_cast<u8*>( &buffer[offset] );
×
158
      return new BLong( *data );
×
159
    }
160
    break;
×
161
  }
162

163
  case MTH_GETINT16:
×
164
  {
165
    if ( ex.numParams() != 1 )
×
166
      return new BError( "GetInt16 requires 1 parameter." );
×
167
    unsigned short offset;
168
    if ( ex.getParam( 0, offset ) )
×
169
    {
170
      if ( offset > buffer.size() - sizeof( u16 ) )  // don't allow getting bytes past end of buffer
×
171
        return new BError( "Offset too high" );
×
172
      u16* data = reinterpret_cast<u16*>( &buffer[offset] );
×
173
      return new BLong( cfBEu16( *data ) );
×
174
    }
175
    break;
×
176
  }
177

178
  case MTH_GETINT32:
×
179
  {
180
    if ( ex.numParams() != 1 )
×
181
      return new BError( "GetInt32 requires 1 parameter." );
×
182
    unsigned short offset;
183
    if ( ex.getParam( 0, offset ) )
×
184
    {
185
      if ( offset > buffer.size() - sizeof( u32 ) )  // don't allow getting bytes past end of buffer
×
186
        return new BError( "Offset too high" );
×
187
      u32* data = reinterpret_cast<u32*>( &buffer[offset] );
×
188
      return new BLong( cfBEu32( *data ) );
×
189
    }
190
    break;
×
191
  }
192

193
  case MTH_GETINT16FLIPPED:
×
194
  {
195
    if ( ex.numParams() != 1 )
×
196
      return new BError( "GetInt16Flipped requires 1 parameter." );
×
197
    unsigned short offset;
198
    if ( ex.getParam( 0, offset ) )
×
199
    {
200
      if ( offset > buffer.size() - sizeof( u16 ) )  // don't allow getting bytes past end of buffer
×
201
        return new BError( "Offset too high" );
×
202
      u16* data = reinterpret_cast<u16*>( &buffer[offset] );
×
203
      return new BLong( cfLEu16( *data ) );
×
204
    }
205
    break;
×
206
  }
207

208
  case MTH_GETINT32FLIPPED:
×
209
  {
210
    if ( ex.numParams() != 1 )
×
211
      return new BError( "GetInt32Flipped requires 1 parameter." );
×
212
    unsigned short offset;
213
    if ( ex.getParam( 0, offset ) )
×
214
    {
215
      if ( offset > buffer.size() - sizeof( u32 ) )  // don't allow getting bytes past end of buffer
×
216
        return new BError( "Offset too high" );
×
217
      u32* data = reinterpret_cast<u32*>( &buffer[offset] );
×
218
      return new BLong( cfLEu32( *data ) );
×
219
    }
220
    break;
×
221
  }
222

223
  case MTH_GETSTRING:
×
224
  {
225
    if ( ex.numParams() != 2 )
×
226
      return new BError( "GetString requires 2 parameter." );
×
227
    unsigned short offset, len;
228
    if ( ex.getParam( 0, offset ) && ex.getParam( 1, len ) )
×
229
    {
230
      if ( ( offset >= buffer.size() ) ||
×
231
           ( static_cast<u16>( offset + len ) >
×
232
             buffer.size() ) )  // don't allow getting bytes past end of buffer
×
233
        return new BError( "Offset too high" );
×
234

235
      const char* str_offset = reinterpret_cast<const char*>( &buffer[offset] );
×
236
      size_t real_len = 0;
×
237

238
      // Returns maximum of len characters or up to the first null-byte
239
      while ( real_len < len && *( str_offset + real_len ) )
×
240
        ++real_len;
×
241

242
      return new String( str_offset, real_len, String::Tainted::YES );
×
243
    }
244
    break;
×
245
  }
246

247
  case MTH_GETUNICODESTRING:
×
248
  {
249
    if ( ex.numParams() != 2 )
×
250
      return new BError( "GetUnicodeString requires 2 parameter." );
×
251
    unsigned short offset, len;
252
    if ( ex.getParam( 0, offset ) &&
×
253
         ex.getParam( 1, len ) )  // len is in unicode characters, not bytes
×
254
    {
255
      if ( ( offset >= buffer.size() ) ||
×
256
           ( static_cast<u16>( offset + len * 2 ) >
×
257
             buffer.size() ) )  // don't allow getting bytes past end of buffer
×
258
        return new BError( "Offset too high" );
×
259
      std::string str =
260
          Bscript::String::fromUTF16( reinterpret_cast<u16*>( &buffer[offset] ), len, true );
×
261
      return new Bscript::String( str );
×
262
    }
×
263
    break;
×
264
  }
265

266
  case MTH_GETUNICODESTRINGFLIPPED:
×
267
  {
268
    if ( ex.numParams() != 2 )
×
269
      return new BError( "GetUnicodeStringFlipped requires 2 parameter." );
×
270
    unsigned short offset, len;
271
    if ( ex.getParam( 0, offset ) &&
×
272
         ex.getParam( 1, len ) )  // len is in unicode characters, not bytes
×
273
    {
274
      if ( ( offset >= buffer.size() ) ||
×
275
           ( static_cast<u16>( offset + len * 2 ) >
×
276
             buffer.size() ) )  // don't allow getting bytes past end of buffer
×
277
        return new BError( "Offset too high" );
×
278
      std::string str =
279
          Bscript::String::fromUTF16( reinterpret_cast<u16*>( &buffer[offset] ), len );
×
280
      return new Bscript::String( str );
×
281
    }
×
282
    break;
×
283
  }
284

285
  case MTH_GETSIZE:
×
286
    return new BLong( static_cast<int>( buffer.size() ) );
×
287

288
  case MTH_SETSIZE:
×
289
  {
290
    if ( ex.numParams() != 1 )
×
291
      return new BError( "SetSize requires 1 parameter." );
×
292
    unsigned short newsize;
293
    if ( ex.getParam( 0, newsize ) )
×
294
    {
295
      return SetSize( newsize, true );
×
296
    }
297
    break;
×
298
  }
299

300
  case MTH_SETINT8:
4✔
301
  {
302
    if ( ex.numParams() != 2 )
4✔
303
      return new BError( "SetInt8 requires 2 parameters." );
4✔
304
    unsigned short offset, value;
305
    if ( ex.getParam( 0, offset ) && ex.getParam( 1, value ) )
4✔
306
    {
307
      if ( offset >= buffer.size() )
4✔
308
      {
309
        if ( !SetSize( ( offset + sizeof( u8 ) ) ) )
3✔
310
        {
311
          return new BError( "Offset value out of range on a fixed length packet" );
1✔
312
        }
313
      }
314
      buffer[offset] = static_cast<u8>( value );
3✔
315
      return new BLong( 1 );
3✔
316
    }
317
    break;
×
318
  }
319

320
  case MTH_SETINT16:
×
321
  {
322
    if ( ex.numParams() != 2 )
×
323
      return new BError( "SetInt16 requires 2 parameters." );
×
324
    unsigned short offset, value;
325
    if ( ex.getParam( 0, offset ) && ex.getParam( 1, value ) )
×
326
    {
327
      if ( static_cast<u16>( offset + sizeof( u16 ) ) > buffer.size() )
×
328
      {
329
        if ( !SetSize( ( offset + sizeof( u16 ) ) ) )
×
330
        {
331
          return new BError( "Offset value out of range on a fixed length packet" );
×
332
          ;
333
        }
334
      }
335

336
      u16* bufptr = reinterpret_cast<u16*>( &buffer[offset] );
×
337
      *bufptr = ctBEu16( static_cast<u16>( value ) );
×
338
      return new BLong( 1 );
×
339
    }
340
    break;
×
341
  }
342

343
  case MTH_SETINT32:
×
344
  {
345
    if ( ex.numParams() != 2 )
×
346
      return new BError( "SetInt32 requires 2 parameters." );
×
347
    unsigned short offset;
348
    int lvalue;
349
    if ( ex.getParam( 0, offset ) && ex.getParam( 1, lvalue ) )
×
350
    {
351
      if ( static_cast<u32>( offset + sizeof( u32 ) ) > buffer.size() )
×
352
      {
353
        if ( !SetSize( offset + sizeof( u32 ) ) )
×
354
        {
355
          return new BError( "Offset value out of range on a fixed length packet" );
×
356
          ;
357
        }
358
      }
359

360
      u32* bufptr = reinterpret_cast<u32*>( &buffer[offset] );
×
361
      *bufptr = ctBEu32( static_cast<u32>( lvalue ) );
×
362
      return new BLong( 1 );
×
363
    }
364
    break;
×
365
  }
366

367
  case MTH_SETINT16FLIPPED:
×
368
  {
369
    if ( ex.numParams() != 2 )
×
370
      return new BError( "SetInt16Flipped requires 2 parameters." );
×
371
    unsigned short offset, value;
372
    if ( ex.getParam( 0, offset ) && ex.getParam( 1, value ) )
×
373
    {
374
      if ( static_cast<u16>( offset + sizeof( u16 ) ) > buffer.size() )
×
375
      {
376
        if ( !SetSize( ( offset + sizeof( u16 ) ) ) )
×
377
        {
378
          return new BError( "Offset value out of range on a fixed length packet" );
×
379
          ;
380
        }
381
      }
382

383
      u16* bufptr = reinterpret_cast<u16*>( &buffer[offset] );
×
384
      *bufptr = ctLEu16( static_cast<u16>( value ) );
×
385
      return new BLong( 1 );
×
386
    }
387
    break;
×
388
  }
389

390
  case MTH_SETINT32FLIPPED:
×
391
  {
392
    if ( ex.numParams() != 2 )
×
393
      return new BError( "SetInt32Flipped requires 2 parameters." );
×
394
    unsigned short offset;
395
    int lvalue;
396
    if ( ex.getParam( 0, offset ) && ex.getParam( 1, lvalue ) )
×
397
    {
398
      if ( static_cast<u32>( offset + sizeof( u32 ) ) > buffer.size() )
×
399
      {
400
        if ( !SetSize( ( offset + sizeof( u32 ) ) ) )
×
401
        {
402
          return new BError( "Offset value out of range on a fixed length packet" );
×
403
          ;
404
        }
405
      }
406
      u32* bufptr = reinterpret_cast<u32*>( &buffer[offset] );
×
407
      *bufptr = ctLEu32( static_cast<u32>( lvalue ) );
×
408
      return new BLong( 1 );
×
409
    }
410
    break;
×
411
  }
412

413
  case MTH_SETSTRING:
×
414
  {
415
    if ( ex.numParams() != 3 )
×
416
      return new BError( "SetString requires 3 parameters." );
×
417
    unsigned short offset, nullterm;
418
    const String* text;
419
    if ( ex.getParam( 0, offset ) && ex.getStringParam( 1, text ) && ex.getParam( 2, nullterm ) )
×
420
    {
421
      std::string cp1252text;
×
422
      if ( text->hasUTF8Characters() )
×
423
      {
424
        cp1252text = Clib::strUtf8ToCp1252( text->value() );
×
425
      }
426
      else
427
      {
428
        cp1252text = text->value();
×
429
      }
430
      u16 textlen = static_cast<u16>( cp1252text.length() );
×
431
      if ( static_cast<u16>( offset + textlen + nullterm ) > buffer.size() )
×
432
      {
433
        if ( !SetSize( ( offset + textlen + nullterm ) ) )
×
434
        {
435
          return new BError( "Offset value out of range on a fixed length packet" );
×
436
        }
437
      }
438
      u8* bufptr = reinterpret_cast<u8*>( &buffer[offset] );
×
439
      const char* textptr = cp1252text.c_str();
×
440
      for ( u16 i = 0; i < textlen; i++ )
×
441
      {
442
        bufptr[i] = textptr[i];
×
443
      }
444

445
      if ( nullterm )
×
446
        bufptr[textlen] = 0;
×
447

448
      return new BLong( 1 );
×
449
    }
×
450
    break;
×
451
  }
452
  case MTH_SETUTF8STRING:
×
453
  {
454
    if ( ex.numParams() != 3 )
×
455
      return new BError( "SetUtf8String requires 3 parameters." );
×
456
    unsigned short offset, nullterm;
457
    const String* text;
458
    if ( ex.getParam( 0, offset ) && ex.getStringParam( 1, text ) && ex.getParam( 2, nullterm ) )
×
459
    {
460
      u16 textlen = static_cast<u16>( text->value().length() );
×
461
      if ( static_cast<u16>( offset + textlen + nullterm ) > buffer.size() )
×
462
      {
463
        if ( !SetSize( ( offset + textlen + nullterm ) ) )
×
464
        {
465
          return new BError( "Offset value out of range on a fixed length packet" );
×
466
        }
467
      }
468
      u8* bufptr = reinterpret_cast<u8*>( &buffer[offset] );
×
469
      const char* textptr = text->value().c_str();
×
470
      for ( u16 i = 0; i < textlen; i++ )
×
471
        bufptr[i] = textptr[i];
×
472

473
      if ( nullterm )
×
474
        bufptr[textlen] = 0;
×
475

476
      return new BLong( 1 );
×
477
    }
478
    break;
×
479
  }
480
  case MTH_SETUNICODESTRING:
×
481
  {
482
    if ( ex.numParams() != 3 )
×
483
      return new BError( "SetUnicodeString requires 3 parameters." );
×
484
    unsigned short offset, nullterm;
485
    const String* unitext;
486
    if ( ex.getParam( 0, offset ) && ex.getUnicodeStringParam( 1, unitext ) &&
×
487
         ex.getParam( 2, nullterm ) )
×
488
    {
489
      std::vector<u16> gwtext = unitext->toUTF16();
×
490
      if ( nullterm )
×
491
        gwtext.push_back( 0 );
×
492
      u16 bytelen = static_cast<u16>( gwtext.size() ) * 2;
×
493
      if ( static_cast<u16>( offset + bytelen ) > buffer.size() )
×
494
      {
495
        if ( !SetSize( ( offset + bytelen ) ) )
×
496
        {
497
          return new BError( "Offset value out of range on a fixed length packet" );
×
498
        }
499
      }
500
      for ( const auto& c : gwtext )
×
501
      {
502
        u16 fc = cfBEu16( c );
×
503
        std::memcpy( &buffer[offset], &fc, sizeof( fc ) );
×
504
        offset += 2;
×
505
      }
506

507
      return new BLong( 1 );
×
508
    }
×
509
    break;
×
510
  }
511
  case MTH_SETUNICODESTRINGFLIPPED:
×
512
  {
513
    if ( ex.numParams() != 3 )
×
514
      return new BError( "SetUnicodeStringFlipped requires 3 parameters." );
×
515
    unsigned short offset, nullterm;
516
    const String* unitext;
517
    if ( ex.getParam( 0, offset ) && ex.getUnicodeStringParam( 1, unitext ) &&
×
518
         ex.getParam( 2, nullterm ) )
×
519
    {
520
      std::vector<u16> gwtext = unitext->toUTF16();
×
521
      if ( nullterm )
×
522
        gwtext.push_back( 0 );
×
523
      u16 bytelen = static_cast<u16>( gwtext.size() ) * 2;
×
524

525
      if ( static_cast<u16>( offset + bytelen ) > buffer.size() )
×
526
      {
527
        if ( !SetSize( offset + bytelen ) )
×
528
        {
529
          return new BError( "Offset value out of range on a fixed length packet" );
×
530
          ;
531
        }
532
      }
533
      for ( const auto& c : gwtext )
×
534
      {
535
        std::memcpy( &buffer[offset], &c, sizeof( c ) );
×
536
        offset += 2;
×
537
      }
538
      return new BLong( 1 );
×
539
    }
×
540
    break;
×
541
  }
542
  case MTH_ASSIGN:
2✔
543
  {
544
    if ( ex.numParams() < 1 )
2✔
545
      return new BError( "Invalid parameter type" );
×
546

547
    BObjectImp* param0 = ex.getParamImp( 0, BObjectType::OTPacket );
2✔
548

549
    if ( !param0 )
2✔
550
      return new BError( "Invalid parameter type" );
×
551

552
    BPacket* other = static_cast<BPacket*>( param0 );
2✔
553
    is_variable_length = other->is_variable_length;
2✔
554
    buffer = other->buffer;
2✔
555
    return new BLong( 1 );
2✔
556
  }
557
  default:
×
558
    return nullptr;
×
559
  }
560
  return new BError( "Invalid parameter" );
×
561
}
562

563

564
BObjectImp* BPacket::call_polmethod( const char* methodname, UOExecutor& ex )
×
565
{
566
  ObjMethod* objmethod = getKnownObjMethod( methodname );
×
567
  if ( objmethod != nullptr )
×
568
    return this->call_polmethod_id( objmethod->id, ex );
×
NEW
569
  return nullptr;
×
570
}
571
BObjectImp* BPacket::copy() const
×
572
{
573
  return new BPacket( *this );
×
574
}
575
std::string BPacket::getStringRep() const
5✔
576
{
577
  OSTRINGSTREAM os;
5✔
578
  for ( auto itr = buffer.begin(); itr != buffer.end(); ++itr )
22✔
579
    os << std::setfill( '0' ) << std::setw( 2 ) << std::hex << static_cast<u16>( *itr );
17✔
580

581
  return OSTRINGSTREAM_STR( os );
10✔
582
}
5✔
583

584
bool BPacket::SetSize( u16 newsize )
3✔
585
{
586
  if ( !is_variable_length )
3✔
587
    return false;
1✔
588
  newsize = std::max( newsize, 3_u16 );
2✔
589
  buffer.resize( newsize );
2✔
590
  u16* sizeptr = reinterpret_cast<u16*>( &buffer[1] );
2✔
591
  *sizeptr = ctBEu16( newsize );
2✔
592
  return true;
2✔
593
}
594

595
BObjectImp* BPacket::SetSize( u16 newsize, bool /*giveReturn*/ )
×
596
{
597
  if ( !is_variable_length )
×
598
    return new BError( "Attempted to resize a fixed length packet" );
×
599
  unsigned short oldsize = static_cast<unsigned short>( buffer.size() );
×
600
  buffer.resize( newsize );
×
601
  u16* sizeptr = reinterpret_cast<u16*>( &buffer[1] );
×
602
  *sizeptr = ctBEu16( newsize );
×
603
  return new BLong( oldsize );
×
604
}
605
}  // namespace Pol::Core
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc