Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions vstring_internal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@
{
if( fr > to ) return;
target.resize( target.box->sl + ( to - fr ) + 1 );
for( int i = fr; i <= to; i++ )
for( VS_CHAR i = fr; i <= to; i++ )
target.box->s[target.box->sl++] = i;
target.box->s[target.box->sl] = 0;
}
Expand Down Expand Up @@ -838,7 +838,7 @@
{
if( fr > to ) return;
int sl = str_len( target );
for( int i = fr; i < to; i++ )
for( VS_CHAR i = fr; i < to; i++ )
target[sl++] = i;
target[sl] = 0;
}
Expand Down Expand Up @@ -1027,11 +1027,11 @@
rc = target[pos];
pos++;
}
else if ( rc != -1 && target[pos] == rc )
else if ( rc != -1 && (int)target[pos] == rc )
{
str_del( target, pos, 1 );
}
else if ( rc != -1 && target[pos] != rc )
else if ( rc != -1 && (int)target[pos] != rc )
{
rc = -1;
}
Expand Down Expand Up @@ -1985,7 +1985,7 @@
VS_CHAR* str_fix_path( VS_CHAR* s, int slashtype )
{
size_t sl = str_len( s );
if ( s[sl-1] != slashtype )
if ( s[sl-1] != (VS_CHAR)slashtype )
{
s[sl] = slashtype;
s[sl+1] = 0;
Expand All @@ -1996,7 +1996,7 @@ VS_CHAR* str_fix_path( VS_CHAR* s, int slashtype )
const VS_STRING_CLASS& str_fix_path( VS_STRING_CLASS &s, int slashtype )
{
size_t sl = str_len( s );
if ( s[sl-1] != slashtype )
if ( s[sl-1] != (VS_CHAR)slashtype )
str_add_ch( s, slashtype );
return s;
}
Expand Down
16 changes: 8 additions & 8 deletions vstrlib_internal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -564,12 +564,12 @@ int mem_string_search( const VS_CHAR *p, const VS_CHAR* d, const VS_CHAR* opt )
return;
}
// calc required mem size in chars (bytes?)
new_size = new_size / sizeof(VS_CHAR) + (new_size % sizeof(VS_CHAR) != 0);
new_size = new_size / sizeof(unsigned) + (new_size % sizeof(unsigned) != 0);
// pad mem size in blocks of VCHARSET_BLOCK_SIZE
new_size = new_size / VCHARSET_BLOCK_SIZE + (new_size % VCHARSET_BLOCK_SIZE != 0);
// calc size back to chars (bytes?)
new_size *= VCHARSET_BLOCK_SIZE;
VS_CHAR *new_data = new VS_CHAR[ new_size ];
unsigned *new_data = new unsigned[ new_size ];
memset( new_data, 0, new_size );
if ( _data )
{
Expand All @@ -583,12 +583,12 @@ int mem_string_search( const VS_CHAR *p, const VS_CHAR* d, const VS_CHAR* opt )

void VS_CHARSET_CLASS::push( VS_CHAR n, int val )
{
if ( n < 0 ) return;
if ( n >= _size * (int)sizeof(VS_CHAR) ) resize( n + 1 );
if ( n <= 0 ) return;
if ( (int)n >= _size * (int)sizeof(unsigned) ) resize( n + 1 );
if ( val )
_data[ n / sizeof(VS_CHAR) ] |= 1 << (n % sizeof(VS_CHAR));
_data[ n / sizeof(unsigned) ] |= 1 << (n % sizeof(unsigned));
else
_data[ n / sizeof(VS_CHAR) ] &= ~(1 << (n % sizeof(VS_CHAR)));
_data[ n / sizeof(unsigned) ] &= ~(1 << (n % sizeof(unsigned)));
}

void VS_CHARSET_CLASS::undef( VS_CHAR n )
Expand All @@ -603,8 +603,8 @@ int mem_string_search( const VS_CHAR *p, const VS_CHAR* d, const VS_CHAR* opt )

int VS_CHARSET_CLASS::in( VS_CHAR n )
{
if ( n < 0 || n >= _size * (int)sizeof(VS_CHAR) ) return 0;
return ( _data[ n / sizeof(VS_CHAR) ] & ( 1 << ( n % sizeof(VS_CHAR) ) ) ) != 0;
if ( n <= 0 || (int)n >= _size * (int)sizeof(unsigned) ) return 0;
return ( _data[ n / sizeof(unsigned) ] & ( 1 << ( n % sizeof(unsigned) ) ) ) != 0;
}


Expand Down
4 changes: 2 additions & 2 deletions vstrlib_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,8 @@ long file_string_search( const VS_CHAR *p, FILE *f, const VS_CHAR* opt

class VS_CHARSET_CLASS
{
VS_CHAR* _data;
int _size; // size (in bytes)
unsigned* _data;
int _size; // size (in bytes)

void resize( int new_size );

Expand Down
Loading