Return a Cobol argument as a C string. Trailing spaces are truncated.
| 283 | |
| 284 | // Return a Cobol argument as a C string. Trailing spaces are truncated. |
| 285 | static ISC_UCHAR* CobolToString(const argument_entry *arg) |
| 286 | { |
| 287 | ISC_UCHAR *s = NULL; |
| 288 | |
| 289 | if (arg->a_address) |
| 290 | { |
| 291 | s = AllocStringPool(arg->a_length + 1); |
| 292 | if (s) |
| 293 | { |
| 294 | memset(s, 0, arg->a_length + 1); |
| 295 | memmove(s, arg->a_address, arg->a_length); |
| 296 | // Truncate trailing spaces |
| 297 | for (ISC_UCHAR *p = s + arg->a_length - 1; (p >= s) && (*p == ' '); p--) |
| 298 | *p = '\0'; |
| 299 | } |
| 300 | } |
| 301 | return (s); |
| 302 | } |
| 303 | |
| 304 | // Return the int64 value of an array of ASCII characters |
| 305 | static ISC_UINT64 atoi64(const char *s) |
no test coverage detected