libvbisam: Fix bugs around ecvt

`ecvt` was used undeclared in `libvbisam/isdecimal.c`.

`__set_errno` was undefined.
This commit is contained in:
Tee KOBAYASHI 2021-12-28 20:56:35 +09:00 committed by Henrik Grimler
parent 55f72d2bde
commit e87cd20082
3 changed files with 25 additions and 0 deletions

View File

@ -3,6 +3,7 @@ TERMUX_PKG_DESCRIPTION="A replacement for IBM's C-ISAM"
TERMUX_PKG_LICENSE="GPL-2.0, LGPL-2.1"
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION=2.0
TERMUX_PKG_REVISION=1
TERMUX_PKG_SRCURL=https://downloads.sourceforge.net/project/vbisam/vbisam2/vbisam-${TERMUX_PKG_VERSION}.tar.gz
TERMUX_PKG_SHA256=688b776e0030cce50fd7e44cbe40398ea93431f76510c7100433cc6313eabc4f

View File

@ -30,6 +30,14 @@
#define __FCVT_R fcvt
#define __ECVT_R ecvt
#define SNPRINTF snprintf
#if __ANDROID_API__ >= 21
static inline int
__set_errno(int n)
{
errno = n;
return -1;
}
#endif
#endif
#ifndef SNPRINTF
@ -40,6 +48,8 @@
#define APPEND(a, b) APPEND2 (a, b)
#define APPEND2(a, b) a##b
#pragma GCC visibility push(hidden)
int
__FCVT_R (FLOAT_TYPE value, int ndigit, int *decpt, int *sign,
char *buf, size_t len)
@ -203,3 +213,5 @@ __ECVT_R (FLOAT_TYPE value, int ndigit, int *decpt, int *sign,
*decpt += exponent;
return 0;
}
#pragma GCC visibility pop

View File

@ -0,0 +1,12 @@
--- a/libvbisam/isdecimal.c
+++ b/libvbisam/isdecimal.c
@@ -134,6 +134,9 @@
int decpt;
int sign;
+#ifdef __ANDROID__
+ char *ecvt(double, int, int *, int *);
+#endif
str = (unsigned char *)ecvt (dbl, ndigits, &decpt, &sign);
dp->dec_pos = sign ? 0 : 1;