Please enable JavaScript to use RhodeCode Enterprise
Commit Description:
Tidy code.
Commit Description:
Tidy code.
using System ;
using System.Runtime.InteropServices ;
using System.Text ;
namespace ImGuiNET
{
internal static unsafe class Util
{
internal const int StackAllocationSizeLimit = 2048 ;
public static string StringFromPtr ( byte * ptr )
{
int characters = 0 ;
while ( ptr [ characters ] != 0 )
{
characters ++;
}
return Encoding . UTF8 . GetString ( ptr , characters );
}
internal static bool AreStringsEqual ( byte * a , int aLength , byte * b )
{
for ( int i = 0 ; i < aLength ; i ++)
{
if ( a [ i ] != b [ i ]) { return false ; }
}
if ( b [ aLength ] != 0 ) { return false ; }
return true ;
}
internal static byte * Allocate ( int byteCount ) => ( byte *) Marshal . AllocHGlobal ( byteCount );
internal static void Free ( byte * ptr ) => Marshal . FreeHGlobal (( IntPtr ) ptr );
internal static int GetUtf8 ( string s , byte * utf8Bytes , int utf8ByteCount )
{
fixed ( char * utf16Ptr = s )
{
return Encoding . UTF8 . GetBytes ( utf16Ptr , s . Length , utf8Bytes , utf8ByteCount );
}
}
}
}
Site-wide shortcuts
/
Use quick search box
g h
Goto home page
g g
Goto my private gists page
g G
Goto my public gists page
n r
New repository page
n g
New gist page
Repositories
g s
Goto summary page
g c
Goto changelog page
g f
Goto files page
g F
Goto files page with file search activated
g p
Goto pull requests page
g o
Goto repository settings
g O
Goto repository permissions settings