2 warnings from Solaris build log fixed

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@5637 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2000-01-24 17:04:44 +00:00
parent b97fa7cfd1
commit 069d0f27ef

View File

@@ -1798,50 +1798,50 @@ private:
wxSearchColor::wxSearchColor( void ) wxSearchColor::wxSearchColor( void )
{ {
this->size = 0; size = 0;
this->colors = (XColor*) NULL; colors = (XColor*) NULL;
this->color = (unsigned int *) NULL; color = (unsigned int *) NULL;
this->entry = (int*) NULL; entry = (int*) NULL;
this->bottom = 0; bottom = 0;
this->top = 0; top = 0;
} }
wxSearchColor::wxSearchColor( int size, XColor *colors ) wxSearchColor::wxSearchColor( int size_, XColor *colors_ )
{ {
int i; int i;
this->size = size; size = size_;
this->colors = colors; colors = colors_;
this->color = new unsigned int[size]; color = new unsigned int[size];
this->entry = new int [size]; entry = new int [size];
for (i = 0; i < this->size; i++ ) { for (i = 0; i < size; i++ ) {
this->entry[i] = -1; entry[i] = -1;
} }
this->bottom = this->top = ( size >> 1 ); bottom = top = ( size >> 1 );
} }
wxSearchColor::~wxSearchColor( void ) wxSearchColor::~wxSearchColor( void )
{ {
if ( this->color ) delete this->color; if ( color ) delete color;
if ( this->entry ) delete this->entry; if ( entry ) delete entry;
} }
int wxSearchColor::SearchColor( int r, int g, int b ) int wxSearchColor::SearchColor( int r, int g, int b )
{ {
unsigned int value = ( ( ( r * 256 ) + g ) * 256 ) + b; unsigned int value = ( ( ( r * 256 ) + g ) * 256 ) + b;
int begin = this->bottom; int begin = bottom;
int end = this->top; int end = top;
int middle; int middle;
while ( begin <= end ) { while ( begin <= end ) {
middle = ( begin + end ) >> 1; middle = ( begin + end ) >> 1;
if ( value == this->color[middle] ) { if ( value == color[middle] ) {
return( this->entry[middle] ); return( entry[middle] );
} else if ( value < this->color[middle] ) { } else if ( value < color[middle] ) {
end = middle - 1; end = middle - 1;
} else { } else {
begin = middle + 1; begin = middle + 1;
@@ -1865,47 +1865,47 @@ int wxSearchColor::AddColor( unsigned int value, int pos )
if (sum < max) { pixel = i; max = sum; } if (sum < max) { pixel = i; max = sum; }
} }
if ( this->entry[pos] < 0 ) { if ( entry[pos] < 0 ) {
this->color[pos] = value; color[pos] = value;
this->entry[pos] = pixel; entry[pos] = pixel;
} else if ( value < this->color[pos] ) { } else if ( value < color[pos] ) {
if ( this->bottom > 0 ) { if ( bottom > 0 ) {
for ( i = this->bottom; i < pos; i++ ) { for ( i = bottom; i < pos; i++ ) {
this->color[i-1] = this->color[i]; color[i-1] = color[i];
this->entry[i-1] = this->entry[i]; entry[i-1] = entry[i];
} }
this->bottom--; bottom--;
this->color[pos-1] = value; color[pos-1] = value;
this->entry[pos-1] = pixel; entry[pos-1] = pixel;
} else if ( this->top < this->size-1 ) { } else if ( top < size-1 ) {
for ( i = this->top; i >= pos; i-- ) { for ( i = top; i >= pos; i-- ) {
this->color[i+1] = this->color[i]; color[i+1] = color[i];
this->entry[i+1] = this->entry[i]; entry[i+1] = entry[i];
} }
this->top++; top++;
this->color[pos] = value; color[pos] = value;
this->entry[pos] = pixel; entry[pos] = pixel;
} }
} else { } else {
if ( this->top < this->size-1 ) { if ( top < size-1 ) {
for ( i = this->top; i > pos; i-- ) { for ( i = top; i > pos; i-- ) {
this->color[i+1] = this->color[i]; color[i+1] = color[i];
this->entry[i+1] = this->entry[i]; entry[i+1] = entry[i];
} }
this->top++; top++;
this->color[pos+1] = value; color[pos+1] = value;
this->entry[pos+1] = pixel; entry[pos+1] = pixel;
} else if ( this->bottom > 0 ) { } else if ( bottom > 0 ) {
for ( i = this->bottom; i < pos; i++ ) { for ( i = bottom; i < pos; i++ ) {
this->color[i-1] = this->color[i]; color[i-1] = color[i];
this->entry[i-1] = this->entry[i]; entry[i-1] = entry[i];
} }
this->bottom--; bottom--;
this->color[pos] = value; color[pos] = value;
this->entry[pos] = pixel; entry[pos] = pixel;
} }
} }