Skip to content

Implement WideString #34

Open
Open

Description

@xPaw

CS:GO implements it like this:

// write
{
	int nLength = dat->m_wsValue ? V_wcslen( dat->m_wsValue ) : 0;
	buffer.PutShort( nLength );
	for( int k = 0; k < nLength; ++ k )
	{
		buffer.PutShort( ( unsigned short ) dat->m_wsValue[k] );
	}
	break;
}

// read
{
	int nLength = buffer.GetShort();

	dat->m_wsValue = new wchar_t[nLength + 1];

	for( int k = 0; k < nLength; ++ k )
	{
		dat->m_wsValue[k] = buffer.GetShort();
	}
	dat->m_wsValue[ nLength ] = 0;
	break;
}

Activity

  1. yaakov-h commented on Jan 19, 2021

    @yaakov-h
    Member

    So its just two bytes for length and then two bytes per char?

    Seems simple enough, particularly given that char in .NET is already two bytes wide 😈

  2. self-assigned this
    on Nov 7, 2023
  3. moved this to Not Started in Key Values 1on Jan 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions