MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / CobolToString

Function CobolToString

src/gpre/languages/fbrmclib.cpp:285–302  ·  view source on GitHub ↗

Return a Cobol argument as a C string. Trailing spaces are truncated.

Source from the content-addressed store, hash-verified

283
284// Return a Cobol argument as a C string. Trailing spaces are truncated.
285static 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
305static ISC_UINT64 atoi64(const char *s)

Callers 2

CvtArgToIntFunction · 0.85
RM_ENTRYFunction · 0.85

Calls 1

AllocStringPoolFunction · 0.85

Tested by

no test coverage detected