Commit 38d1002c authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

msvcp60: Use char type for FROZEN macro.

Fixes clang warning: string.c:370:25: warning: implicit conversion from 'int' to 'char' changes value from 255 to -1 [-Wconstant-conversion]
parent 2e02cee9
...@@ -27,7 +27,8 @@ ...@@ -27,7 +27,8 @@
#include "wine/debug.h" #include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(msvcp); WINE_DEFAULT_DEBUG_CHANNEL(msvcp);
#define FROZEN 255 #define FROZEN '\xff'
#define FROZENW L'\xff'
/* _String_iterator<char> and _String_const_iterator<char> class */ /* _String_iterator<char> and _String_const_iterator<char> class */
typedef struct { typedef struct {
...@@ -282,7 +283,7 @@ void __thiscall basic_string_char__Tidy(basic_string_char *this, bool built) ...@@ -282,7 +283,7 @@ void __thiscall basic_string_char__Tidy(basic_string_char *this, bool built)
TRACE("(%p %d)\n", this, built); TRACE("(%p %d)\n", this, built);
if(!built || !this->ptr); if(!built || !this->ptr);
else if(!this->ptr[-1] || (unsigned char)this->ptr[-1]==FROZEN) else if(!this->ptr[-1] || this->ptr[-1]==FROZEN)
MSVCP_allocator_char_deallocate(NULL, this->ptr-1, this->res+2); MSVCP_allocator_char_deallocate(NULL, this->ptr-1, this->res+2);
else else
this->ptr[-1]--; this->ptr[-1]--;
...@@ -301,7 +302,7 @@ bool __thiscall basic_string_char__Grow(basic_string_char *this, size_t new_size ...@@ -301,7 +302,7 @@ bool __thiscall basic_string_char__Grow(basic_string_char *this, size_t new_size
else if(this->ptr) else if(this->ptr)
basic_string_char__Eos(this, 0); basic_string_char__Eos(this, 0);
} else if(this->res<new_size || trim || } else if(this->res<new_size || trim ||
(this->ptr && this->ptr[-1] && (unsigned char)this->ptr[-1]!=FROZEN)) { (this->ptr && this->ptr[-1] && this->ptr[-1]!=FROZEN)) {
size_t new_res = new_size, len = this->size; size_t new_res = new_size, len = this->size;
char *ptr; char *ptr;
...@@ -346,7 +347,7 @@ void __thiscall basic_string_char__Split(basic_string_char *this) ...@@ -346,7 +347,7 @@ void __thiscall basic_string_char__Split(basic_string_char *this)
TRACE("(%p)\n", this); TRACE("(%p)\n", this);
if(!this->ptr || !this->ptr[-1] || (unsigned char)this->ptr[-1]==FROZEN) if(!this->ptr || !this->ptr[-1] || this->ptr[-1]==FROZEN)
return; return;
ptr = this->ptr; ptr = this->ptr;
...@@ -1814,7 +1815,7 @@ void __thiscall basic_string_wchar__Tidy(basic_string_wchar *this, bool built) ...@@ -1814,7 +1815,7 @@ void __thiscall basic_string_wchar__Tidy(basic_string_wchar *this, bool built)
TRACE("(%p %d)\n", this, built); TRACE("(%p %d)\n", this, built);
if(!built || !this->ptr); if(!built || !this->ptr);
else if(!this->ptr[-1] || (unsigned short)this->ptr[-1]==FROZEN) else if(!this->ptr[-1] || this->ptr[-1]==FROZENW)
MSVCP_allocator_wchar_deallocate(NULL, this->ptr-1, this->res+2); MSVCP_allocator_wchar_deallocate(NULL, this->ptr-1, this->res+2);
else else
this->ptr[-1]--; this->ptr[-1]--;
...@@ -1833,7 +1834,7 @@ bool __thiscall basic_string_wchar__Grow(basic_string_wchar *this, size_t new_si ...@@ -1833,7 +1834,7 @@ bool __thiscall basic_string_wchar__Grow(basic_string_wchar *this, size_t new_si
else if(this->ptr) else if(this->ptr)
basic_string_wchar__Eos(this, 0); basic_string_wchar__Eos(this, 0);
} else if(this->res<new_size || trim || } else if(this->res<new_size || trim ||
(this->ptr && this->ptr[-1] && (unsigned short)this->ptr[-1]!=FROZEN)) { (this->ptr && this->ptr[-1] && this->ptr[-1]!=FROZENW)) {
size_t new_res = new_size, len = this->size; size_t new_res = new_size, len = this->size;
wchar_t *ptr; wchar_t *ptr;
...@@ -1878,7 +1879,7 @@ void __thiscall basic_string_wchar__Split(basic_string_wchar *this) ...@@ -1878,7 +1879,7 @@ void __thiscall basic_string_wchar__Split(basic_string_wchar *this)
TRACE("(%p)\n", this); TRACE("(%p)\n", this);
if(!this->ptr || !this->ptr[-1] || (unsigned short)this->ptr[-1]==FROZEN) if(!this->ptr || !this->ptr[-1] || this->ptr[-1]==FROZENW)
return; return;
ptr = this->ptr; ptr = this->ptr;
...@@ -1899,7 +1900,7 @@ void __thiscall basic_string_wchar__Freeze(basic_string_wchar *this) ...@@ -1899,7 +1900,7 @@ void __thiscall basic_string_wchar__Freeze(basic_string_wchar *this)
TRACE("(%p)\n", this); TRACE("(%p)\n", this);
basic_string_wchar__Split(this); basic_string_wchar__Split(this);
if(this->ptr) if(this->ptr)
this->ptr[-1] = FROZEN; this->ptr[-1] = FROZENW;
} }
/* ?_Copy@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@AAEXI@Z */ /* ?_Copy@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@AAEXI@Z */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment