<commit_before>#include "StdAfx.h"
#include "xDeviceStream.h"

namespace Streams
{
xDeviceStream::xDeviceStream( TCHAR* DevicePath )
{
    // Set our variables
    _Length = 0;
    _Endian = Big;
    IsClosed = false;
#ifdef _WIN32
    memset(&Offset, 0, sizeof(OVERLAPPED));
#endif
    memset(&LastReadData, 0, 0x200);
    LastReadOffset = -1;
    UserOffset = 0;
    Offset = 0;

#ifdef _WIN32
    // Attempt to get a handle to the device
    DeviceHandle = CreateFile(
                DevicePath,							// File name (device path)
                GENERIC_READ | GENERIC_WRITE,		// Read/write access
                FILE_SHARE_READ | FILE_SHARE_WRITE,	// Read/write share
                NULL,								// Not used
                OPEN_EXISTING,						// Open the existing device -- fails if it's fucked
                FILE_FLAG_NO_BUFFERING | FILE_FLAG_WRITE_THROUGH | FILE_ATTRIBUTE_DEVICE,	// Flags and attributes
                NULL);								// Ignored

    if (DeviceHandle == INVALID_HANDLE_VALUE)
    {
        throw xException("Could not open HANDLE for device");
    }<commit_msg>xDeviceStream: fix Windows #else compile error<commit_after>#include "StdAfx.h"
#include "xDeviceStream.h"

namespace Streams
{
xDeviceStream::xDeviceStream( TCHAR* DevicePath )
{
    // Set our variables
    _Length = 0;
    _Endian = Big;
    IsClosed = false;
#ifdef _WIN32
    memset(&Offset, 0, sizeof(OVERLAPPED));
#else
    memset(&LastReadData, 0, 0x200);
    LastReadOffset = -1;
    UserOffset = 0;
    Offset = 0;
#endif

#ifdef _WIN32
    // Attempt to get a handle to the device
    DeviceHandle = CreateFile(
                DevicePath,							// File name (device path)
                GENERIC_READ | GENERIC_WRITE,		// Read/write access
                FILE_SHARE_READ | FILE_SHARE_WRITE,	// Read/write share
                NULL,								// Not used
                OPEN_EXISTING,						// Open the existing device -- fails if it's fucked
                FILE_FLAG_NO_BUFFERING | FILE_FLAG_WRITE_THROUGH | FILE_ATTRIBUTE_DEVICE,	// Flags and attributes
                NULL);								// Ignored

    if (DeviceHandle == INVALID_HANDLE_VALUE)
    {
        throw xException("Could not open HANDLE for device");
    }
{'fraction_non_alphanumeric': 0.08976093820478123, 'fraction_numerical': 0.012629679747406405, 'mean_word_length': 2.19136690647482, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '7555885', 'n_tokens_mistral': 771, 'n_tokens_neox': 675, 'n_words': 182}