miax: fix compilation errors under uClibc-ng and musl
usleep is deprecated. So are bcopy and bzero. Added extra needed headers. Signed-off-by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
parent
e80afb1545
commit
94df06b550
3 changed files with 104 additions and 1 deletions
|
@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=miax
|
PKG_NAME:=miax
|
||||||
PKG_VERSION:=1.4
|
PKG_VERSION:=1.4
|
||||||
PKG_RELEASE:=2
|
PKG_RELEASE:=3
|
||||||
|
|
||||||
PKG_SOURCE:=$(PKG_NAME)_$(PKG_VERSION).tar.gz
|
PKG_SOURCE:=$(PKG_NAME)_$(PKG_VERSION).tar.gz
|
||||||
PKG_SOURCE_URL:=@SF/miax
|
PKG_SOURCE_URL:=@SF/miax
|
||||||
|
|
24
net/miax/patches/010-usleep.patch
Normal file
24
net/miax/patches/010-usleep.patch
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
--- a/modem.c
|
||||||
|
+++ b/modem.c
|
||||||
|
@@ -76,10 +76,11 @@ int tty_modem(char* send, char *receive) {
|
||||||
|
|
||||||
|
int l=0, in=0, out=0, timeout=10;
|
||||||
|
char tmp[4096];
|
||||||
|
+ struct timespec h = {0, 100 * 1000 * 1000};
|
||||||
|
|
||||||
|
if (strlen(send)) {
|
||||||
|
while ((timeout--) > 0) {
|
||||||
|
- usleep(100000);
|
||||||
|
+ nanosleep(&h, NULL);
|
||||||
|
ioctl(fd_modem,TIOCMGET,&out);
|
||||||
|
if (out & TIOCM_CTS) {
|
||||||
|
l=write(fd_modem,send,strlen(send));
|
||||||
|
@@ -97,7 +98,7 @@ int tty_modem(char* send, char *receive) {
|
||||||
|
strncat(receive,tmp,in);
|
||||||
|
if (strchr(receive,'\r')) { break; }
|
||||||
|
}
|
||||||
|
- else { usleep(100000); }
|
||||||
|
+ else { nanosleep(&h, NULL); }
|
||||||
|
}
|
||||||
|
if (strlen(receive) > 0 && debug > 3) { fprintf(stderr, "%s\n", receive); }
|
||||||
|
|
79
net/miax/patches/020-includes.patch
Normal file
79
net/miax/patches/020-includes.patch
Normal file
|
@ -0,0 +1,79 @@
|
||||||
|
--- a/dtmf.c
|
||||||
|
+++ b/dtmf.c
|
||||||
|
@@ -22,6 +22,7 @@
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <math.h>
|
||||||
|
+#include <string.h>
|
||||||
|
|
||||||
|
#define RATE 8000
|
||||||
|
#define BLOCKLEN (RATE/100)
|
||||||
|
--- a/iax/iax.c
|
||||||
|
+++ b/iax/iax.c
|
||||||
|
@@ -344,7 +344,7 @@ static int iax_sched_event(struct iax_event *event, struct iax_frame *frame, int
|
||||||
|
|
||||||
|
sched = (struct iax_sched*)malloc(sizeof(struct iax_sched));
|
||||||
|
if (sched) {
|
||||||
|
- bzero(sched, sizeof(struct iax_sched));
|
||||||
|
+ memset(sched, 0, sizeof(struct iax_sched));
|
||||||
|
gettimeofday(&sched->when, NULL);
|
||||||
|
sched->when.tv_sec += (ms / 1000);
|
||||||
|
ms = ms % 1000;
|
||||||
|
@@ -872,7 +872,7 @@ int iax_do_event(struct iax_session *session, struct iax_event *event)
|
||||||
|
|
||||||
|
#define MYSNPRINTF snprintf(requeststr + strlen(requeststr), sizeof(buf) - sizeof(struct ast_iax2_full_hdr) - strlen(requeststr),
|
||||||
|
|
||||||
|
- bzero(buf, sizeof(buf));
|
||||||
|
+ memset(buf, 0, sizeof(buf));
|
||||||
|
|
||||||
|
/* Default some things in the frame */
|
||||||
|
|
||||||
|
@@ -1523,7 +1523,7 @@ int iax_auth_reply(struct iax_session *session, char *password, char *challenge,
|
||||||
|
MD5Update(&md5, (const unsigned char *) challenge, strlen(challenge));
|
||||||
|
MD5Update(&md5, (const unsigned char *) password, strlen(password));
|
||||||
|
MD5Final((unsigned char *) reply, &md5);
|
||||||
|
- bzero(realreply, sizeof(realreply));
|
||||||
|
+ memset(realreply, 0, sizeof(realreply));
|
||||||
|
convert_reply(realreply, (unsigned char *) reply);
|
||||||
|
iax_ie_append_str(&ied, IAX_IE_MD5_RESULT, realreply);
|
||||||
|
} else {
|
||||||
|
@@ -1546,7 +1546,7 @@ static int iax_regauth_reply(struct iax_session *session, char *password, char *
|
||||||
|
MD5Update(&md5, (const unsigned char *) challenge, strlen(challenge));
|
||||||
|
MD5Update(&md5, (const unsigned char *) password, strlen(password));
|
||||||
|
MD5Final((unsigned char *) reply, &md5);
|
||||||
|
- bzero(realreply, sizeof(realreply));
|
||||||
|
+ memset(realreply, 0, sizeof(realreply));
|
||||||
|
convert_reply(realreply, (unsigned char *) reply);
|
||||||
|
iax_ie_append_str(&ied, IAX_IE_MD5_RESULT, realreply);
|
||||||
|
} else {
|
||||||
|
--- a/modem.c
|
||||||
|
+++ b/modem.c
|
||||||
|
@@ -27,7 +27,7 @@
|
||||||
|
#include <string.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <sys/ioctl.h>
|
||||||
|
-#include <unistd.h>
|
||||||
|
+#include <time.h>
|
||||||
|
|
||||||
|
static int baudrate=B9600, fd_modem, m_status=0;
|
||||||
|
extern int debug;
|
||||||
|
@@ -50,7 +50,7 @@ int tty_modem_init(char *dev) {
|
||||||
|
char buf[4096];
|
||||||
|
struct termios newtio;
|
||||||
|
|
||||||
|
- bzero(&newtio, sizeof(newtio));
|
||||||
|
+ memset(&newtio, 0, sizeof(newtio));
|
||||||
|
newtio.c_cflag = CRTSCTS | CS8 | CLOCAL | CREAD | O_NDELAY;
|
||||||
|
if ( fd_modem = open(dev, O_RDWR | O_NOCTTY | O_NONBLOCK) ) {
|
||||||
|
cfsetispeed(&newtio,baudrate);
|
||||||
|
--- a/oss.c
|
||||||
|
+++ b/oss.c
|
||||||
|
@@ -1,5 +1,8 @@
|
||||||
|
#include "iaxclient_lib.h"
|
||||||
|
#include <fcntl.h>
|
||||||
|
+#include <string.h>
|
||||||
|
+#include <unistd.h>
|
||||||
|
+#include <sys/ioctl.h>
|
||||||
|
#include <sys/soundcard.h>
|
||||||
|
|
||||||
|
#define RTP 320
|
Loading…
Reference in a new issue