1
0
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:
2015-03-21 15:31:54 +01:00
parent f7548d5b37
commit 8d9ae094f9
2 changed files with 40 additions and 39 deletions

View File

@@ -66,9 +66,9 @@ int main(int argc, char **argv) {
mix = Mixer_create();
if (mix->devices_no == 0)
if (mix->devices_no == 0) {
fprintf(stderr, "%s: Sorry, no supported channels found.\n", NAME);
else {
} else {
checkVol(true);
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) {
char new_name[5], buf[5];
if (*count > 10)
snprintf(new_name, 5, "%s", name);
else {
snprintf(buf, 4, "%s", name);
snprintf(new_name, 5, "%s%d", buf, *count);
if (*count > 10) {
snprintf(new_name, sizeof(new_name), "%s", name);
} else {
snprintf(buf, sizeof(buf) - 1, "%s", name);
snprintf(new_name, sizeof(new_name), "%s%d", buf, *count);
}
selem->name = new_name;
@@ -372,7 +372,6 @@ slideCaptureMono Mixer_get_capabilities(snd_mixer_elem_t *elem) {
snd_mixer_selem_is_playback_mono(elem) )
retval.mono = true;
} else {
if (snd_mixer_selem_has_playback_volume(elem)) {
retval.isvolume = true;
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);
exit(1);
}
sprintf(card, "%s", argv[i]);
snprintf(card, sizeof(card), "%s", argv[i]);
smixer_options.device = card;
}
continue;
@@ -616,7 +615,7 @@ void scanArgs(int argc, char **argv) {
fprintf(stderr, "%s: Illegal color name.\n", NAME);
exit(1);
}
sprintf(ledcolor, "%s", argv[i]);
snprintf(ledcolor, sizeof(ledcolor), "%s", argv[i]);
}
continue;
}
@@ -628,7 +627,7 @@ void scanArgs(int argc, char **argv) {
fprintf(stderr, "%s: Illegal color name.\n", NAME);
exit(1);
}
sprintf(backcolor, "%s", argv[i]);
snprintf(backcolor, sizeof(backcolor), "%s", argv[i]);
}
continue;
}
@@ -640,7 +639,7 @@ void scanArgs(int argc, char **argv) {
fprintf(stderr, "%s: Illegal position.\n", NAME);
exit(1);
}
sprintf(position, "%s", argv[i]);
snprintf(position, sizeof(position), "%s", argv[i]);
}
continue;
}
@@ -652,7 +651,7 @@ void scanArgs(int argc, char **argv) {
fprintf(stderr, "%s: Illegal display name.\n", NAME);
exit(1);
}
sprintf(display, "%s", argv[i]);
snprintf(display, sizeof(display), "%s", argv[i]);
}
continue;
}
@@ -771,7 +770,9 @@ void repaint() {
XCopyArea(d_display, pm_disp, w_activewin, gc_gc, 0, 0, 64, 64,
winsize / 2 - 32, winsize / 2 - 32);
XEvent xev;
while(XCheckTypedEvent(d_display, Expose, &xev));
while (XCheckTypedEvent(d_display, Expose, &xev)) {
continue;
}
}
void update() {

View File

@@ -8,8 +8,8 @@
// under certain conditions
// See the README file for a more complete notice.
#ifndef WMAMIXER_H
#define WMAMIXER_H
#ifndef WMAMIXER_H_
#define WMAMIXER_H_
#include <stdio.h>
#include <stdlib.h>
@@ -147,7 +147,7 @@ struct NamesCount {
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};
struct Mixer {
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_destroy();
#endif /* WMAMIXER_H */
#endif // WMAMIXER_H_