mirror of
https://github.com/gryf/wmamixer.git
synced 2025-12-18 03:50:20 +01:00
Several style issues fixes
This commit is contained in:
29
wmamixer.c
29
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;
|
||||||
@@ -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;
|
||||||
@@ -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) ||
|
||||||
@@ -603,7 +602,7 @@ 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;
|
||||||
@@ -616,7 +615,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(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