Changeset 1132 for to-imperative/trunk/library/Convert/bytes_to_chars.cc
- Timestamp:
- Aug 8, 2003, 6:04:12 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
to-imperative/trunk/library/Convert/bytes_to_chars.cc
r1110 r1132 18 18 19 19 RF_FUNC (Bytes_m_To_m_Chars, (RF_ARG e_Int), (RF_RES e_Res)) 20 #if 021 e_Res = Expr(e_Int.get_len(), 0);22 23 Term *p = e_Int.get_first();24 Term *r = e_Res.get_first();25 26 for (; p < e_Int.get_last(); p++, r++) {27 if (p->get_type() == type_int) {28 RF_LIB_ERROR("Invalid argument");29 }30 else31 if (p->get_type() == type_short_int) {32 intptr_t t = ((ShortInt*)p)->to_int();33 if (t < 0 || t > WCHAR_MAX)34 RF_LIB_ERROR("Invalid argument");35 else36 *r = Char::to_chars(t);37 }38 else39 RF_LIB_ERROR("Invalid argument");40 }41 #endif42 20 43 21 Term* p = e_Int.get_first(); 44 22 for (; p < e_Int.get_last(); p++) { 45 23 if (p->get_type() == type_int32) { 46 intptr_t t = ((Int32*)p)->to_int();24 intptr_t t = static_cast<Int32*>(p)->to_int(); 47 25 if (t < 0 || t > WCHAR_MAX) 48 26 RF_LIB_ERROR("Invalid argument"); 49 27 } 28 else 29 if (p->get_type() == type_int) { 30 Integer* P = static_cast<Integer*>(p); 31 intptr_t l = P->to_int(); 32 if (P->cmp(0) < 0 || uintptr_t(l) > SIZE_MAX) 33 RF_LIB_ERROR("Invalid argument"); 34 } 50 35 else 51 36 RF_LIB_ERROR("Invalid argument"); 52 37 53 38 } 54 55 39 e_Res = Char::bytes_to_chars(e_Int); 56 40
Note: See TracChangeset
for help on using the changeset viewer.