@@ -52,56 +52,12 @@ array_exprt string_constantt::to_array_expr() const
52
52
int ch=i==string_size-1 ?0 :str[i];
53
53
54
54
if (char_is_unsigned)
55
- ch=(unsigned char )ch;
55
+ ch = (unsigned char )ch;
56
+ else
57
+ ch = (signed char )ch;
56
58
57
- exprt &op=*it;
58
-
59
- op=from_integer (ch, char_type);
60
-
61
- if (ch>=32 && ch<=126 )
62
- {
63
- std::string ch_str=" '" ;
64
- if (ch==' \' ' || ch==' \\ ' )
65
- ch_str+=' \\ ' ;
66
- ch_str+=static_cast <char >(ch);
67
- ch_str+=" '" ;
68
- }
59
+ *it = from_integer (ch, char_type);
69
60
}
70
61
71
62
return dest;
72
63
}
73
-
74
- // / convert array constant into string
75
- // / \return true on error
76
- bool string_constantt::from_array_expr (const array_exprt &src)
77
- {
78
- id (ID_string_constant);
79
- type ()=src.type ();
80
-
81
- const typet &subtype = to_array_type (type ()).subtype ();
82
-
83
- // check subtype
84
- if (subtype!=signed_char_type () &&
85
- subtype!=unsigned_char_type ())
86
- return true ;
87
-
88
- std::string value;
89
-
90
- forall_operands (it, src)
91
- {
92
- mp_integer int_value=0 ;
93
- if (to_integer (*it, int_value))
94
- return true ;
95
- unsigned unsigned_value=integer2unsigned (int_value);
96
- value+=static_cast <char >(unsigned_value);
97
- }
98
-
99
- // Drop the implicit zero at the end.
100
- // Not clear what the semantics should be if it's not there.
101
- if (!value.empty () && value[value.size ()-1 ]==0 )
102
- value.resize (value.size ()-1 );
103
-
104
- set_value (value);
105
-
106
- return false ;
107
- }
0 commit comments