<commit_before>#ifndef _GAMEPACKET_H_
#define _GAMEPACKET_H_

#include "CommonNetwork.h"
#include "src/servers/Server_Common/Forwards.h"
#include <stdint.h>
#include <string.h>

namespace Core {
namespace Network {
namespace Packets {

class GamePacket {
public:
   GamePacket( uint16_t subType, uint16_t size, uint32_t id1, uint32_t id2, uint16_t type = 0x03 );
   GamePacket( char * pData, uint16_t size, bool bWriteStamp = true );

   GamePacket( const Packets::FFXIVARR_PACKET_RAW& packetData );

   GamePacket( void );
   ~GamePacket( void );

   uint16_t getSize() const
   {
      return m_segHdr.size;
   }

   uint16_t getType() const
   {
      return m_segHdr.type;
   }

   uint16_t getSubType() const
   {
      return m_subType;
   }

   template<class T>
   void setValAt( uint16_t pos, T value )
   {
      memcpy( reinterpret_cast< uint8_t* >( &m_dataBuf[0] + pos ), &value, sizeof( T ) );
   }

   template<class T>
   T getValAt( uint16_t pos ) const
   {
      return *reinterpret_cast< const T* >( &m_dataBuf[0] + pos );
   }

   void setBytesAt( uint16_t offset, uint8_t * bytes, uint16_t length )
   {
      memcpy( reinterpret_cast< uint8_t* >( &m_dataBuf[0] + offset ), bytes, length );
   }

   const char * getStringAt( uint16_t pos ) const
   {
      return reinterpret_cast< const char* >( &m_dataBuf[0] + pos );
   }

   void setStringAt( uint16_t pos, const std::string& str )
   {
      memcpy( reinterpret_cast< uint8_t* >( &m_dataBuf[0] + pos ), str.c_str(), str.length() );
   }

   uint8_t * getData()
   {<commit_msg>Tempoary bound check for GamePacket<commit_after>#ifndef _GAMEPACKET_H_
#define _GAMEPACKET_H_

#include "CommonNetwork.h"
#include "src/servers/Server_Common/Forwards.h"
#include <stdint.h>
#include <string.h>

namespace Core {
namespace Network {
namespace Packets {

class GamePacket {
public:
   GamePacket( uint16_t subType, uint16_t size, uint32_t id1, uint32_t id2, uint16_t type = 0x03 );
   GamePacket( char * pData, uint16_t size, bool bWriteStamp = true );

   GamePacket( const Packets::FFXIVARR_PACKET_RAW& packetData );

   GamePacket( void );
   ~GamePacket( void );

   uint16_t getSize() const
   {
      return m_segHdr.size;
   }

   uint16_t getType() const
   {
      return m_segHdr.type;
   }

   uint16_t getSubType() const
   {
      return m_subType;
   }

   template<class T>
   void setValAt( uint16_t pos, T value )
   {
      assert( m_segHdr.size > pos );
      memcpy( reinterpret_cast< uint8_t* >( &m_dataBuf[0] + pos ), &value, sizeof( T ) );
   }

   template<class T>
   T getValAt( uint16_t pos ) const
   {
      assert(m_segHdr.size > pos);
      return *reinterpret_cast< const T* >( &m_dataBuf[0] + pos );
   }

   void setBytesAt( uint16_t offset, uint8_t * bytes, uint16_t length )
   {
      assert(m_segHdr.size > offset);
      memcpy( reinterpret_cast< uint8_t* >( &m_dataBuf[0] + offset ), bytes, length );
   }

   const char * getStringAt( uint16_t pos ) const
   {
      assert(m_segHdr.size > pos);
      return reinterpret_cast< const char* >( &m_dataBuf[0] + pos );
   }

   void setStringAt( uint16_t pos, const std::string& str )
   {
      assert(m_segHdr.size > pos);
      memcpy( reinterpret_cast< uint8_t* >( &m_dataBuf[0] + pos ), str.c_str(), str.length() );
   }

   uint8_t * getData()
   {
{'fraction_non_alphanumeric': 0.11812688821752265, 'fraction_numerical': 0.027190332326283987, 'mean_word_length': 3.2286079182630907, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 26, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1207590', 'n_tokens_mistral': 1299, 'n_tokens_neox': 1243, 'n_words': 287}