]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - audiod_command.c
audioc stat: Remove __a_unused attributes from com_stat().
[paraslash.git] / audiod_command.c
index 3467dbe1a1990c566b353c7450a828828996bdbc..ca1bff5b807de5b75b833740bc5ac84c90345bb5 100644 (file)
@@ -166,23 +166,24 @@ int com_kill(int fd, int argc, char **argv)
        return ret;
 }
 
-int com_stat(int fd, __a_unused int argc, __a_unused char **argv)
+int com_stat(int fd, int argc, char **argv)
 {
        int i, ret;
        char *buf = NULL;
-       long unsigned mask = ~0LU;
+       uint64_t mask = 0;
+       const uint64_t one = 1;
 
        if (argc > 1) {
-               mask = 0;
                for (i = 1; i < argc; i++) {
                        ret = stat_item_valid(argv[i]);
                        if (ret < 0)
                                return ret;
-                       mask |= (1 << ret);
+                       mask |= (one << ret);
                }
-       }
-       PARA_INFO_LOG("mask: 0x%lx\n", mask);
-       if (mask & (1 << SI_PLAY_TIME)) {
+       } else
+               mask--; /* set all bits */
+       PARA_INFO_LOG("mask: 0x%llx\n", (long long unsigned)mask);
+       if (mask & (one << SI_PLAY_TIME)) {
                int slot_num = get_play_time_slot_num();
                char *ts = get_time_string(slot_num);
                if (ts) {
@@ -192,7 +193,7 @@ int com_stat(int fd, __a_unused int argc, __a_unused char **argv)
                        free(ts);
                }
        }
-       if (mask & (1 << SI_AUDIOD_UPTIME)) {
+       if (mask & (one << SI_AUDIOD_UPTIME)) {
                char *tmp, *us = uptime_str();
                tmp = make_message("%s: %s\n",
                        status_item_list[SI_AUDIOD_UPTIME], us);
@@ -202,14 +203,14 @@ int com_stat(int fd, __a_unused int argc, __a_unused char **argv)
                        goto out;
                free(tmp);
        }
-       if (mask & (1 << SI_AUDIOD_STATUS)) {
+       if (mask & (one << SI_AUDIOD_STATUS)) {
                char *s = audiod_status_string();
                ret = client_write(fd, s);
                if (ret < 0)
                        goto out;
                free(s);
        }
-       if (mask & (1 << SI_DECODER_FLAGS)) {
+       if (mask & (one << SI_DECODER_FLAGS)) {
                char *df = decoder_flags();
                ret = client_write(fd, df);
                if (ret < 0)
@@ -218,7 +219,7 @@ int com_stat(int fd, __a_unused int argc, __a_unused char **argv)
        }
        FOR_EACH_STATUS_ITEM(i) {
                char *tmp, *v;
-               if (!((1 << i) & mask))
+               if (!((one << i) & mask))
                        continue;
                v = stat_item_values[i];
                tmp = make_message("%s%s%s", buf? buf: "",