]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
Rename MIN, MAX, ABS macros
authorAndre <maan@p133.(none)>
Sat, 15 Apr 2006 15:58:13 +0000 (17:58 +0200)
committerAndre <maan@p133.(none)>
Sat, 15 Apr 2006 15:58:13 +0000 (17:58 +0200)
MIN and MAX are already defined on MacOS.

18 files changed:
audioc.c
audiod.c
compress.c
dccp_send.c
fd.c
grab_client.c
gui.c
http_send.c
mp3dec.c
ogg.c
oggdec.c
para.h
playlist_selector.c
random_selector.c
recv.c
server.c
time.c
wav.c

index 55314264789c5e1ba2fdca6799dca42111c29281..1fa9880210e96d8ca2509df78980453374a4e469 100644 (file)
--- a/audioc.c
+++ b/audioc.c
@@ -121,11 +121,11 @@ int main(int argc, char *argv[])
                        fprintf(stderr, "loaded: %d\n", loaded);
                if (loaded < conf.bufsize_arg) {
                        FD_SET(fd, &rfd);
                        fprintf(stderr, "loaded: %d\n", loaded);
                if (loaded < conf.bufsize_arg) {
                        FD_SET(fd, &rfd);
-                       max_fileno = MAX(max_fileno, fd);
+                       max_fileno = PARA_MAX(max_fileno, fd);
                }
                if (loaded > 0) {
                        FD_SET(STDOUT_FILENO, &wfd);
                }
                if (loaded > 0) {
                        FD_SET(STDOUT_FILENO, &wfd);
-                       max_fileno = MAX(max_fileno, STDOUT_FILENO);
+                       max_fileno = PARA_MAX(max_fileno, STDOUT_FILENO);
                        check_write = 1;
                }
                ret = -E_OVERRUN;
                        check_write = 1;
                }
                ret = -E_OVERRUN;
index 0e5fed4876d389ee8804e8f3d99593dbd668efce..f15ab710d8808da2b945632a9d42d4ad8133f0e0 100644 (file)
--- a/audiod.c
+++ b/audiod.c
@@ -1157,7 +1157,7 @@ static int init_stream_io(void)
        free(cmd);
        /* filters */
        filter_init(filters);
        free(cmd);
        /* filters */
        filter_init(filters);
-       nf = MAX(2,  conf.filter_given) + 1;
+       nf = PARA_MAX(2,  conf.filter_given) + 1;
        PARA_INFO_LOG("allocating space for %d filters\n", nf);
        FOR_EACH_AUDIO_FORMAT(i) {
                afi[i].filter_conf = para_malloc(nf * sizeof(char *));
        PARA_INFO_LOG("allocating space for %d filters\n", nf);
        FOR_EACH_AUDIO_FORMAT(i) {
                afi[i].filter_conf = para_malloc(nf * sizeof(char *));
@@ -1525,7 +1525,7 @@ static void audiod_pre_select(fd_set *rfds, fd_set *wfds, struct timeval *tv,
                a = &afi[s->format];
                ret = a->receiver->pre_select(rn, rfds, wfds, tv);
 //             PARA_NOTICE_LOG("%s preselect: %d\n", a->receiver->name, ret);
                a = &afi[s->format];
                ret = a->receiver->pre_select(rn, rfds, wfds, tv);
 //             PARA_NOTICE_LOG("%s preselect: %d\n", a->receiver->name, ret);
-               *max_fileno = MAX(*max_fileno, ret);
+               *max_fileno = PARA_MAX(*max_fileno, ret);
        }
 }
 static void audiod_post_select(int select_ret, fd_set *rfds, fd_set *wfds)
        }
 }
 static void audiod_post_select(int select_ret, fd_set *rfds, fd_set *wfds)
index de5448fb9eb9f5ebb33f7dffaf58ec246e270a31..b4e4c40a7a1663c95b38cdbada69715c519da5dc 100644 (file)
@@ -49,7 +49,8 @@ struct private_compress_data {
 
 static ssize_t compress(char *inbuf, size_t inbuf_len, struct filter_node *fn)
 {
 
 static ssize_t compress(char *inbuf, size_t inbuf_len, struct filter_node *fn)
 {
-       size_t i, length = MIN((inbuf_len / 2) * 2, (fn->bufsize - fn->loaded) / 2 * 2);
+       size_t i, length = PARA_MIN((inbuf_len / 2) * 2,
+               (fn->bufsize - fn->loaded) / 2 * 2);
        struct private_compress_data *pcd = fn->private_data;
        int16_t *ip = (int16_t *)inbuf, *op = (int16_t *)(fn->buf + fn->loaded);
        unsigned gain_shift = pcd->conf->inertia_arg + pcd->conf->damp_arg,
        struct private_compress_data *pcd = fn->private_data;
        int16_t *ip = (int16_t *)inbuf, *op = (int16_t *)(fn->buf + fn->loaded);
        unsigned gain_shift = pcd->conf->inertia_arg + pcd->conf->damp_arg,
index 55548620c7a67996b74aac62f2c3cb862ee575b4..7fad4f7d7acb4b150719f5453af5e2f3e987f1ee 100644 (file)
@@ -56,7 +56,7 @@ static void dccp_pre_select(__a_unused struct audio_format *af, int *max_fileno,
        if (listen_fd < 0)
                return;
        FD_SET(listen_fd, rfds);
        if (listen_fd < 0)
                return;
        FD_SET(listen_fd, rfds);
-       *max_fileno = MAX(*max_fileno, listen_fd);
+       *max_fileno = PARA_MAX(*max_fileno, listen_fd);
 }
 
 static void dccp_post_select(__a_unused struct audio_format *af, fd_set *rfds,
 }
 
 static void dccp_post_select(__a_unused struct audio_format *af, fd_set *rfds,
@@ -119,7 +119,7 @@ static int dccp_write(int fd, const char *buf, size_t len)
        size_t send, written = 0;
        int ret;
 again:
        size_t send, written = 0;
        int ret;
 again:
-       send = MIN(1024, len - written);
+       send = PARA_MIN(1024, len - written);
        ret = write(fd, buf + written, send);
        if (ret < 0)
                goto err_out;
        ret = write(fd, buf + written, send);
        if (ret < 0)
                goto err_out;
diff --git a/fd.c b/fd.c
index dc22d147711cbf2d152d895293bf79a4190352b5..c5a37cdd2a4e5c28437df2fbbf3b44b313ac0636 100644 (file)
--- a/fd.c
+++ b/fd.c
@@ -98,5 +98,5 @@ int mark_fd_nonblock(int fd)
 void para_fd_set(int fd, fd_set *fds, int *max_fileno)
 {
        FD_SET(fd, fds);
 void para_fd_set(int fd, fd_set *fds, int *max_fileno)
 {
        FD_SET(fd, fds);
-       *max_fileno = MAX(*max_fileno, fd);
+       *max_fileno = PARA_MAX(*max_fileno, fd);
 }
 }
index f853a76432b65e597cf987f5a00a468b5bffff7f..ee07d875e085a591437465eca3ef330deddc2bc1 100644 (file)
@@ -43,7 +43,7 @@ static int max_num_filters(void)
        for (i = 0; audio_formats[i]; i++) {
                PARA_INFO_LOG("%s filter chain length: %d\n", audio_formats[i],
                        num_filters(i));
        for (i = 0; audio_formats[i]; i++) {
                PARA_INFO_LOG("%s filter chain length: %d\n", audio_formats[i],
                        num_filters(i));
-               ret = MAX(ret, num_filters(i));
+               ret = PARA_MAX(ret, num_filters(i));
        }
        PARA_INFO_LOG("maximal filter chain length: %d\n", ret);
        return ret;
        }
        PARA_INFO_LOG("maximal filter chain length: %d\n", ret);
        return ret;
diff --git a/gui.c b/gui.c
index 232572914bd9b7ca83038a334a7cff1b3ce2fdaf..0babfa83baba464cb6ef09906c93e88ebd3dd8b7 100644 (file)
--- a/gui.c
+++ b/gui.c
@@ -886,18 +886,19 @@ repeat:
        /* audiod pipe */
        if (audiod_pipe < 0)
                audiod_pipe = open_audiod_pipe();
        /* audiod pipe */
        if (audiod_pipe < 0)
                audiod_pipe = open_audiod_pipe();
+       /* FIXME: para_fd_set */
        if (audiod_pipe >= 0) {
                FD_SET(audiod_pipe, &rfds);
        if (audiod_pipe >= 0) {
                FD_SET(audiod_pipe, &rfds);
-               max_fileno = MAX(max_fileno, audiod_pipe);
+               max_fileno = PARA_MAX(max_fileno, audiod_pipe);
        }
 
        /* signal pipe */
        FD_SET(signal_pipe, &rfds);
        }
 
        /* signal pipe */
        FD_SET(signal_pipe, &rfds);
-       max_fileno = MAX(max_fileno, signal_pipe);
+       max_fileno = PARA_MAX(max_fileno, signal_pipe);
        /* command pipe only for COMMAND_MODE */
        if (command_pipe >= 0 && mode == COMMAND_MODE) {
                FD_SET(command_pipe, &rfds);
        /* command pipe only for COMMAND_MODE */
        if (command_pipe >= 0 && mode == COMMAND_MODE) {
                FD_SET(command_pipe, &rfds);
-               max_fileno = MAX(max_fileno, command_pipe);
+               max_fileno = PARA_MAX(max_fileno, command_pipe);
        }
        if (curses_active)
                FD_SET(STDIN_FILENO, &rfds);
        }
        if (curses_active)
                FD_SET(STDIN_FILENO, &rfds);
index 926f78082532761e50cf3be8b500b47184529b9c..bb9534cb6bea3a8953a01ad09213994f1d6ade4b 100644 (file)
@@ -346,6 +346,7 @@ err_out:
        free(hc);
 }
 
        free(hc);
 }
 
+/* FIXME: use para_fdset */
 static void http_pre_select(struct audio_format *af, int *max_fileno, fd_set *rfds,
                fd_set *wfds)
 {
 static void http_pre_select(struct audio_format *af, int *max_fileno, fd_set *rfds,
                fd_set *wfds)
 {
@@ -354,7 +355,7 @@ static void http_pre_select(struct audio_format *af, int *max_fileno, fd_set *rf
        if (server_fd < 0)
                return;
        FD_SET(server_fd, rfds);
        if (server_fd < 0)
                return;
        FD_SET(server_fd, rfds);
-       *max_fileno = MAX(*max_fileno, server_fd);
+       *max_fileno = PARA_MAX(*max_fileno, server_fd);
        list_for_each_entry_safe(hc, tmp, &clients, node) {
                //PARA_DEBUG_LOG("hc %p on fd %d: status %d\n", hc, hc->fd, hc->status);
                hc->check_r = 0;
        list_for_each_entry_safe(hc, tmp, &clients, node) {
                //PARA_DEBUG_LOG("hc %p on fd %d: status %d\n", hc, hc->fd, hc->status);
                hc->check_r = 0;
@@ -365,20 +366,20 @@ static void http_pre_select(struct audio_format *af, int *max_fileno, fd_set *rf
                        break;
                case HTTP_CONNECTED: /* need to recv get request */
                        FD_SET(hc->fd, rfds);
                        break;
                case HTTP_CONNECTED: /* need to recv get request */
                        FD_SET(hc->fd, rfds);
-                       *max_fileno = MAX(*max_fileno, hc->fd);
+                       *max_fileno = PARA_MAX(*max_fileno, hc->fd);
                        hc->check_r = 1;
                        break;
                case HTTP_GOT_GET_REQUEST: /* need to send ok msg */
                case HTTP_INVALID_GET_REQUEST: /* need to send err msg */
                        FD_SET(hc->fd, wfds);
                        hc->check_r = 1;
                        break;
                case HTTP_GOT_GET_REQUEST: /* need to send ok msg */
                case HTTP_INVALID_GET_REQUEST: /* need to send err msg */
                        FD_SET(hc->fd, wfds);
-                       *max_fileno = MAX(*max_fileno, hc->fd);
+                       *max_fileno = PARA_MAX(*max_fileno, hc->fd);
                        hc->check_w = 1;
                        break;
                case HTTP_SENT_OK_MSG:
                        if (!af || !afs_playing())
                                break; /* wait until server starts playing */
                        FD_SET(hc->fd, wfds);
                        hc->check_w = 1;
                        break;
                case HTTP_SENT_OK_MSG:
                        if (!af || !afs_playing())
                                break; /* wait until server starts playing */
                        FD_SET(hc->fd, wfds);
-                       *max_fileno = MAX(*max_fileno, hc->fd);
+                       *max_fileno = PARA_MAX(*max_fileno, hc->fd);
                        hc->check_w = 1;
                        break;
                }
                        hc->check_w = 1;
                        break;
                }
index 0d0906b73a671f385c3122ee214ae650df8ff66d..4599df90b6fd42f712a7203069220c45bf579ec1 100644 (file)
--- a/mp3dec.c
+++ b/mp3dec.c
@@ -52,7 +52,7 @@ static ssize_t mp3dec(char *inbuffer, size_t len, struct filter_node *fn)
 {
        int i, ret;
        struct private_mp3dec_data *pmd = fn->private_data;
 {
        int i, ret;
        struct private_mp3dec_data *pmd = fn->private_data;
-       size_t copy = MIN(len, 4096);
+       size_t copy = PARA_MIN(len, 4096);
 
        if (fn->loaded > fn->bufsize * 4 / 5)
                return 0;
 
        if (fn->loaded > fn->bufsize * 4 / 5)
                return 0;
diff --git a/ogg.c b/ogg.c
index b38a8f4979a6dfccf4578f314b4914536546b05a..2d584e5be5a84f8d5ce9e4f1a2f0eb7ca928f7d1 100644 (file)
--- a/ogg.c
+++ b/ogg.c
@@ -170,8 +170,8 @@ static void ogg_compute_chunk_table(double time_total)
                        break;
                pos = ov_raw_tell(oggvorbis_file);
                diff = pos - old_pos;
                        break;
                pos = ov_raw_tell(oggvorbis_file);
                diff = pos - old_pos;
-               max_chunk_len = MAX(max_chunk_len, diff);
-               min = (i == 1)? diff : MIN(min, diff);
+               max_chunk_len = PARA_MAX(max_chunk_len, diff);
+               min = (i == 1)? diff : PARA_MIN(min, diff);
                chunk_table[i] = pos;
                if (i < 11 || !((i - 1) % 1000)|| i > num - 11)
                        PARA_DEBUG_LOG("chunk #%d: %g secs, pos: %zd, "
                chunk_table[i] = pos;
                if (i < 11 || !((i - 1) % 1000)|| i > num - 11)
                        PARA_DEBUG_LOG("chunk #%d: %g secs, pos: %zd, "
index b1ddd975c065839edfbd146d7c37c47b3a99438b..3554eb1b8ff3c6135d47e21c88e5abfd480b0dc5 100644 (file)
--- a/oggdec.c
+++ b/oggdec.c
@@ -61,7 +61,7 @@ static size_t cb_read(void *buf, size_t size, size_t nmemb, void *datasource)
                errno = EAGAIN;
                return -1;
        }
                errno = EAGAIN;
                return -1;
        }
-       ret = MIN(nmemb, have / size) * size;
+       ret = PARA_MIN(nmemb, have / size) * size;
        memcpy(buf, p, ret);
        pod->converted += ret;
        return ret;
        memcpy(buf, p, ret);
        pod->converted += ret;
        return ret;
diff --git a/para.h b/para.h
index 1ac056b31bc38d455a41a08c7ef094ea3d7c8090..3f05079740160c8aed96c1bf068696c8ca7872c3 100644 (file)
--- a/para.h
+++ b/para.h
@@ -43,9 +43,9 @@
 #define MAXLINE 255
 
 
 #define MAXLINE 255
 
 
-#define MIN(a,b) ((a) < (b) ? (a) : (b))
-#define MAX(a,b) ((a) > (b) ? (a) : (b))
-#define ABS(a) ((a) > 0 ? (a) : -(a))
+#define PARA_MIN(a,b) ((a) < (b) ? (a) : (b))
+#define PARA_MAX(a,b) ((a) > (b) ? (a) : (b))
+#define PARA_ABS(a) ((a) > 0 ? (a) : -(a))
 
 /* Loglevels */
 #define DEBUG 1
 
 /* Loglevels */
 #define DEBUG 1
index e5329bac5074f40a19277324adae4e94ed44e288..ee619b316201a3e4bbff4a325525aefbfa711eab 100644 (file)
@@ -192,7 +192,7 @@ static char **pls_get_audio_file_list(unsigned int num)
        char **file_list;
        unsigned i;
 
        char **file_list;
        unsigned i;
 
-       num = MIN(num, playlist_len);
+       num = PARA_MIN(num, playlist_len);
        if (!num)
                return NULL;
        file_list = para_malloc((num + 1) * sizeof(char *));
        if (!num)
                return NULL;
        file_list = para_malloc((num + 1) * sizeof(char *));
index a90822c54a690f234785079358f45cae7ff80218..ec1f5c6c53c39982cdf2ed488447598bcbfb59cd 100644 (file)
@@ -98,7 +98,7 @@ static char **random_get_audio_file_list(unsigned int num)
                goto out;
        /* careful, files might got deleted underneath */
        num_audio_files = audio_file_count; /* can only decrease */
                goto out;
        /* careful, files might got deleted underneath */
        num_audio_files = audio_file_count; /* can only decrease */
-       len = MIN(num, num_audio_files);
+       len = PARA_MIN(num, num_audio_files);
        ret = -E_NOTHING_FOUND;
        if (!len) /* nothing found, return NULL */
                goto out;
        ret = -E_NOTHING_FOUND;
        if (!len) /* nothing found, return NULL */
                goto out;
diff --git a/recv.c b/recv.c
index ba1cfd20bba03651387e1bb1826baa0592ab2b46..95711f1fce1c4ea56f8bbe00ff829d5a8bbc401c 100644 (file)
--- a/recv.c
+++ b/recv.c
@@ -85,7 +85,7 @@ recv:
        timeout.tv_usec = 1000 * 1000;
        max = -1;
        ret = r->pre_select(&rn, &rfds, &wfds, &timeout);
        timeout.tv_usec = 1000 * 1000;
        max = -1;
        ret = r->pre_select(&rn, &rfds, &wfds, &timeout);
-       max = MAX(max, ret);
+       max = PARA_MAX(max, ret);
 
        PARA_DEBUG_LOG("timeout: %lums\n", tv2ms(&timeout));
        ret = para_select(max + 1, &rfds, &wfds, &timeout);
 
        PARA_DEBUG_LOG("timeout: %lums\n", tv2ms(&timeout));
        ret = para_select(max + 1, &rfds, &wfds, &timeout);
index bcb43a20e610d275294447b4fc4728f8caaece78..e10c1e0343c77f1462bb7117b38486f39161411f 100644 (file)
--- a/server.c
+++ b/server.c
@@ -442,7 +442,7 @@ repeat:
        FD_SET(sockfd, &rfds);
        max_fileno = sockfd;
        FD_SET(signal_pipe, &rfds);
        FD_SET(sockfd, &rfds);
        max_fileno = sockfd;
        FD_SET(signal_pipe, &rfds);
-       max_fileno = MAX(max_fileno, signal_pipe);
+       max_fileno = PARA_MAX(max_fileno, signal_pipe);
 
        timeout = afs_preselect();
        status_refresh();
 
        timeout = afs_preselect();
        status_refresh();
@@ -458,7 +458,7 @@ repeat:
        }
        if (selectors[mmd->selector_num].pre_select) {
                ret = selectors[mmd->selector_num].pre_select(&rfds, &wfds);
        }
        if (selectors[mmd->selector_num].pre_select) {
                ret = selectors[mmd->selector_num].pre_select(&rfds, &wfds);
-               max_fileno = MAX(max_fileno, ret);
+               max_fileno = PARA_MAX(max_fileno, ret);
        }
        mmd_unlock();
        ret = para_select(max_fileno + 1, &rfds, &wfds, timeout);
        }
        mmd_unlock();
        ret = para_select(max_fileno + 1, &rfds, &wfds, timeout);
diff --git a/time.c b/time.c
index f659b16f09a6abb39c853d915c529a42dfe732b2..34e3de9523cb91a6c4142cf36ec6d540d21d7fe6 100644 (file)
--- a/time.c
+++ b/time.c
@@ -141,7 +141,7 @@ int tv_convex_combination(const long a, const struct timeval *tv1,
 {
        struct timeval tmp1, tmp2, tmp3;
        int ret = 1, subtract = ((a > 0 && b < 0) || (a < 0 && b > 0));
 {
        struct timeval tmp1, tmp2, tmp3;
        int ret = 1, subtract = ((a > 0 && b < 0) || (a < 0 && b > 0));
-       unsigned long a1 = ABS(a), b1 = ABS(b);
+       unsigned long a1 = PARA_ABS(a), b1 = PARA_ABS(b);
 
        tv_scale(a1, tv1, &tmp1);
        tv_scale(b1, tv2, &tmp2);
 
        tv_scale(a1, tv1, &tmp1);
        tv_scale(b1, tv2, &tmp2);
diff --git a/wav.c b/wav.c
index 879b1887b069b43b05101ea52e602a4c9c12add3..e229317dd6309380263673f359de4d4d8d50e59b 100644 (file)
--- a/wav.c
+++ b/wav.c
@@ -71,7 +71,7 @@ static ssize_t wav_convert(char *inbuf, size_t len, struct filter_node *fn)
                *bof = 0;
 //             return 0;
        }
                *bof = 0;
 //             return 0;
        }
-       copy = MIN(len, fn->bufsize - fn->loaded);
+       copy = PARA_MIN(len, fn->bufsize - fn->loaded);
        memmove(fn->buf + fn->loaded, inbuf, copy);
        fn->loaded += copy;
 //     PARA_DEBUG_LOG("len = %d, copy = %d\n", len, copy);
        memmove(fn->buf + fn->loaded, inbuf, copy);
        fn->loaded += copy;
 //     PARA_DEBUG_LOG("len = %d, copy = %d\n", len, copy);