You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stdcxx.apache.org by se...@apache.org on 2006/06/14 00:50:19 UTC
svn commit: r414001 - in /incubator/stdcxx/trunk: include/loc/_localedef.h
src/punct.cpp src/time_put.cpp
Author: sebor
Date: Tue Jun 13 15:50:19 2006
New Revision: 414001
URL: http://svn.apache.org/viewvc?rev=414001&view=rev
Log:
2006-06-13 Martin Sebor <se...@roguewave.com>
STDCXX-200
* _localedef.h (__rw_time_t): Changed function argument types
to silence Sun C++ 5.8 64-bit conversion/truncation warnings.
* punct.cpp (__rw_get_numpunct, __rw_get_moneypunct): Explicitly
cast wide expressions to the (narrower) destination type in order
to silence Sun C++ 5.8 64-bit truncation warnings.
* time_put.cpp (__rw_get_timepunct, __rw_get_zone): Same.
Modified:
incubator/stdcxx/trunk/include/loc/_localedef.h
incubator/stdcxx/trunk/src/punct.cpp
incubator/stdcxx/trunk/src/time_put.cpp
Modified: incubator/stdcxx/trunk/include/loc/_localedef.h
URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/include/loc/_localedef.h?rev=414001&r1=414000&r2=414001&view=diff
==============================================================================
--- incubator/stdcxx/trunk/include/loc/_localedef.h (original)
+++ incubator/stdcxx/trunk/include/loc/_localedef.h Tue Jun 13 15:50:19 2006
@@ -2,20 +2,26 @@
*
* _localedef.h
*
- * $Id: //stdlib/dev/include/loc/_localedef.h#74 $
+ * $Id$
*
***************************************************************************
*
- * Copyright (c) 1994-2005 Quovadx, Inc., acting through its Rogue Wave
- * Software division. Licensed under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the
- * License. You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0. Unless required by
- * applicable law or agreed to in writing, software distributed under
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
- * CONDITIONS OF ANY KIND, either express or implied. See the License
- * for the specific language governing permissions and limitations under
- * the License.
+ * Copyright 2005-2006 The Apache Software Foundation or its licensors,
+ * as applicable.
+ *
+ * Copyright 2001-2006 Rogue Wave Software.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*
**************************************************************************/
@@ -238,23 +244,26 @@
// get the offset of a table number `tabno'
_RWSTD_UINT32_T get_n_tab_off (_RWSTD_UINT32_T tabno) const {
- return sizeof (_RWSTD_UINT32_T) * (*(const _RWSTD_UINT32_T*)(
- (_RWSTD_SIZE_T)((const char*)this + sizeof *this
+ return (_RWSTD_UINT32_T)
+ (sizeof (_RWSTD_UINT32_T) * (*(const _RWSTD_UINT32_T*)(
+ (_RWSTD_SIZE_T)((const char*)this + sizeof *this
+ n_char_off_tab_off
- + (tabno * sizeof (_RWSTD_UINT32_T)))));
+ + (tabno * sizeof (_RWSTD_UINT32_T))))));
}
_RWSTD_UINT32_T get_n_ce_tab_off (_RWSTD_UINT32_T tabno) const {
- return sizeof (_RWSTD_UINT32_T) * (*(const _RWSTD_UINT32_T*)(
- (_RWSTD_SIZE_T)((const char*)this + sizeof *this
+ return (_RWSTD_UINT32_T)
+ (sizeof (_RWSTD_UINT32_T) * (*(const _RWSTD_UINT32_T*)(
+ (_RWSTD_SIZE_T)((const char*)this + sizeof *this
+ n_ce_off_tab_off
- + (tabno * sizeof (_RWSTD_UINT32_T)))));
+ + (tabno * sizeof (_RWSTD_UINT32_T))))));
}
_RWSTD_UINT32_T get_w_ce_tab_off (_RWSTD_UINT32_T tabno) const {
- return sizeof (_RWSTD_UINT32_T) * (*(const _RWSTD_UINT32_T*)(
- (_RWSTD_SIZE_T)((const char*)this + sizeof *this
+ return (_RWSTD_UINT32_T)
+ (sizeof (_RWSTD_UINT32_T) * (*(const _RWSTD_UINT32_T*)(
+ (_RWSTD_SIZE_T)((const char*)this + sizeof *this
+ w_ce_off_tab_off
- + (tabno * sizeof (_RWSTD_UINT32_T)))));
+ + (tabno * sizeof (_RWSTD_UINT32_T))))));
}
unsigned char get_first_char_in_n_tab (_RWSTD_UINT32_T tabno) const {
@@ -302,10 +311,11 @@
}
_RWSTD_UINT32_T get_w_tab_off (_RWSTD_UINT32_T tabno) const {
- return sizeof (_RWSTD_UINT32_T) * (*(const _RWSTD_UINT32_T*)(
- (_RWSTD_SIZE_T)((const char*)this + sizeof *this
+ return (_RWSTD_UINT32_T)
+ (sizeof (_RWSTD_UINT32_T) * (*(const _RWSTD_UINT32_T*)(
+ (_RWSTD_SIZE_T)((const char*)this + sizeof *this
+ w_char_off_tab_off
- + (tabno * sizeof (_RWSTD_UINT32_T)))));
+ + (tabno * sizeof (_RWSTD_UINT32_T))))));
}
unsigned char get_first_char_in_w_tab (_RWSTD_UINT32_T tabno) const {
@@ -550,28 +560,28 @@
_RWSTD_UINT32_T time_ext_off; // extended time data offset
// %a: abbreviated weekday name [tm_wday]
- const void* abday (unsigned idx, bool wide) const {
+ const void* abday (_RWSTD_SIZE_T idx, bool wide) const {
return _RWSTD_CHAR_ARRAY (abday_off [wide][idx]);
}
// %A: full weekday name [tm_wday]
- const void* day (unsigned idx, bool wide) const {
+ const void* day (_RWSTD_SIZE_T idx, bool wide) const {
return _RWSTD_CHAR_ARRAY (day_off [wide][idx]);
}
// %b: abbreviated month name [tm_mon]
- const void* abmon (unsigned idx, bool wide) const {
+ const void* abmon (_RWSTD_SIZE_T idx, bool wide) const {
return _RWSTD_CHAR_ARRAY (abmon_off [wide][idx]);
}
// %B: full month name [tm_mon]
- const void* mon (unsigned idx, bool wide) const {
+ const void* mon (_RWSTD_SIZE_T idx, bool wide) const {
return _RWSTD_CHAR_ARRAY (mon_off [wide][idx]);
}
// %p: the locale's equivalent of the AM/PM designations
// associated with a 12-hour clock [tm_hour]
- const void* am_pm (unsigned idx, bool wide) const {
+ const void* am_pm (_RWSTD_SIZE_T idx, bool wide) const {
return _RWSTD_CHAR_ARRAY (am_pm_off [wide][idx]);
}
@@ -651,7 +661,7 @@
}
// number of alternative digits
- _RWSTD_SIZE_T alt_digits_count () const {
+ _RWSTD_UINT32_T alt_digits_count () const {
return num_alt_digits;
}
@@ -809,9 +819,9 @@
// with bit 31 set if the the range [`from', `from_end') forms an incomplete
// multibyte character (i.e., if it's an initial subsequence of one)
static inline
-unsigned __rw_mbtowco (const unsigned int *cvtbl,
- const char *&from,
- const char *from_end)
+unsigned __rw_mbtowco (const unsigned *cvtbl,
+ const char *&from,
+ const char *from_end)
{
typedef unsigned char _UChar;
Modified: incubator/stdcxx/trunk/src/punct.cpp
URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/src/punct.cpp?rev=414001&r1=414000&r2=414001&view=diff
==============================================================================
--- incubator/stdcxx/trunk/src/punct.cpp (original)
+++ incubator/stdcxx/trunk/src/punct.cpp Tue Jun 13 15:50:19 2006
@@ -2,20 +2,26 @@
*
* punct.cpp
*
- * $Id: //stdlib/dev/source/stdlib/punct.cpp#46 $
+ * $Id$
*
***************************************************************************
*
- * Copyright (c) 1994-2005 Quovadx, Inc., acting through its Rogue Wave
- * Software division. Licensed under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the
- * License. You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0. Unless required by
- * applicable law or agreed to in writing, software distributed under
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
- * CONDITIONS OF ANY KIND, either express or implied. See the License
- * for the specific language governing permissions and limitations under
- * the License.
+ * Copyright 2005-2006 The Apache Software Foundation or its licensors,
+ * as applicable.
+ *
+ * Copyright 2001-2006 Rogue Wave Software.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*
**************************************************************************/
@@ -167,7 +173,7 @@
// compute offsets into the varaiable size structure
pun->decimal_point_off [winx] = 0;
- pun->thousands_sep_off [winx] = pun->decimal_point_off [winx] + dpsz;
+ pun->thousands_sep_off [winx] = pun->decimal_point_off [winx] + int (dpsz);
// point widen to a wrapper for mbstowcs() for wchar_t or memcpy otherwise
void (*widen)(void*, const void*, _RWSTD_SIZE_T) =
@@ -180,12 +186,12 @@
widen (s + pun->thousands_sep_off [winx], ts, tssz);
// set the offset of the extended punctuation data
- pun->punct_ext_off = pun->thousands_sep_off [winx] + tssz;
+ pun->punct_ext_off = pun->thousands_sep_off [winx] + int (tssz);
// adjust alignment
- if (pun->punct_ext_off % sizeof (_RWSTD_SIZE_T))
- pun->punct_ext_off +=
- sizeof (_RWSTD_SIZE_T) - pun->punct_ext_off % sizeof(_RWSTD_SIZE_T);
+ const _RWSTD_SIZE_T misalign = pun->punct_ext_off % sizeof (_RWSTD_SIZE_T);
+ if (misalign)
+ pun->punct_ext_off += int (sizeof (_RWSTD_SIZE_T) - misalign);
s = _RWSTD_REINTERPRET_CAST (char*, pun + 1) + pun->punct_ext_off;
@@ -197,7 +203,7 @@
memset (num, ~0, sizeof *num);
num->truename_off [winx] = 0;
- num->falsename_off [winx] = num->truename_off [winx] + tnsz;
+ num->falsename_off [winx] = num->truename_off [winx] + int (tnsz);
widen (s + num->truename_off [winx], "true", tnsz);
widen (s + num->falsename_off [winx], "false", fnsz);
@@ -347,7 +353,7 @@
// compute offsets into the varaiable size structure
pun->decimal_point_off [winx] = 0;
- pun->thousands_sep_off [winx] = pun->decimal_point_off [winx] + dpsz;
+ pun->thousands_sep_off [winx] = pun->decimal_point_off [winx] + int (dpsz);
// point widen to a wrapper for mbstowcs() for wchar_t or memcpy otherwise
void (*widen)(void*, const void*, _RWSTD_SIZE_T) =
@@ -360,12 +366,12 @@
widen (s + pun->thousands_sep_off [winx], pconv->mon_thousands_sep, tssz);
// set the offset of the extended punctuation data
- pun->punct_ext_off = pun->thousands_sep_off [winx] + tssz;
+ pun->punct_ext_off = pun->thousands_sep_off [winx] + int (tssz);
// adjust alignment
- if (pun->punct_ext_off % sizeof (_RWSTD_SIZE_T))
- pun->punct_ext_off +=
- sizeof (_RWSTD_SIZE_T) - pun->punct_ext_off % sizeof(_RWSTD_SIZE_T);
+ const _RWSTD_SIZE_T misalign = pun->punct_ext_off % sizeof (_RWSTD_SIZE_T);
+ if (misalign)
+ pun->punct_ext_off += int (sizeof (_RWSTD_SIZE_T) - misalign);
s = _RWSTD_REINTERPRET_CAST (char*, pun + 1) + pun->punct_ext_off;
@@ -377,12 +383,14 @@
::memset (mon, ~0, sizeof *mon);
mon->positive_sign_off [winx] = 0;
- mon->negative_sign_off [winx] = mon->positive_sign_off [winx] + pssz;
+ mon->negative_sign_off [winx] = mon->positive_sign_off [winx] + int (pssz);
widen (s + mon->positive_sign_off [winx], pconv->positive_sign, pssz);
widen (s + mon->negative_sign_off [winx], pconv->negative_sign, nssz);
- mon->curr_symbol_off [intl][winx] = mon->negative_sign_off [winx] + nssz;
+ mon->curr_symbol_off [intl][winx] =
+ mon->negative_sign_off [winx] + int (nssz);
+
widen (s + mon->curr_symbol_off [intl][winx], cs, cssz);
pun->grouping_off =
Modified: incubator/stdcxx/trunk/src/time_put.cpp
URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/src/time_put.cpp?rev=414001&r1=414000&r2=414001&view=diff
==============================================================================
--- incubator/stdcxx/trunk/src/time_put.cpp (original)
+++ incubator/stdcxx/trunk/src/time_put.cpp Tue Jun 13 15:50:19 2006
@@ -6,16 +6,22 @@
*
***************************************************************************
*
- * Copyright (c) 1994-2005 Quovadx, Inc., acting through its Rogue Wave
- * Software division. Licensed under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the
- * License. You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0. Unless required by
- * applicable law or agreed to in writing, software distributed under
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
- * CONDITIONS OF ANY KIND, either express or implied. See the License
- * for the specific language governing permissions and limitations under
- * the License.
+ * Copyright 2005-2006 The Apache Software Foundation or its licensors,
+ * as applicable.
+ *
+ * Copyright 2001-2006 Rogue Wave Software.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*
**************************************************************************/
@@ -602,8 +608,9 @@
// copy string to the allocated buffer and set its offset
memcpy (pbuf + off, str, size);
- pmem [nl_items [i].moff [0]] = off;
- off += size;
+ pmem [nl_items [i].moff [0]] =
+ _RWSTD_STATIC_CAST (_RWSTD_UINT32_T, off);
+ off += size;
#ifndef _RWSTD_NO_WCHAR_T
@@ -627,8 +634,9 @@
size += 1;
}
- pmem [nl_items [i].moff [1]] = off;
- off += size * sizeof (wchar_t);
+ pmem [nl_items [i].moff [1]] =
+ _RWSTD_STATIC_CAST (_RWSTD_UINT32_T, off);
+ off += size * sizeof (wchar_t);
#endif // _RWSTD_NO_WCHAR_T
@@ -2019,7 +2027,7 @@
// tzet() sets timezone to the difference, in seconds, between
// Coordinated Universal Time (UTC) and local standard time
- tpd.val = timezone / 60;
+ tpd.val = _RWSTD_STATIC_CAST (int, timezone / 60);
#else // if defined (_RWSTD_NO_TIMEZONE)
@@ -2657,12 +2665,12 @@
_RWSTD_ASSERT (0 != ptime);
- const _RWSTD_UINT32_T n = ptime->alt_digits_count ();
+ const _RWSTD_UINT32_T ndigits = ptime->alt_digits_count ();
- if (tpd.altval >= 0 && tpd.altval < int (n)) {
+ const _RWSTD_UINT32_T altval =
+ _RWSTD_STATIC_CAST (_RWSTD_UINT32_T, tpd.altval);
- const _RWSTD_SIZE_T altval =
- _RWSTD_STATIC_CAST (_RWSTD_SIZE_T, tpd.altval);
+ if (altval < ndigits) {
// format using alternative numeric symbols
const char* digit =