Changeset 701


Ignore:
Timestamp:
Apr 30, 2003, 1:52:42 PM (18 years ago)
Author:
luba
Message:
  • length of the number is compared with maximum length of UINTPTR_MAX now
File:
1 edited

Legend:

Unmodified
Added
Removed
  • to-imperative/trunk/library/Convert/to_int.cc

    r674 r701  
    1717
    1818RF_FUNC (To_m_Int, (RF_ARG e_Exp), (RF_RES s_Int))
     19  uint MAX_LEN = 10;
    1920  uintptr_t len = 0;
    2021  int flag = 0;
     
    3738  for (; t < e_Exp.get_last(); t++) {
    3839    if (t->get_type() == type_char && ((Char*)t)->is_digit())
    39       if (len > UINTPTR_MAX - 1)
     40      if (len >= MAX_LEN - 1)
    4041        RF_LIB_ERROR("Argument too large for conversion");
    4142      else
     
    4647          retfail;
    4748        else
    48           if (len > UINTPTR_MAX - ShortInt::get_char_len(((ShortInt*)t)->to_int()))
     49          if (len >= MAX_LEN - ShortInt::get_char_len(((ShortInt*)t)->to_int()))
    4950            RF_LIB_ERROR("Argument too large for conversion");
    5051          else
     
    5455    else
    5556    if (t->get_type() == type_word && ((Word*)t)->is_number())
    56       if (len > UINTPTR_MAX - длина слова ))
     57      if (len >= MAX_LEN - длина слова ))
    5758        RF_LIB_ERROR("Argument too large for conversion");
    5859      else
Note: See TracChangeset for help on using the changeset viewer.