[PATCH] Remove potential reference count races
max at mtew.isa-geek.net
max at mtew.isa-geek.net
Sat Oct 27 20:59:29 CDT 2012
From: Max TenEyck Woodbury <max at mtew.isa-geek.net>
---
dlls/msvcp90/locale.c | 190 ++++++++++++++++++++++++------------------------
1 files changed, 95 insertions(+), 95 deletions(-)
diff --git a/dlls/msvcp90/locale.c b/dlls/msvcp90/locale.c
index 1a9e619..4601bcf 100644
--- a/dlls/msvcp90/locale.c
+++ b/dlls/msvcp90/locale.c
@@ -188,7 +188,7 @@ locale_facet* __thiscall locale_facet_vector_dtor(locale_facet *this, unsigned i
/* we have an array, with the number of elements stored before the first object */
INT_PTR i, *ptr = (INT_PTR *)this-1;
- for(i=*ptr-1; i>=0; i--)
+ for(i=*ptr-1; i>=0; --i)
locale_facet_dtor(this+i);
MSVCRT_operator_delete(ptr);
} else {
@@ -269,7 +269,7 @@ MSVCP_size_t __thiscall locale_id_operator_size_t(locale_id *this)
if(!this->id) {
_Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
- this->id = ++locale_id__Id_cnt;
+ this->id = InterlockedIncrement(&locale_id__Id_cnt);
_Lockit_dtor(&lock);
}
@@ -316,7 +316,7 @@ void __thiscall locale_facet__Incref(locale_facet *this)
TRACE("(%p)\n", this);
_Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
- this->refs++;
+ InterlockedIncrement(&this->refs);
_Lockit_dtor(&lock);
}
@@ -332,7 +332,7 @@ locale_facet* __thiscall locale_facet__Decref(locale_facet *this)
_Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
if(this->refs)
- this->refs--;
+ InterlockedDecrement(&this->refs);
ret = this->refs ? NULL : this;
_Lockit_dtor(&lock);
@@ -792,7 +792,7 @@ collate* __thiscall collate_char_vector_dtor(collate *this, unsigned int flags)
/* we have an array, with the number of elements stored before the first object */
INT_PTR i, *ptr = (INT_PTR *)this-1;
- for(i=*ptr-1; i>=0; i--)
+ for(i=*ptr-1; i>=0; --i)
collate_char_dtor(this+i);
MSVCRT_operator_delete(ptr);
} else {
@@ -882,7 +882,7 @@ LONG __thiscall collate_char_do_hash(const collate *this,
TRACE("(%p %p %p)\n", this, first, last);
- for(; first<last; first++)
+ for(; first<last; ++first)
ret = (ret<<8 | ret>>24) + *first;
return ret;
}
@@ -1025,7 +1025,7 @@ collate* __thiscall collate_wchar_vector_dtor(collate *this, unsigned int flags)
/* we have an array, with the number of elements stored before the first object */
INT_PTR i, *ptr = (INT_PTR *)this-1;
- for(i=*ptr-1; i>=0; i--)
+ for(i=*ptr-1; i>=0; --i)
collate_wchar_dtor(this+i);
MSVCRT_operator_delete(ptr);
} else {
@@ -1143,7 +1143,7 @@ LONG __thiscall collate_wchar_do_hash(const collate *this,
TRACE("(%p %p %p)\n", this, first, last);
- for(; first<last; first++)
+ for(; first<last; ++first)
ret = (ret<<8 | ret>>24) + *first;
return ret;
}
@@ -1225,7 +1225,7 @@ ctype_base* __thiscall ctype_base_vector_dtor(ctype_base *this, unsigned int fla
/* we have an array, with the number of elements stored before the first object */
INT_PTR i, *ptr = (INT_PTR *)this-1;
- for(i=*ptr-1; i>=0; i--)
+ for(i=*ptr-1; i>=0; --i)
ctype_base_dtor(this+i);
MSVCRT_operator_delete(ptr);
} else {
@@ -1351,7 +1351,7 @@ ctype_char* __thiscall ctype_char_vector_dtor(ctype_char *this, unsigned int fla
/* we have an array, with the number of elements stored before the first object */
INT_PTR i, *ptr = (INT_PTR *)this-1;
- for(i=*ptr-1; i>=0; i--)
+ for(i=*ptr-1; i>=0; --i)
ctype_char_dtor(this+i);
MSVCRT_operator_delete(ptr);
} else {
@@ -1614,7 +1614,7 @@ DEFINE_THISCALL_WRAPPER(ctype_char_do_tolower, 12)
const char* __thiscall ctype_char_do_tolower(const ctype_char *this, char *first, const char *last)
{
TRACE("(%p %p %p)\n", this, first, last);
- for(; first<last; first++)
+ for(; first<last; ++first)
*first = _Tolower(*first, &this->ctype);
return last;
}
@@ -1701,7 +1701,7 @@ const char* __thiscall ctype_char_do_toupper(const ctype_char *this,
char *first, const char *last)
{
TRACE("(%p %p %p)\n", this, first, last);
- for(; first<last; first++)
+ for(; first<last; ++first)
*first = _Toupper(*first, &this->ctype);
return last;
}
@@ -1739,7 +1739,7 @@ DEFINE_THISCALL_WRAPPER(ctype_char_is, 16)
const char* __thiscall ctype_char_is(const ctype_char *this, const char *first, const char *last, short *dest)
{
TRACE("(%p %p %p %p)\n", this, first, last, dest);
- for(; first<last; first++)
+ for(; first<last; ++first)
*dest++ = this->ctype.table[(unsigned char)*first];
return last;
}
@@ -1750,7 +1750,7 @@ DEFINE_THISCALL_WRAPPER(ctype_char_scan_is, 16)
const char* __thiscall ctype_char_scan_is(const ctype_char *this, short mask, const char *first, const char *last)
{
TRACE("(%p %x %p %p)\n", this, mask, first, last);
- for(; first<last; first++)
+ for(; first<last; ++first)
if(!ctype_char_is_ch(this, mask, *first))
break;
return first;
@@ -1762,7 +1762,7 @@ DEFINE_THISCALL_WRAPPER(ctype_char_scan_not, 16)
const char* __thiscall ctype_char_scan_not(const ctype_char *this, short mask, const char *first, const char *last)
{
TRACE("(%p %x %p %p)\n", this, mask, first, last);
- for(; first<last; first++)
+ for(; first<last; ++first)
if(ctype_char_is_ch(this, mask, *first))
break;
return first;
@@ -1925,7 +1925,7 @@ ctype_wchar* __thiscall ctype_wchar_vector_dtor(ctype_wchar *this, unsigned int
/* we have an array, with the number of elements stored before the first object */
INT_PTR i, *ptr = (INT_PTR *)this-1;
- for(i=*ptr-1; i>=0; i--)
+ for(i=*ptr-1; i>=0; --i)
ctype_wchar_dtor(this+i);
MSVCRT_operator_delete(ptr);
} else {
@@ -2007,7 +2007,7 @@ const wchar_t* __thiscall ctype_wchar_do_narrow(const ctype_wchar *this,
const wchar_t *first, const wchar_t *last, char dflt, char *dest)
{
TRACE("(%p %p %p %d %p)\n", this, first, last, dflt, dest);
- for(; first<last; first++)
+ for(; first<last; ++first)
*dest++ = ctype_wchar__Donarrow(this, *first, dflt);
return last;
}
@@ -2172,7 +2172,7 @@ const char* __thiscall ctype_wchar_do_widen(const ctype_wchar *this,
const char *first, const char *last, wchar_t *dest)
{
TRACE("(%p %p %p %p)\n", this, first, last, dest);
- for(; first<last; first++)
+ for(; first<last; ++first)
*dest++ = ctype_wchar__Dowiden(this, *first);
return last;
}
@@ -2354,7 +2354,7 @@ const wchar_t* __thiscall ctype_wchar_do_tolower(const ctype_wchar *this,
wchar_t *first, const wchar_t *last)
{
TRACE("(%p %p %p)\n", this, first, last);
- for(; first<last; first++)
+ for(; first<last; ++first)
*first = _Towlower(*first, &this->ctype);
return last;
}
@@ -2413,7 +2413,7 @@ const wchar_t* __thiscall ctype_wchar_do_toupper(const ctype_wchar *this,
wchar_t *first, const wchar_t *last)
{
TRACE("(%p %p %p)\n", this, first, last);
- for(; first<last; first++)
+ for(; first<last; ++first)
*first = _Towupper(*first, &this->ctype);
return last;
}
@@ -2521,7 +2521,7 @@ const wchar_t* __thiscall ctype_wchar_do_scan_is(const ctype_wchar *this,
short mask, const wchar_t *first, const wchar_t *last)
{
TRACE("(%p %d %p %p)\n", this, mask, first, last);
- for(; first<last; first++)
+ for(; first<last; ++first)
if(!ctype_wchar_is_ch(this, mask, *first))
break;
return first;
@@ -2551,7 +2551,7 @@ const wchar_t* __thiscall ctype_wchar_do_scan_not(const ctype_wchar *this,
short mask, const wchar_t *first, const wchar_t *last)
{
TRACE("(%p %x %p %p)\n", this, mask, first, last);
- for(; first<last; first++)
+ for(; first<last; ++first)
if(ctype_wchar_is_ch(this, mask, *first))
break;
return first;
@@ -2608,7 +2608,7 @@ codecvt_base* __thiscall codecvt_base_vector_dtor(codecvt_base *this, unsigned i
/* we have an array, with the number of elements stored before the first object */
INT_PTR i, *ptr = (INT_PTR *)this-1;
- for(i=*ptr-1; i>=0; i--)
+ for(i=*ptr-1; i>=0; --i)
codecvt_base_dtor(this+i);
MSVCRT_operator_delete(ptr);
} else {
@@ -2738,7 +2738,7 @@ codecvt_char* __thiscall codecvt_char_vector_dtor(codecvt_char *this, unsigned i
/* we have an array, with the number of elements stored before the first object */
INT_PTR i, *ptr = (INT_PTR *)this-1;
- for(i=*ptr-1; i>=0; i--)
+ for(i=*ptr-1; i>=0; --i)
codecvt_char_dtor(this+i);
MSVCRT_operator_delete(ptr);
} else {
@@ -3032,7 +3032,7 @@ codecvt_wchar* __thiscall codecvt_wchar_vector_dtor(codecvt_wchar *this, unsigne
/* we have an array, with the number of elements stored before the first object */
INT_PTR i, *ptr = (INT_PTR *)this-1;
- for(i=*ptr-1; i>=0; i--)
+ for(i=*ptr-1; i>=0; --i)
codecvt_wchar_dtor(this+i);
MSVCRT_operator_delete(ptr);
} else {
@@ -3213,12 +3213,12 @@ int __thiscall codecvt_wchar_do_in(const codecvt_wchar *this, int *state,
case -1:
return CODECVT_error;
case 2:
- (*from_next)++;
+ ++(*from_next);
/* fall through */
case 0:
case 1:
- (*from_next)++;
- (*to_next)++;
+ ++(*from_next);
+ ++(*to_next);
}
}
@@ -3272,7 +3272,7 @@ int __thiscall codecvt_wchar_do_out(const codecvt_wchar *this, int *state,
return CODECVT_partial;
}
- (*from_next)++;
+ ++(*from_next);
memcpy_s(*to_next, to_end-*to_next, buf, size);
(*to_next) += size;
}
@@ -3347,12 +3347,12 @@ int __thiscall codecvt_wchar_do_length(const codecvt_wchar *this, const int *sta
case -1:
return ret;
case 2:
- from++;
+ ++from;
/* fall through */
case 0:
case 1:
- from++;
- ret++;
+ ++from;
+ ++ret;
}
}
@@ -3502,7 +3502,7 @@ numpunct_char* __thiscall numpunct_char_vector_dtor(numpunct_char *this, unsigne
/* we have an array, with the number of elements stored before the first object */
INT_PTR i, *ptr = (INT_PTR *)this-1;
- for(i=*ptr-1; i>=0; i--)
+ for(i=*ptr-1; i>=0; --i)
numpunct_char_dtor(this+i);
MSVCRT_operator_delete(ptr);
} else {
@@ -3855,7 +3855,7 @@ numpunct_wchar* __thiscall numpunct_wchar_vector_dtor(numpunct_wchar *this, unsi
/* we have an array, with the number of elements stored before the first object */
INT_PTR i, *ptr = (INT_PTR *)this-1;
- for(i=*ptr-1; i>=0; i--)
+ for(i=*ptr-1; i>=0; --i)
numpunct_wchar_dtor(this+i);
MSVCRT_operator_delete(ptr);
} else {
@@ -4292,7 +4292,7 @@ num_get* __thiscall num_get_wchar_vector_dtor(num_get *this, unsigned int flags)
/* we have an array, with the number of elements stored before the first object */
INT_PTR i, *ptr = (INT_PTR *)this-1;
- for(i=*ptr-1; i>=0; i--)
+ for(i=*ptr-1; i>=0; --i)
num_get_wchar_dtor(this+i);
MSVCRT_operator_delete(ptr);
} else {
@@ -4417,7 +4417,7 @@ static int num_get__Getffld(const num_get *this, char *dest, istreambuf_iterator
TRACE("(%p %p %p %p)\n", dest, first, last, loc);
- for(i=0; i<10; i++)
+ for(i=0; i<10; ++i)
digits[i] = mb_to_wc('0'+i, &this->cvt);
digits[10] = 0;
@@ -4461,7 +4461,7 @@ static int num_get__Getffld(const num_get *this, char *dest, istreambuf_iterator
if(dest < num_end)
*dest++ = '0'+digits_pos-digits;
else
- exp++; /* too many digits, just multiply by 10 */
+ ++exp; /* too many digits, just multiply by 10 */
if(sep && groups_no<CHAR_MAX)
++groups_no;
}
@@ -4531,9 +4531,9 @@ static int num_get__Getffld(const num_get *this, char *dest, istreambuf_iterator
{
error = TRUE; /* trailing empty */
}else if(!cur_group) /* no groups, skip loop */
- cur_group--;
+ --cur_group;
- for(; cur_group>=0 && !error; cur_group--) {
+ for(; cur_group>=0 && !error; --cur_group) {
if(*grouping == CHAR_MAX) {
if(cur_group)
error = TRUE;
@@ -4598,9 +4598,9 @@ static int num_get__Getifld(const num_get *this, char *dest, istreambuf_iterator
TRACE("(%p %p %p %04x %p)\n", dest, first, last, fmtflags, loc);
- for(i=0; i<10; i++)
+ for(i=0; i<10; ++i)
digits[i] = mb_to_wc('0'+i, &this->cvt);
- for(i=0; i<6; i++) {
+ for(i=0; i<6; ++i) {
digits[10+i] = mb_to_wc('a'+i, &this->cvt);
digits[16+i] = mb_to_wc('A'+i, &this->cvt);
}
@@ -4691,9 +4691,9 @@ static int num_get__Getifld(const num_get *this, char *dest, istreambuf_iterator
error = TRUE; /* trailing empty */
found_zero = FALSE;
}else if(!cur_group) /* no groups, skip loop */
- cur_group--;
+ --cur_group;
- for(; cur_group>=0 && !error; cur_group--) {
+ for(; cur_group>=0 && !error; --cur_group) {
if(*grouping == CHAR_MAX) {
if(cur_group)
error = TRUE;
@@ -4703,7 +4703,7 @@ static int num_get__Getifld(const num_get *this, char *dest, istreambuf_iterator
error = TRUE;
break;
}else if(grouping[1]) {
- grouping++;
+ ++grouping;
}
}
@@ -5312,9 +5312,9 @@ static istreambuf_iterator_wchar* num_get_do_get_bool(const num_get *this,
pfalse = NULL;
if(pfalse)
- pfalse++;
+ ++pfalse;
if(ptrue)
- ptrue++;
+ ++ptrue;
if((!pfalse || !*pfalse) && (!ptrue || !*ptrue))
break;
@@ -5452,7 +5452,7 @@ num_get* __thiscall num_get_char_vector_dtor(num_get *this, unsigned int flags)
/* we have an array, with the number of elements stored before the first object */
INT_PTR i, *ptr = (INT_PTR *)this-1;
- for(i=*ptr-1; i>=0; i--)
+ for(i=*ptr-1; i>=0; --i)
num_get_char_dtor(this+i);
MSVCRT_operator_delete(ptr);
} else {
@@ -5574,7 +5574,7 @@ int __cdecl num_get_char__Getffld(const num_get *this, char *dest, istreambuf_it
if(dest < num_end)
*dest++ = first->val;
else
- exp++; /* too many digits, just multiply by 10 */
+ ++exp; /* too many digits, just multiply by 10 */
if(sep && groups_no<CHAR_MAX)
++groups_no;
}
@@ -5641,9 +5641,9 @@ int __cdecl num_get_char__Getffld(const num_get *this, char *dest, istreambuf_it
{
error = TRUE; /* trailing empty */
}else if(!cur_group) /* no groups, skip loop */
- cur_group--;
+ --cur_group;
- for(; cur_group>=0 && !error; cur_group--) {
+ for(; cur_group>=0 && !error; --cur_group) {
if(*grouping == CHAR_MAX) {
if(cur_group)
error = TRUE;
@@ -5653,7 +5653,7 @@ int __cdecl num_get_char__Getffld(const num_get *this, char *dest, istreambuf_it
error = TRUE;
break;
}else if(grouping[1]) {
- grouping++;
+ ++grouping;
}
}
MSVCP_basic_string_char_dtor(&grouping_bstr);
@@ -5782,9 +5782,9 @@ int __cdecl num_get_char__Getifld(const num_get *this, char *dest, istreambuf_it
error = TRUE; /* trailing empty */
found_zero = FALSE;
}else if(!cur_group) /* no groups, skip loop */
- cur_group--;
+ --cur_group;
- for(; cur_group>=0 && !error; cur_group--) {
+ for(; cur_group>=0 && !error; --cur_group) {
if(*grouping == CHAR_MAX) {
if(cur_group)
error = TRUE;
@@ -5794,7 +5794,7 @@ int __cdecl num_get_char__Getifld(const num_get *this, char *dest, istreambuf_it
error = TRUE;
break;
}else if(grouping[1]) {
- grouping++;
+ ++grouping;
}
}
@@ -6212,9 +6212,9 @@ istreambuf_iterator_char *__thiscall num_get_char_do_get_bool(const num_get *thi
pfalse = NULL;
if(pfalse)
- pfalse++;
+ ++pfalse;
if(ptrue)
- ptrue++;
+ ++ptrue;
if((!pfalse || !*pfalse) && (!ptrue || !*ptrue))
break;
@@ -6326,7 +6326,7 @@ num_put* __thiscall num_put_char_vector_dtor(num_put *this, unsigned int flags)
/* we have an array, with the number of elements stored before the first object */
INT_PTR i, *ptr = (INT_PTR *)this-1;
- for(i=*ptr-1; i>=0; i--)
+ for(i=*ptr-1; i>=0; --i)
num_put_char_dtor(this+i);
MSVCRT_operator_delete(ptr);
} else {
@@ -6397,7 +6397,7 @@ ostreambuf_iterator_char* __cdecl num_put_char__Put(const num_put *this, ostream
{
TRACE("(%p %p %p %ld)\n", this, ret, ptr, count);
- for(; count>0; count--)
+ for(; count>0; --count)
ostreambuf_iterator_char_put(&dest, *ptr++);
*ret = dest;
@@ -6411,7 +6411,7 @@ ostreambuf_iterator_char* __cdecl num_put_char__Putc(const num_put *this, ostrea
{
TRACE("(%p %p %p %ld)\n", this, ret, ptr, count);
- for(; count>0; count--)
+ for(; count>0; --count)
ostreambuf_iterator_char_put(&dest, *ptr++);
*ret = dest;
@@ -6434,7 +6434,7 @@ ostreambuf_iterator_char* __cdecl num_put_char__Rep(const num_put *this, ostream
{
TRACE("(%p %p %d %ld)\n", this, ret, c, count);
- for(; count>0; count--)
+ for(; count>0; --count)
ostreambuf_iterator_char_put(&dest, c);
*ret = dest;
@@ -6499,29 +6499,29 @@ static ostreambuf_iterator_char* num_put_char_fput(const num_put *this, ostreamb
TRACE("(%p %p %p %d %s %ld)\n", this, ret, base, fill, buf, count);
/* Change decimal point */
- for(p=buf; p<buf+count; p++) {
+ for(p=buf; p<buf+count; ++p) {
if(*p == sep) {
*p = numpunct_char_decimal_point(numpunct);
break;
}
}
- p--;
+ --p;
/* Add separators to number */
numpunct_char_grouping(numpunct, &grouping_bstr);
grouping = MSVCP_basic_string_char_c_str(&grouping_bstr);
sep = grouping[0] ? numpunct_char_thousands_sep(numpunct) : '\0';
- for(; p>buf && sep && grouping[cur_group]!=CHAR_MAX; p--) {
- group_size++;
+ for(; p>buf && sep && grouping[cur_group]!=CHAR_MAX; --p) {
+ ++group_size;
if(group_size == grouping[cur_group]) {
group_size = 0;
if(grouping[cur_group+1])
- cur_group++;
+ ++cur_group;
memmove(p+1, p, buf+count-p);
*p = sep;
- count++;
+ ++count;
}
}
MSVCP_basic_string_char_dtor(&grouping_bstr);
@@ -6535,7 +6535,7 @@ static ostreambuf_iterator_char* num_put_char_fput(const num_put *this, ostreamb
if((adjustfield & FMTFLAG_internal) && (buf[0]=='-' || buf[0]=='+')) {
num_put_char__Putc(this, &dest, dest, buf, 1);
- buf++;
+ ++buf;
}
if(adjustfield != FMTFLAG_left) {
num_put_char__Rep(this, ret, dest, fill, pad);
@@ -6595,16 +6595,16 @@ ostreambuf_iterator_char* __cdecl num_put_char__Iput(const num_put *this, ostrea
grouping = MSVCP_basic_string_char_c_str(&grouping_bstr);
sep = grouping[0] ? numpunct_char_thousands_sep(numpunct) : '\0';
- for(p=buf+count-1; p>buf && sep && grouping[cur_group]!=CHAR_MAX; p--) {
- group_size++;
+ for(p=buf+count-1; p>buf && sep && grouping[cur_group]!=CHAR_MAX; --p) {
+ ++group_size;
if(group_size == grouping[cur_group]) {
group_size = 0;
if(grouping[cur_group+1])
- cur_group++;
+ ++cur_group;
memmove(p+1, p, buf+count-p);
*p = sep;
- count++;
+ ++count;
}
}
MSVCP_basic_string_char_dtor(&grouping_bstr);
@@ -6618,7 +6618,7 @@ ostreambuf_iterator_char* __cdecl num_put_char__Iput(const num_put *this, ostrea
if((adjustfield & FMTFLAG_internal) && (buf[0]=='-' || buf[0]=='+')) {
num_put_char__Putc(this, &dest, dest, buf, 1);
- buf++;
+ ++buf;
}else if((adjustfield & FMTFLAG_internal) && (buf[1]=='x' || buf[1]=='X')) {
num_put_char__Putc(this, &dest, dest, buf, 2);
buf += 2;
@@ -6980,7 +6980,7 @@ num_put* __thiscall num_put_wchar_vector_dtor(num_put *this, unsigned int flags)
/* we have an array, with the number of elements stored before the first object */
INT_PTR i, *ptr = (INT_PTR *)this-1;
- for(i=*ptr-1; i>=0; i--)
+ for(i=*ptr-1; i>=0; --i)
num_put_wchar_dtor(this+i);
MSVCRT_operator_delete(ptr);
} else {
@@ -7105,7 +7105,7 @@ ostreambuf_iterator_wchar* __cdecl num_put_wchar__Put(const num_put *this, ostre
{
TRACE("(%p %p %s %ld)\n", this, ret, debugstr_wn(ptr, count), count);
- for(; count>0; count--)
+ for(; count>0; --count)
ostreambuf_iterator_wchar_put(&dest, *ptr++);
*ret = dest;
@@ -7124,7 +7124,7 @@ ostreambuf_iterator_wchar* __cdecl num_put_wchar__Putc(const num_put *this, ostr
TRACE("(%p %p %s %ld)\n", this, ret, debugstr_an(ptr, count), count);
- for(; count>0; count--) {
+ for(; count>0; --count) {
if(_Mbrtowc(&ch, ptr++, 1, &state, &this->cvt) == 1)
ostreambuf_iterator_wchar_put(&dest, ch);
}
@@ -7153,7 +7153,7 @@ ostreambuf_iterator_wchar* __cdecl num_put_wchar__Rep(const num_put *this, ostre
{
TRACE("(%p %p %d %ld)\n", this, ret, c, count);
- for(; count>0; count--)
+ for(; count>0; --count)
ostreambuf_iterator_wchar_put(&dest, c);
*ret = dest;
@@ -7231,27 +7231,27 @@ static ostreambuf_iterator_wchar* num_put__fput(const num_put *this, ostreambuf_
TRACE("(%p %p %p %d %s %ld)\n", this, ret, base, fill, buf, count);
- for(p=buf; p<buf+count; p++) {
+ for(p=buf; p<buf+count; ++p) {
if(*p == dec_point)
break;
}
- p--;
+ --p;
/* Add separators to number */
numpunct_wchar_grouping(numpunct, &grouping_bstr);
grouping = MSVCP_basic_string_char_c_str(&grouping_bstr);
sep = grouping[0] ? numpunct_wchar_thousands_sep(numpunct) : '\0';
- for(; p>buf && sep && grouping[cur_group]!=CHAR_MAX; p--) {
- group_size++;
+ for(; p>buf && sep && grouping[cur_group]!=CHAR_MAX; --p) {
+ ++group_size;
if(group_size == grouping[cur_group]) {
group_size = 0;
if(grouping[cur_group+1])
- cur_group++;
+ ++cur_group;
memmove(p+1, p, buf+count-p);
*p = '\0'; /* mark thousands separator positions */
- count++;
+ ++count;
}
}
MSVCP_basic_string_char_dtor(&grouping_bstr);
@@ -7265,14 +7265,14 @@ static ostreambuf_iterator_wchar* num_put__fput(const num_put *this, ostreambuf_
if((adjustfield & FMTFLAG_internal) && (buf[0]=='-' || buf[0]=='+')) {
num_put_wchar__Putc(this, &dest, dest, buf, 1);
- buf++;
+ ++buf;
}
if(adjustfield != FMTFLAG_left) {
num_put_wchar__Rep(this, ret, dest, fill, pad);
pad = 0;
}
- for(i=0; i<count; i++) {
+ for(i=0; i<count; ++i) {
if(buf[i] == dec_point)
num_put_wchar__Rep(this, &dest, dest, numpunct_wchar_decimal_point(numpunct), 1);
else if(!buf[i])
@@ -7335,16 +7335,16 @@ static ostreambuf_iterator_wchar* num_put__Iput(const num_put *this, ostreambuf_
grouping = MSVCP_basic_string_char_c_str(&grouping_bstr);
sep = grouping[0] ? numpunct_wchar_thousands_sep(numpunct) : '\0';
- for(p=buf+count-1; p>buf && sep && grouping[cur_group]!=CHAR_MAX; p--) {
- group_size++;
+ for(p=buf+count-1; p>buf && sep && grouping[cur_group]!=CHAR_MAX; --p) {
+ ++group_size;
if(group_size == grouping[cur_group]) {
group_size = 0;
if(grouping[cur_group+1])
- cur_group++;
+ ++cur_group;
memmove(p+1, p, buf+count-p);
*p = '\0'; /* mark thousands separator positions */
- count++;
+ ++count;
}
}
MSVCP_basic_string_char_dtor(&grouping_bstr);
@@ -7358,7 +7358,7 @@ static ostreambuf_iterator_wchar* num_put__Iput(const num_put *this, ostreambuf_
if((adjustfield & FMTFLAG_internal) && (buf[0]=='-' || buf[0]=='+')) {
num_put_wchar__Putc(this, &dest, dest, buf, 1);
- buf++;
+ ++buf;
}else if((adjustfield & FMTFLAG_internal) && (buf[1]=='x' || buf[1]=='X')) {
num_put_wchar__Putc(this, &dest, dest, buf, 2);
buf += 2;
@@ -7368,7 +7368,7 @@ static ostreambuf_iterator_wchar* num_put__Iput(const num_put *this, ostreambuf_
pad = 0;
}
- for(i=0; i<count; i++) {
+ for(i=0; i<count; ++i) {
if(!buf[i])
num_put_wchar__Rep(this, &dest, dest, sep, 1);
else
@@ -7833,7 +7833,7 @@ locale__Locimp* __thiscall locale__Locimp_copy_ctor(locale__Locimp *this, const
throw_exception(EXCEPTION_BAD_ALLOC, NULL);
return NULL;
}
- for(i=0; i<this->facet_cnt; i++)
+ for(i=0; i<this->facet_cnt; ++i)
{
this->facetvec[i] = copy->facetvec[i];
if(this->facetvec[i])
@@ -7862,7 +7862,7 @@ void __thiscall locale__Locimp_dtor(locale__Locimp *this)
TRACE("(%p)\n", this);
locale_facet_dtor(&this->facet);
- for(i=0; i<this->facet_cnt; i++)
+ for(i=0; i<this->facet_cnt; ++i)
if(this->facetvec[i] && locale_facet__Decref(this->facetvec[i]))
call_locale_facet_vector_dtor(this->facetvec[i], 1);
@@ -7885,7 +7885,7 @@ locale__Locimp* __thiscall locale__Locimp_vector_dtor(locale__Locimp *this, unsi
/* we have an array, with the number of elements stored before the first object */
INT_PTR i, *ptr = (INT_PTR *)this-1;
- for(i=*ptr-1; i>=0; i--)
+ for(i=*ptr-1; i>=0; --i)
locale__Locimp_dtor(this+i);
MSVCRT_operator_delete(ptr);
} else {
@@ -8282,7 +8282,7 @@ locale__Locimp* __cdecl locale__Init(void)
MSVCP_basic_string_char_ctor_cstr(&global_locale->name, "C");
locale__Locimp__Clocptr = global_locale;
- global_locale->facet.refs++;
+ InterlockedIncrement(&global_locale->facet.refs);
locale_ctor_locimp(&classic_locale, locale__Locimp__Clocptr);
_Lockit_dtor(&lock);
@@ -8537,7 +8537,7 @@ locale* __cdecl locale_global(locale *ret, const locale *loc)
global_locale = loc->ptr;
locale_facet__Incref(&global_locale->facet);
- for(i=LC_ALL+1; i<=LC_MAX; i++) {
+ for(i=LC_ALL+1; i<=LC_MAX; ++i) {
if((global_locale->catmask & (1<<(i-1))) == 0)
continue;
setlocale(i, MSVCP_basic_string_char_c_str(&global_locale->name));
--
1.7.7.6
More information about the wine-patches
mailing list