mirror of
https://github.com/gryf/wmamixer.git
synced 2025-12-17 11:30:21 +01:00
Several style issues fixes
This commit is contained in:
45
wmamixer.c
45
wmamixer.c
@@ -66,9 +66,9 @@ int main(int argc, char **argv) {
|
|||||||
|
|
||||||
mix = Mixer_create();
|
mix = Mixer_create();
|
||||||
|
|
||||||
if (mix->devices_no == 0)
|
if (mix->devices_no == 0) {
|
||||||
fprintf(stderr,"%s: Sorry, no supported channels found.\n", NAME);
|
fprintf(stderr, "%s: Sorry, no supported channels found.\n", NAME);
|
||||||
else {
|
} else {
|
||||||
checkVol(true);
|
checkVol(true);
|
||||||
|
|
||||||
XEvent xev;
|
XEvent xev;
|
||||||
@@ -78,9 +78,9 @@ int main(int argc, char **argv) {
|
|||||||
|
|
||||||
bool done = false;
|
bool done = false;
|
||||||
while (!done) {
|
while (!done) {
|
||||||
while(XPending(d_display) ) {
|
while (XPending(d_display)) {
|
||||||
XNextEvent(d_display, &xev);
|
XNextEvent(d_display, &xev);
|
||||||
switch(xev.type ) {
|
switch (xev.type) {
|
||||||
case Expose:
|
case Expose:
|
||||||
repaint();
|
repaint();
|
||||||
break;
|
break;
|
||||||
@@ -95,7 +95,7 @@ int main(int argc, char **argv) {
|
|||||||
break;
|
break;
|
||||||
case ClientMessage:
|
case ClientMessage:
|
||||||
if (xev.xclient.data.l[0] == (int) deleteWin)
|
if (xev.xclient.data.l[0] == (int) deleteWin)
|
||||||
done=true;
|
done = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -305,11 +305,11 @@ void Mixer_set_selem_props(struct Selem *selem, const char *name) {
|
|||||||
void Selem_set_name(struct Selem *selem, const char *name, short int *count) {
|
void Selem_set_name(struct Selem *selem, const char *name, short int *count) {
|
||||||
char new_name[5], buf[5];
|
char new_name[5], buf[5];
|
||||||
|
|
||||||
if (*count > 10)
|
if (*count > 10) {
|
||||||
snprintf(new_name, 5, "%s", name);
|
snprintf(new_name, sizeof(new_name), "%s", name);
|
||||||
else {
|
} else {
|
||||||
snprintf(buf, 4, "%s", name);
|
snprintf(buf, sizeof(buf) - 1, "%s", name);
|
||||||
snprintf(new_name, 5, "%s%d", buf, *count);
|
snprintf(new_name, sizeof(new_name), "%s%d", buf, *count);
|
||||||
}
|
}
|
||||||
|
|
||||||
selem->name = new_name;
|
selem->name = new_name;
|
||||||
@@ -329,7 +329,7 @@ void Mixer_set_channels(struct Selem *selem) {
|
|||||||
selem->channels[1] = SND_MIXER_SCHN_MONO;
|
selem->channels[1] = SND_MIXER_SCHN_MONO;
|
||||||
} else {
|
} else {
|
||||||
idx = 0;
|
idx = 0;
|
||||||
for (chn = 0; chn <= SND_MIXER_SCHN_LAST; chn++){
|
for (chn = 0; chn <= SND_MIXER_SCHN_LAST; chn++) {
|
||||||
if (!snd_mixer_selem_has_playback_channel(selem->elem, chn))
|
if (!snd_mixer_selem_has_playback_channel(selem->elem, chn))
|
||||||
continue;
|
continue;
|
||||||
selem->channels[idx] = chn;
|
selem->channels[idx] = chn;
|
||||||
@@ -347,7 +347,7 @@ void Mixer_set_channels(struct Selem *selem) {
|
|||||||
selem->channels[1] = SND_MIXER_SCHN_MONO;
|
selem->channels[1] = SND_MIXER_SCHN_MONO;
|
||||||
} else {
|
} else {
|
||||||
idx = 0;
|
idx = 0;
|
||||||
for (chn = 0; chn <= SND_MIXER_SCHN_LAST; chn++){
|
for (chn = 0; chn <= SND_MIXER_SCHN_LAST; chn++) {
|
||||||
if (!snd_mixer_selem_has_capture_channel(selem->elem, chn))
|
if (!snd_mixer_selem_has_capture_channel(selem->elem, chn))
|
||||||
continue;
|
continue;
|
||||||
selem->channels[idx] = chn;
|
selem->channels[idx] = chn;
|
||||||
@@ -372,7 +372,6 @@ slideCaptureMono Mixer_get_capabilities(snd_mixer_elem_t *elem) {
|
|||||||
snd_mixer_selem_is_playback_mono(elem) )
|
snd_mixer_selem_is_playback_mono(elem) )
|
||||||
retval.mono = true;
|
retval.mono = true;
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
if (snd_mixer_selem_has_playback_volume(elem)) {
|
if (snd_mixer_selem_has_playback_volume(elem)) {
|
||||||
retval.isvolume = true;
|
retval.isvolume = true;
|
||||||
if (snd_mixer_selem_has_playback_volume_joined(elem) ||
|
if (snd_mixer_selem_has_playback_volume_joined(elem) ||
|
||||||
@@ -497,7 +496,7 @@ void initXWin(int argc, char **argv) {
|
|||||||
false);
|
false);
|
||||||
deleteWin = XInternAtom(d_display, "WM_DELETE_WINDOW", false);
|
deleteWin = XInternAtom(d_display, "WM_DELETE_WINDOW", false);
|
||||||
|
|
||||||
w_root=DefaultRootWindow(d_display);
|
w_root = DefaultRootWindow(d_display);
|
||||||
|
|
||||||
shints.x = 0;
|
shints.x = 0;
|
||||||
shints.y = 0;
|
shints.y = 0;
|
||||||
@@ -603,20 +602,20 @@ void scanArgs(int argc, char **argv) {
|
|||||||
fprintf(stderr, "%s: Illegal device name.\n", NAME);
|
fprintf(stderr, "%s: Illegal device name.\n", NAME);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
sprintf(card, "%s", argv[i]);
|
snprintf(card, sizeof(card), "%s", argv[i]);
|
||||||
smixer_options.device = card;
|
smixer_options.device = card;
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strcmp(argv[i], "-l") == 0) {
|
if (strcmp(argv[i], "-l") == 0) {
|
||||||
if ( i < argc - 1) {
|
if (i < argc - 1) {
|
||||||
i++;
|
i++;
|
||||||
if (strlen(argv[i]) > 255) {
|
if (strlen(argv[i]) > 255) {
|
||||||
fprintf(stderr, "%s: Illegal color name.\n", NAME);
|
fprintf(stderr, "%s: Illegal color name.\n", NAME);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
sprintf(ledcolor, "%s", argv[i]);
|
snprintf(ledcolor, sizeof(ledcolor), "%s", argv[i]);
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -628,7 +627,7 @@ void scanArgs(int argc, char **argv) {
|
|||||||
fprintf(stderr, "%s: Illegal color name.\n", NAME);
|
fprintf(stderr, "%s: Illegal color name.\n", NAME);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
sprintf(backcolor, "%s", argv[i]);
|
snprintf(backcolor, sizeof(backcolor), "%s", argv[i]);
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -640,7 +639,7 @@ void scanArgs(int argc, char **argv) {
|
|||||||
fprintf(stderr, "%s: Illegal position.\n", NAME);
|
fprintf(stderr, "%s: Illegal position.\n", NAME);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
sprintf(position, "%s", argv[i]);
|
snprintf(position, sizeof(position), "%s", argv[i]);
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -652,7 +651,7 @@ void scanArgs(int argc, char **argv) {
|
|||||||
fprintf(stderr, "%s: Illegal display name.\n", NAME);
|
fprintf(stderr, "%s: Illegal display name.\n", NAME);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
sprintf(display, "%s", argv[i]);
|
snprintf(display, sizeof(display), "%s", argv[i]);
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -771,7 +770,9 @@ void repaint() {
|
|||||||
XCopyArea(d_display, pm_disp, w_activewin, gc_gc, 0, 0, 64, 64,
|
XCopyArea(d_display, pm_disp, w_activewin, gc_gc, 0, 0, 64, 64,
|
||||||
winsize / 2 - 32, winsize / 2 - 32);
|
winsize / 2 - 32, winsize / 2 - 32);
|
||||||
XEvent xev;
|
XEvent xev;
|
||||||
while(XCheckTypedEvent(d_display, Expose, &xev));
|
while (XCheckTypedEvent(d_display, Expose, &xev)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void update() {
|
void update() {
|
||||||
|
|||||||
@@ -8,8 +8,8 @@
|
|||||||
// under certain conditions
|
// under certain conditions
|
||||||
// See the README file for a more complete notice.
|
// See the README file for a more complete notice.
|
||||||
|
|
||||||
#ifndef WMAMIXER_H
|
#ifndef WMAMIXER_H_
|
||||||
#define WMAMIXER_H
|
#define WMAMIXER_H_
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@@ -147,7 +147,7 @@ struct NamesCount {
|
|||||||
|
|
||||||
struct Selem *selems[32] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
struct Selem *selems[32] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||||
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||||
NULL, NULL};
|
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL};
|
||||||
|
|
||||||
struct Mixer {
|
struct Mixer {
|
||||||
int devices_no;
|
int devices_no;
|
||||||
@@ -197,4 +197,4 @@ void Mixer_set_volume(int current, int channelIndex, int value);
|
|||||||
void Selem_set_name(struct Selem *selem, const char *name, short int *count);
|
void Selem_set_name(struct Selem *selem, const char *name, short int *count);
|
||||||
void Selem_destroy();
|
void Selem_destroy();
|
||||||
|
|
||||||
#endif /* WMAMIXER_H */
|
#endif // WMAMIXER_H_
|
||||||
|
|||||||
Reference in New Issue
Block a user