@@ -142,31 +142,19 @@ static bool FitsInDescriptor(
142
142
kind, terminator, value);
143
143
}
144
144
145
- void removeNewLine (char *str) {
146
- char *newlinePos = std::strchr (str, ' \n ' );
147
- if (newlinePos) {
148
- *newlinePos = ' \0 ' ; // Replace with null terminator
149
- }
150
- }
151
-
152
145
std::int32_t RTNAME (FDate)(const Descriptor *value, const Descriptor *errmsg) {
153
146
FillWithSpaces (*value);
154
-
155
147
std::time_t current_time;
156
148
std::time (¤t_time);
157
149
std::array<char , 26 > str;
158
- // Day Mon dd hh:mm:ss yyyy\n is 26 character,
159
- // e.g. Tue May 26 21:51:03 2015\n\0
150
+ // Day Mon dd hh:mm:ss yyyy\n\0 is 26 characters, e.g.
151
+ // Tue May 26 21:51:03 2015\n\0
160
152
161
153
ctime_alloc (str.data (), str.size (), current_time);
162
- removeNewLine (str.data ());
163
- std::int64_t stringLen{StringLength (str.data ())};
164
- if (stringLen <= 0 ) {
165
- return ToErrmsg (errmsg, StatMissingArgument);
166
- }
154
+ str[24 ] = ' \0 ' ; // remove new line
167
155
168
156
if (value) {
169
- return CopyToDescriptor (*value, str.data (), stringLen , errmsg);
157
+ return CopyToDescriptor (*value, str.data (), 24 , errmsg);
170
158
}
171
159
172
160
return StatOk;
0 commit comments