mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-23 14:03:07 +01:00
Commit fix from Stephen Boyd for his RMCOBOL interface library.
This commit is contained in:
parent
f1c264cfe4
commit
64bfb9e026
@ -1521,7 +1521,7 @@ EXPORT RM_ENTRY(rmc_ftoc)
|
||||
|
||||
// Convert a Cobol alpha (PIC X) field to a C string. This is done by trimming trailing spaces
|
||||
// and adding the trailing '\0'.
|
||||
EXPORT RM_ENTRY(rmc_ctos)
|
||||
EXPORT RM_ENTRY(rmc_stoc)
|
||||
{
|
||||
char* dest = (char*) arg_vector[-1].a_address;
|
||||
const int dlen = arg_vector[-1].a_length;
|
||||
@ -1531,7 +1531,7 @@ EXPORT RM_ENTRY(rmc_ctos)
|
||||
int i = slen - 1;
|
||||
while (src[i] == ' ' && i >= 0)
|
||||
--i;
|
||||
|
||||
|
||||
int len = ((i + 1) < dlen) ? i + 1 : dlen - 1;
|
||||
memmove(dest, src, len);
|
||||
dest[len] = '\0';
|
||||
@ -1541,12 +1541,12 @@ EXPORT RM_ENTRY(rmc_ctos)
|
||||
|
||||
// Convert a C string to a Cobol alpha (PIC X) field. This is done by copying the original
|
||||
// string and padding on the right with spaces.
|
||||
EXPORT RM_ENTRY(rmc_stoc)
|
||||
EXPORT RM_ENTRY(rmc_ctos)
|
||||
{
|
||||
char* dest = (char*) arg_vector[-1].a_address;
|
||||
const int dlen = arg_vector[-1].a_length;
|
||||
const char* src = (char*) arg_vector[0].a_address;
|
||||
const int slen = arg_vector[0].a_length;
|
||||
const int slen = strlen(src);
|
||||
|
||||
memset(dest, ' ', dlen);
|
||||
int len = (slen <= dlen) ? slen : dlen;
|
||||
@ -1554,10 +1554,8 @@ EXPORT RM_ENTRY(rmc_stoc)
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
static char* banner = "Firebird Embedded SQL Interface";
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user