Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2010-06-01 18:51:47 +0400
committerCorinna Vinschen <corinna@vinschen.de>2010-06-01 18:51:47 +0400
commitded1f66c2d5c25cc28333b9f0568c487b7d242ff (patch)
treec41faa7105f096c8eda9e8ac133095c15f3c7bc1 /winsup/cygwin/nlsfuncs.cc
parent80a10a3972bea3e13a8134ff992d1bb1063ef6e2 (diff)
* exceptions.cc (open_stackdumpfile): Correctly append .stackdump
suffix. * nlsfuncs.cc (rebase_locale_buf): Reorder arguments. Accommodate throughout. Add pointer to end of buffer and avoid changing pointers not pointing into the buffer.
Diffstat (limited to 'winsup/cygwin/nlsfuncs.cc')
-rw-r--r--winsup/cygwin/nlsfuncs.cc30
1 files changed, 15 insertions, 15 deletions
diff --git a/winsup/cygwin/nlsfuncs.cc b/winsup/cygwin/nlsfuncs.cc
index e67814747..e1adee49e 100644
--- a/winsup/cygwin/nlsfuncs.cc
+++ b/winsup/cygwin/nlsfuncs.cc
@@ -335,13 +335,13 @@ locale_cmp (const void *a, const void *b)
arrays. What we do here is just treat the lc_foo pointers as char ** and
rebase all char * pointers within, up to the given size of the structure. */
static void
-rebase_locale_buf (const void *ptrv, const char *newbase, const char *oldbase,
- const void *ptrvend)
+rebase_locale_buf (const void *ptrv, const void *ptrvend, const char *newbase,
+ const char *oldbase, const char *oldend)
{
- const char **ptrs = (const char **) ptrv;
const char **ptrsend = (const char **) ptrvend;
- while (ptrs < ptrsend)
- *ptrs++ += newbase - oldbase;
+ for (const char **ptrs = (const char **) ptrv; ptrs < ptrsend; ++ptrs)
+ if (*ptrs >= oldbase && *ptrs < oldend)
+ *ptrs += newbase - oldbase;
}
static wchar_t *
@@ -686,8 +686,8 @@ __set_lc_time_from_win (const char *name,
else
{
if (tmp != new_lc_time_buf)
- rebase_locale_buf (_time_locale, tmp, new_lc_time_buf,
- _time_locale + 1);
+ rebase_locale_buf (_time_locale, _time_locale + 1, tmp,
+ new_lc_time_buf, lc_time_ptr);
lc_time_ptr = tmp + (lc_time_ptr - new_lc_time_buf);
new_lc_time_buf = tmp;
lc_time_end = new_lc_time_buf + len;
@@ -748,8 +748,8 @@ __set_lc_time_from_win (const char *name,
return -1;
}
if (tmp != new_lc_time_buf)
- rebase_locale_buf (_time_locale, tmp, new_lc_time_buf,
- _time_locale + 1);
+ rebase_locale_buf (_time_locale, _time_locale + 1, tmp,
+ new_lc_time_buf, lc_time_ptr);
if (*lc_time_buf)
free (*lc_time_buf);
*lc_time_buf = tmp;
@@ -823,8 +823,8 @@ __set_lc_ctype_from_win (const char *name,
return -1;
}
if (tmp != new_lc_ctype_buf)
- rebase_locale_buf (_ctype_locale, tmp, new_lc_ctype_buf,
- _ctype_locale + 1);
+ rebase_locale_buf (_ctype_locale, _ctype_locale + 1, tmp,
+ new_lc_ctype_buf, lc_ctype_ptr);
if (*lc_ctype_buf)
free (*lc_ctype_buf);
*lc_ctype_buf = tmp;
@@ -883,8 +883,8 @@ __set_lc_numeric_from_win (const char *name,
return -1;
}
if (tmp != new_lc_numeric_buf)
- rebase_locale_buf (_numeric_locale, tmp, new_lc_numeric_buf,
- _numeric_locale + 1);
+ rebase_locale_buf (_numeric_locale, _numeric_locale + 1, tmp,
+ new_lc_numeric_buf, lc_numeric_ptr);
if (*lc_numeric_buf)
free (*lc_numeric_buf);
*lc_numeric_buf = tmp;
@@ -1010,8 +1010,8 @@ __set_lc_monetary_from_win (const char *name,
return -1;
}
if (tmp != new_lc_monetary_buf)
- rebase_locale_buf (_monetary_locale, tmp, new_lc_monetary_buf,
- _monetary_locale + 1);
+ rebase_locale_buf (_monetary_locale, _monetary_locale + 1, tmp,
+ new_lc_monetary_buf, lc_monetary_ptr);
if (*lc_monetary_buf)
free (*lc_monetary_buf);
*lc_monetary_buf = tmp;