Store a C integer into a Cobol format memory buffer
| 430 | |
| 431 | // Store a C integer into a Cobol format memory buffer |
| 432 | static void CvtIntToCobol(ISC_UCHAR *s, ISC_UINT64 l, ISC_USHORT len) |
| 433 | { |
| 434 | memset(s, 0, len); |
| 435 | switch (len) |
| 436 | { |
| 437 | case 2: |
| 438 | *(s) = (ISC_UCHAR)((l >> 8) & 0xff); |
| 439 | *(s + 1) = (ISC_UCHAR)(l & 0xff); |
| 440 | break; |
| 441 | case 4: |
| 442 | *(s) = (ISC_UCHAR)((l >> 24) & 0xff); |
| 443 | *(s + 1) = (ISC_UCHAR)((l >> 16) & 0xff); |
| 444 | *(s + 2) = (ISC_UCHAR)((l >> 8) & 0xff); |
| 445 | *(s + 3) = (ISC_UCHAR)(l & 0xff); |
| 446 | break; |
| 447 | case 8: |
| 448 | *(s) = (ISC_UCHAR)((l >> 56) & 0xff); |
| 449 | *(s + 1) = (ISC_UCHAR)((l >> 48) & 0xff); |
| 450 | *(s + 2) = (ISC_UCHAR)((l >> 40) & 0xff); |
| 451 | *(s + 3) = (ISC_UCHAR)((l >> 32) & 0xff); |
| 452 | *(s + 4) = (ISC_UCHAR)((l >> 24) & 0xff); |
| 453 | *(s + 5) = (ISC_UCHAR)((l >> 16) & 0xff); |
| 454 | *(s + 6) = (ISC_UCHAR)((l >> 8) & 0xff); |
| 455 | *(s + 7) = (ISC_UCHAR)(l & 0xff); |
| 456 | break; |
| 457 | } |
| 458 | } |
| 459 | |
| 460 | // Store a C integer into a Cobol BINARY(n) (big-endian) field |
| 461 | static void IntToCobol(argument_entry *arg, const ISC_UINT64 i) |
no outgoing calls
no test coverage detected