]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Add some fixes for building on Solaris.
authorJoshua Colp <jcolp@digium.com>
Wed, 1 Aug 2007 17:56:59 +0000 (17:56 +0000)
committerJoshua Colp <jcolp@digium.com>
Wed, 1 Aug 2007 17:56:59 +0000 (17:56 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@77869 65c4cc65-6c06-0410-ace0-fbb531ad65f3

apps/app_voicemail.c
channels/chan_iax2.c
channels/chan_mgcp.c
include/asterisk/threadstorage.h
main/acl.c
utils/smsq.c

index 506ba236125f995618ed05f73b7ddf7f26e4ba6e..45fdfb641a0ef414dbecaa292a95d55dd4301a34 100644 (file)
@@ -1906,7 +1906,7 @@ static void make_email_file(FILE *p, char *srcemail, struct ast_vm_user *vmu, in
                fprintf(p, "Subject: New message %d in mailbox %s" ENDL, msgnum + 1, mailbox);
        else
                fprintf(p, "Subject: [PBX]: New message %d in mailbox %s" ENDL, msgnum + 1, mailbox);
-       fprintf(p, "Message-ID: <Asterisk-%d-%d-%s-%d@%s>" ENDL, msgnum + 1, (unsigned int)ast_random(), mailbox, getpid(), host);
+       fprintf(p, "Message-ID: <Asterisk-%d-%d-%s-%d@%s>" ENDL, msgnum + 1, (unsigned int)ast_random(), mailbox, (int)getpid(), host);
        if(imap) {
                /* additional information needed for IMAP searching */
                fprintf(p, "X-Asterisk-VM-Message-Num: %d" ENDL, msgnum + 1);
@@ -1931,7 +1931,7 @@ static void make_email_file(FILE *p, char *srcemail, struct ast_vm_user *vmu, in
        fprintf(p, "MIME-Version: 1.0" ENDL);
        if (attach_user_voicemail) {
                /* Something unique. */
-               snprintf(bound, sizeof(bound), "----voicemail_%d%s%d%d", msgnum + 1, mailbox, getpid(), (unsigned int)ast_random());
+               snprintf(bound, sizeof(bound), "----voicemail_%d%s%d%d", msgnum + 1, mailbox, (int)getpid(), (unsigned int)ast_random());
 
                fprintf(p, "Content-Type: multipart/mixed; boundary=\"%s\"" ENDL, bound);
                fprintf(p, ENDL ENDL "This is a multi-part message in MIME format." ENDL ENDL);
index 7aed23fac1f5061df4e99ed21b981681acf5c6ed..d4d6ac74b7f9016181a0f634ae470311de6b3e8f 100644 (file)
@@ -1361,7 +1361,7 @@ static void destroy_firmware(struct iax_firmware *cur)
 {
        /* Close firmware */
        if (cur->fwh) {
-               munmap(cur->fwh, ntohl(cur->fwh->datalen) + sizeof(*(cur->fwh)));
+               munmap((void*)cur->fwh, ntohl(cur->fwh->datalen) + sizeof(*(cur->fwh)));
        }
        close(cur->fd);
        free(cur);
@@ -1460,7 +1460,7 @@ static int try_firmware(char *s)
                close(fd);
                return -1;
        }
-       fwh = mmap(NULL, stbuf.st_size, PROT_READ, MAP_PRIVATE, fd, 0); 
+       fwh = (struct ast_iax2_firmware_header*)mmap(NULL, stbuf.st_size, PROT_READ, MAP_PRIVATE, fd, 0); 
        if (fwh == (void *) -1) {
                ast_log(LOG_WARNING, "mmap failed: %s\n", strerror(errno));
                close(fd);
@@ -1471,7 +1471,7 @@ static int try_firmware(char *s)
        MD5Final(sum, &md5);
        if (memcmp(sum, fwh->chksum, sizeof(sum))) {
                ast_log(LOG_WARNING, "Firmware file '%s' fails checksum\n", s);
-               munmap(fwh, stbuf.st_size);
+               munmap((void*)fwh, stbuf.st_size);
                close(fd);
                return -1;
        }
@@ -1484,7 +1484,7 @@ static int try_firmware(char *s)
                                break;
                        /* This version is no newer than what we have.  Don't worry about it.
                           We'll consider it a proper load anyhow though */
-                       munmap(fwh, stbuf.st_size);
+                       munmap((void*)fwh, stbuf.st_size);
                        close(fd);
                        return 0;
                }
@@ -1500,7 +1500,7 @@ static int try_firmware(char *s)
        }
        if (cur) {
                if (cur->fwh) {
-                       munmap(cur->fwh, cur->mmaplen);
+                       munmap((void*)cur->fwh, cur->mmaplen);
                }
                if (cur->fd > -1)
                        close(cur->fd);
index bda08d7a3fb1fe8fc27d16710e964743b92f82a6..50203a15ed5d31db897e5f075c6ece975eae8247 100644 (file)
@@ -2050,7 +2050,7 @@ static int add_sdp(struct mgcp_request *resp, struct mgcp_subchannel *sub, struc
                ast_verbose("We're at %s port %d\n", ast_inet_ntoa(p->parent->ourip), ntohs(sin.sin_port));
        }
        snprintf(v, sizeof(v), "v=0\r\n");
-       snprintf(o, sizeof(o), "o=root %d %d IN IP4 %s\r\n", getpid(), getpid(), ast_inet_ntoa(dest.sin_addr));
+       snprintf(o, sizeof(o), "o=root %d %d IN IP4 %s\r\n", (int)getpid(), (int)getpid(), ast_inet_ntoa(dest.sin_addr));
        snprintf(s, sizeof(s), "s=session\r\n");
        snprintf(c, sizeof(c), "c=IN IP4 %s\r\n", ast_inet_ntoa(dest.sin_addr));
        snprintf(t, sizeof(t), "t=0 0\r\n");
index f17991957d95df7a7dd5106ce4efb6a6b7ac6841..9021aa551f38ec33c3b79cf6b196a31697c45a4d 100644 (file)
@@ -43,6 +43,11 @@ struct ast_threadstorage {
        void (*key_init)(void);
 };
 
+#ifdef SOLARIS
+#define THREADSTORAGE_ONCE_INIT {PTHREAD_ONCE_INIT}
+#else
+#define THREADSTORAGE_ONCE_INIT PTHREAD_ONCE_INIT
+#endif
 
 #if defined(DEBUG_THREADLOCALS)
 void __ast_threadstorage_object_add(void *key, size_t len, const char *file, const char *function, unsigned int line);
@@ -72,7 +77,7 @@ void __ast_threadstorage_object_replace(void *key_old, void *key_new, size_t len
 #define AST_THREADSTORAGE_CUSTOM(name, name_init, cleanup)  \
 static void name_init(void);                                \
 static struct ast_threadstorage name = {                    \
-       .once = PTHREAD_ONCE_INIT,                          \
+       .once = THREADSTORAGE_ONCE_INIT,                    \
        .key_init = name_init,                              \
 };                                                          \
 static void name_init(void)                                 \
@@ -83,7 +88,7 @@ static void name_init(void)                                 \
 #define AST_THREADSTORAGE_CUSTOM(name, name_init, cleanup)  \
 static void name_init(void);                                \
 static struct ast_threadstorage name = {                    \
-       .once = PTHREAD_ONCE_INIT,                          \
+       .once = THREADSTORAGE_ONCE_INIT,                    \
        .key_init = name_init,                              \
 };                                                          \
 static void __cleanup_##name(void *data)                   \
index 5d8c82380c0e64448059eb37a7923c5ce3c34abc..f5261965e20d168ace8f7683e75fc319c305dd66 100644 (file)
@@ -79,7 +79,7 @@ struct ast_ha {
 };
 
 /* Default IP - if not otherwise set, don't breathe garbage */
-static struct in_addr __ourip = { 0x00000000 };
+static struct in_addr __ourip = { .s_addr = 0x00000000, };
 
 struct my_ifreq {
        char ifrn_name[IFNAMSIZ];       /* Interface name, e.g. "eth0", "ppp0", etc.  */
index bacae9ef3116afac9549ddd1913115439bf1b0d5..7439504fc635d52f8c6da193e3bb767f1887796b 100644 (file)
@@ -125,7 +125,7 @@ static char txqcheck (char *dir, char *queue, char subaddress, char *channel, ch
       ql = p - queue;
       subaddress = p[1];
    }
-   snprintf (temp, sizeof(temp), "sms/.smsq-%d", getpid ());
+   snprintf (temp, sizeof(temp), "sms/.smsq-%d", (int)getpid ());
    f = fopen (temp, "w");
    if (!f)
    {
@@ -196,7 +196,7 @@ static void rxqcheck (char *dir, char *queue, char *process)
    DIR *d;
    int ql = strlen (queue);
    struct dirent *fn;
-   snprintf(temp, sizeof(temp), "sms/.smsq-%d", getpid ());
+   snprintf(temp, sizeof(temp), "sms/.smsq-%d", (int)getpid ());
    snprintf(dirname, sizeof(dirname), "sms/%s", dir);
    d = opendir (dirname);
    if (!d)
@@ -673,10 +673,10 @@ main (int argc, const char *argv[])
         queuename[100],
        *dir = (mo ? rx ? "sms/morx" : "sms/motx" : rx ? "sms/mtrx" : "sms/mttx");
       FILE *f;
-      snprintf (temp, sizeof(temp), "sms/.smsq-%d", getpid ());
+      snprintf (temp, sizeof(temp), "sms/.smsq-%d", (int)getpid ());
       mkdir ("sms", 0777);      /* ensure directory exists */
       mkdir (dir, 0777);        /* ensure directory exists */
-      snprintf (queuename, sizeof(queuename), "%s/%s.%ld-%d", dir, *queue ? queue : "0", (long)time (0), getpid ());
+      snprintf (queuename, sizeof(queuename), "%s/%s.%ld-%d", dir, *queue ? queue : "0", (long)time (0), (int)getpid ());
       f = fopen (temp, "w");
       if (!f)
       {