All of lore.kernel.org
 help / color / mirror / Atom feed
* [alsa-devel] [PATCH alsa-utils 1/4] Use __func__ instead of __FUNCTION__
@ 2020-02-05  8:12 Michael Forney
  2020-02-05  8:12 ` [alsa-devel] [PATCH alsa-utils 2/4] Avoid pointer arithmetic on `void *` Michael Forney
                   ` (3 more replies)
  0 siblings, 4 replies; 12+ messages in thread
From: Michael Forney @ 2020-02-05  8:12 UTC (permalink / raw)
  To: alsa-devel

They are equivalent, but __func__ is in C99. __FUNCTION__ exists only
for backwards compatibility with old gcc versions.

Signed-off-by: Michael Forney <mforney@mforney.org>
---
 alsactl/alsactl.h | 16 ++++++++--------
 aplay/aplay.c     |  4 ++--
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/alsactl/alsactl.h b/alsactl/alsactl.h
index 4f969ec..69b539c 100644
--- a/alsactl/alsactl.h
+++ b/alsactl/alsactl.h
@@ -13,15 +13,15 @@ void cerror_(const char *fcn, long line, int cond, const char *fmt, ...);
 void dbg_(const char *fcn, long line, const char *fmt, ...);
 
 #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)
-#define info(...) do { info_(__FUNCTION__, __LINE__, __VA_ARGS__); } while (0)
-#define error(...) do { error_(__FUNCTION__, __LINE__, __VA_ARGS__); } while (0)
-#define cerror(cond, ...) do { cerror_(__FUNCTION__, __LINE__, (cond) != 0, __VA_ARGS__); } while (0)
-#define dbg(...) do { dbg_(__FUNCTION__, __LINE__, __VA_ARGS__); } while (0)
+#define info(...) do { info_(__func__, __LINE__, __VA_ARGS__); } while (0)
+#define error(...) do { error_(__func__, __LINE__, __VA_ARGS__); } while (0)
+#define cerror(cond, ...) do { cerror_(__func__, __LINE__, (cond) != 0, __VA_ARGS__); } while (0)
+#define dbg(...) do { dbg_(__func__, __LINE__, __VA_ARGS__); } while (0)
 #else
-#define info(args...) do { info_(__FUNCTION__, __LINE__, ##args); }  while (0)
-#define error(args...) do { error_(__FUNCTION__, __LINE__, ##args); }  while (0)
-#define cerror(cond, ...) do { error_(__FUNCTION__, __LINE__, (cond) != 0, ##args); } while (0)
-#define dbg(args...) do { dbg_(__FUNCTION__, __LINE__, ##args); }  while (0)
+#define info(args...) do { info_(__func__, __LINE__, ##args); }  while (0)
+#define error(args...) do { error_(__func__, __LINE__, ##args); }  while (0)
+#define cerror(cond, ...) do { error_(__func__, __LINE__, (cond) != 0, ##args); } while (0)
+#define dbg(args...) do { dbg_(__func__, __LINE__, ##args); }  while (0)
 #endif	
 
 int init(const char *file, const char *cardname);
diff --git a/aplay/aplay.c b/aplay/aplay.c
index 1a887e4..908093c 100644
--- a/aplay/aplay.c
+++ b/aplay/aplay.c
@@ -186,13 +186,13 @@ static const struct fmt_capture {
 
 #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)
 #define error(...) do {\
-	fprintf(stderr, "%s: %s:%d: ", command, __FUNCTION__, __LINE__); \
+	fprintf(stderr, "%s: %s:%d: ", command, __func__, __LINE__); \
 	fprintf(stderr, __VA_ARGS__); \
 	putc('\n', stderr); \
 } while (0)
 #else
 #define error(args...) do {\
-	fprintf(stderr, "%s: %s:%d: ", command, __FUNCTION__, __LINE__); \
+	fprintf(stderr, "%s: %s:%d: ", command, __func__, __LINE__); \
 	fprintf(stderr, ##args); \
 	putc('\n', stderr); \
 } while (0)
-- 
2.25.0

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [alsa-devel] [PATCH alsa-utils 2/4] Avoid pointer arithmetic on `void *`
  2020-02-05  8:12 [alsa-devel] [PATCH alsa-utils 1/4] Use __func__ instead of __FUNCTION__ Michael Forney
@ 2020-02-05  8:12 ` Michael Forney
  2020-02-05 10:21   ` Takashi Sakamoto
  2020-02-05 15:50   ` Clemens Ladisch
  2020-02-05  8:12 ` [alsa-devel] [PATCH alsa-utils 3/4] Use %lli for long long in printf Michael Forney
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 12+ messages in thread
From: Michael Forney @ 2020-02-05  8:12 UTC (permalink / raw)
  To: alsa-devel

The pointer operand to the binary `+` operator must be to a complete
object type.

Signed-off-by: Michael Forney <mforney@mforney.org>
---
 aplay/aplay.c                     | 4 ++--
 axfer/xfer-libasound-irq-mmap.c   | 7 ++++---
 axfer/xfer-libasound-timer-mmap.c | 4 ++--
 bat/common.c                      | 2 +-
 seq/aplaymidi/aplaymidi.c         | 2 +-
 5 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/aplay/aplay.c b/aplay/aplay.c
index 908093c..08395f6 100644
--- a/aplay/aplay.c
+++ b/aplay/aplay.c
@@ -442,7 +442,7 @@ static ssize_t xwrite(int fd, const void *buf, size_t count)
 	size_t offset = 0;
 
 	while (offset < count) {
-		written = write(fd, buf + offset, count - offset);
+		written = write(fd, (char *)buf + offset, count - offset);
 		if (written <= 0)
 			return written;
 
@@ -1210,7 +1210,7 @@ static int test_au(int fd, void *buffer)
 	hwparams.channels = BE_INT(ap->channels);
 	if (hwparams.channels < 1 || hwparams.channels > 256)
 		return -1;
-	if ((size_t)safe_read(fd, buffer + sizeof(AuHeader), BE_INT(ap->hdr_size) - sizeof(AuHeader)) != BE_INT(ap->hdr_size) - sizeof(AuHeader)) {
+	if ((size_t)safe_read(fd, (char *)buffer + sizeof(AuHeader), BE_INT(ap->hdr_size) - sizeof(AuHeader)) != BE_INT(ap->hdr_size) - sizeof(AuHeader)) {
 		error(_("read error"));
 		prg_exit(EXIT_FAILURE);
 	}
diff --git a/axfer/xfer-libasound-irq-mmap.c b/axfer/xfer-libasound-irq-mmap.c
index a13b3c3..386e741 100644
--- a/axfer/xfer-libasound-irq-mmap.c
+++ b/axfer/xfer-libasound-irq-mmap.c
@@ -146,9 +146,10 @@ static int irq_mmap_process_frames(struct libasound_state *state,
 	// TODO: Perhaps, the complex layout can be supported as a variation of
 	// vector type. However, there's no driver with this layout.
 	if (layout->vector == NULL) {
-		frame_buf = areas[0].addr;
-		frame_buf += snd_pcm_frames_to_bytes(state->handle,
-						     frame_offset);
+		char *buf;
+		buf = areas[0].addr;
+		buf += snd_pcm_frames_to_bytes(state->handle, frame_offset);
+		frame_buf = buf;
 	} else {
 		int i;
 		for (i = 0; i < layout->samples_per_frame; ++i) {
diff --git a/axfer/xfer-libasound-timer-mmap.c b/axfer/xfer-libasound-timer-mmap.c
index 1c642fe..ba26e29 100644
--- a/axfer/xfer-libasound-timer-mmap.c
+++ b/axfer/xfer-libasound-timer-mmap.c
@@ -100,8 +100,8 @@ static void *get_buffer(struct libasound_state *state,
 
 	if (layout->vector == NULL) {
 		char *buf;
-		buf = areas[0].addr + snd_pcm_frames_to_bytes(state->handle,
-							      frame_offset);
+		buf = areas[0].addr;
+		buf += snd_pcm_frames_to_bytes(state->handle, frame_offset);
 		frame_buf = buf;
 	} else {
 		int i;
diff --git a/bat/common.c b/bat/common.c
index d3d1f28..339e749 100644
--- a/bat/common.c
+++ b/bat/common.c
@@ -231,7 +231,7 @@ int generate_input_data(struct bat *bat, void *buffer, int bytes, int frames)
 		load = 0;
 
 		while (1) {
-			err = fread(buffer + load, 1, bytes - load, bat->fp);
+			err = fread((char *)buffer + load, 1, bytes - load, bat->fp);
 			if (0 == err) {
 				if (feof(bat->fp)) {
 					fprintf(bat->log,
diff --git a/seq/aplaymidi/aplaymidi.c b/seq/aplaymidi/aplaymidi.c
index 12d6fac..b086e70 100644
--- a/seq/aplaymidi/aplaymidi.c
+++ b/seq/aplaymidi/aplaymidi.c
@@ -633,7 +633,7 @@ static void handle_big_sysex(snd_seq_event_t *ev)
 		check_snd("sync output", err);
 		if (sleep(1))
 			fatal("aborted");
-		ev->data.ext.ptr += MIDI_BYTES_PER_SEC;
+		ev->data.ext.ptr = (char *)ev->data.ext.ptr + MIDI_BYTES_PER_SEC;
 		length -= MIDI_BYTES_PER_SEC;
 	}
 	ev->data.ext.len = length;
-- 
2.25.0

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [alsa-devel] [PATCH alsa-utils 3/4] Use %lli for long long in printf
  2020-02-05  8:12 [alsa-devel] [PATCH alsa-utils 1/4] Use __func__ instead of __FUNCTION__ Michael Forney
  2020-02-05  8:12 ` [alsa-devel] [PATCH alsa-utils 2/4] Avoid pointer arithmetic on `void *` Michael Forney
@ 2020-02-05  8:12 ` Michael Forney
  2020-02-05 10:24   ` Takashi Sakamoto
  2020-02-05  8:12 ` [alsa-devel] [PATCH alsa-utils 4/4] Avoid empty initializer list Michael Forney
  2020-02-05 10:19 ` [alsa-devel] [PATCH alsa-utils 1/4] Use __func__ instead of __FUNCTION__ Takashi Sakamoto
  3 siblings, 1 reply; 12+ messages in thread
From: Michael Forney @ 2020-02-05  8:12 UTC (permalink / raw)
  To: alsa-devel

The `L` length modifier only applies to floating-point conversion
specifiers, and `ll` is used for `long long` integers.

Although glibc accepts %Li, musl does not and returns EINVAL.

Signed-off-by: Michael Forney <mforney@mforney.org>
---
 alsactl/state.c | 4 ++--
 amixer/amixer.c | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/alsactl/state.c b/alsactl/state.c
index 38e85c0..22e0269 100644
--- a/alsactl/state.c
+++ b/alsactl/state.c
@@ -336,9 +336,9 @@ static int get_control(snd_ctl_t *handle, snd_ctl_elem_id_t *id, snd_config_t *t
 		long long max = snd_ctl_elem_info_get_max64(info);
 		long long step = snd_ctl_elem_info_get_step64(info);
 		if (step)
-			sprintf(buf, "%Li - %Li (step %Li)", min, max, step);
+			sprintf(buf, "%lli - %lli (step %lli)", min, max, step);
 		else
-			sprintf(buf, "%Li - %Li", min, max);
+			sprintf(buf, "%lli - %lli", min, max);
 		err = snd_config_string_add(comment, "range", buf);
 		if (err < 0) {
 			error("snd_config_string_add: %s", snd_strerror(err));
diff --git a/amixer/amixer.c b/amixer/amixer.c
index 928f7c5..4c19a58 100644
--- a/amixer/amixer.c
+++ b/amixer/amixer.c
@@ -620,7 +620,7 @@ static int show_control(const char *space, snd_hctl_elem_t *elem,
 		       snd_ctl_elem_info_get_step(info));
 		break;
 	case SND_CTL_ELEM_TYPE_INTEGER64:
-		printf(",min=%Li,max=%Li,step=%Li\n", 
+		printf(",min=%lli,max=%lli,step=%lli\n",
 		       snd_ctl_elem_info_get_min64(info),
 		       snd_ctl_elem_info_get_max64(info),
 		       snd_ctl_elem_info_get_step64(info));
@@ -662,7 +662,7 @@ static int show_control(const char *space, snd_hctl_elem_t *elem,
 				printf("%li", snd_ctl_elem_value_get_integer(control, idx));
 				break;
 			case SND_CTL_ELEM_TYPE_INTEGER64:
-				printf("%Li", snd_ctl_elem_value_get_integer64(control, idx));
+				printf("%lli", snd_ctl_elem_value_get_integer64(control, idx));
 				break;
 			case SND_CTL_ELEM_TYPE_ENUMERATED:
 				printf("%u", snd_ctl_elem_value_get_enumerated(control, idx));
-- 
2.25.0

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [alsa-devel] [PATCH alsa-utils 4/4] Avoid empty initializer list
  2020-02-05  8:12 [alsa-devel] [PATCH alsa-utils 1/4] Use __func__ instead of __FUNCTION__ Michael Forney
  2020-02-05  8:12 ` [alsa-devel] [PATCH alsa-utils 2/4] Avoid pointer arithmetic on `void *` Michael Forney
  2020-02-05  8:12 ` [alsa-devel] [PATCH alsa-utils 3/4] Use %lli for long long in printf Michael Forney
@ 2020-02-05  8:12 ` Michael Forney
  2020-02-05 10:25   ` Takashi Sakamoto
  2020-02-05 10:19 ` [alsa-devel] [PATCH alsa-utils 1/4] Use __func__ instead of __FUNCTION__ Takashi Sakamoto
  3 siblings, 1 reply; 12+ messages in thread
From: Michael Forney @ 2020-02-05  8:12 UTC (permalink / raw)
  To: alsa-devel

To zero-initialize an object, use `{0}` instead.

Signed-off-by: Michael Forney <mforney@mforney.org>
---
 alsamixer/cli.c             | 2 +-
 amidi/amidi.c               | 2 +-
 seq/aplaymidi/aplaymidi.c   | 2 +-
 seq/aplaymidi/arecordmidi.c | 2 +-
 seq/aseqdump/aseqdump.c     | 2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/alsamixer/cli.c b/alsamixer/cli.c
index 3f8f52f..7468325 100644
--- a/alsamixer/cli.c
+++ b/alsamixer/cli.c
@@ -58,7 +58,7 @@ static void parse_options(int argc, char *argv[])
 		{ .name = "view", .has_arg = 1, .val = 'V' },
 		{ .name = "no-color", .val = 'g' },
 		{ .name = "abstraction", .has_arg = 1, .val = 'a' },
-		{ }
+		{ 0 }
 	};
 	int option;
 	int card_index;
diff --git a/amidi/amidi.c b/amidi/amidi.c
index c6268e4..cde4697 100644
--- a/amidi/amidi.c
+++ b/amidi/amidi.c
@@ -469,7 +469,7 @@ int main(int argc, char *argv[])
 		{"active-sensing", 0, NULL, 'a'},
 		{"clock", 0, NULL, 'c'},
 		{"sysex-interval", 1, NULL, 'i'},
-		{ }
+		{0}
 	};
 	int c, err, ok = 0;
 	int ignore_active_sensing = 1;
diff --git a/seq/aplaymidi/aplaymidi.c b/seq/aplaymidi/aplaymidi.c
index b086e70..e8491e1 100644
--- a/seq/aplaymidi/aplaymidi.c
+++ b/seq/aplaymidi/aplaymidi.c
@@ -869,7 +869,7 @@ int main(int argc, char *argv[])
 		{"list", 0, NULL, 'l'},
 		{"port", 1, NULL, 'p'},
 		{"delay", 1, NULL, 'd'},
-		{}
+		{0}
 	};
 	int c;
 	int do_list = 0;
diff --git a/seq/aplaymidi/arecordmidi.c b/seq/aplaymidi/arecordmidi.c
index 604cd0d..2034df7 100644
--- a/seq/aplaymidi/arecordmidi.c
+++ b/seq/aplaymidi/arecordmidi.c
@@ -740,7 +740,7 @@ int main(int argc, char *argv[])
 		{"metronome", 1, NULL, 'm'},
 		{"timesig", 1, NULL, 'i'},
 		{"num-events", 1, NULL, 'n'},
-		{ }
+		{0}
 	};
 
 	char *filename = NULL;
diff --git a/seq/aseqdump/aseqdump.c b/seq/aseqdump/aseqdump.c
index 578e06f..44ae3bb 100644
--- a/seq/aseqdump/aseqdump.c
+++ b/seq/aseqdump/aseqdump.c
@@ -357,7 +357,7 @@ int main(int argc, char *argv[])
 		{"version", 0, NULL, 'V'},
 		{"list", 0, NULL, 'l'},
 		{"port", 1, NULL, 'p'},
-		{ }
+		{0}
 	};
 
 	int do_list = 0;
-- 
2.25.0

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [alsa-devel] [PATCH alsa-utils 1/4] Use __func__ instead of __FUNCTION__
  2020-02-05  8:12 [alsa-devel] [PATCH alsa-utils 1/4] Use __func__ instead of __FUNCTION__ Michael Forney
                   ` (2 preceding siblings ...)
  2020-02-05  8:12 ` [alsa-devel] [PATCH alsa-utils 4/4] Avoid empty initializer list Michael Forney
@ 2020-02-05 10:19 ` Takashi Sakamoto
  3 siblings, 0 replies; 12+ messages in thread
From: Takashi Sakamoto @ 2020-02-05 10:19 UTC (permalink / raw)
  To: Michael Forney; +Cc: alsa-devel

On Wed, Feb 05, 2020 at 12:12:18AM -0800, Michael Forney wrote:
> They are equivalent, but __func__ is in C99. __FUNCTION__ exists only
> for backwards compatibility with old gcc versions.
> 
> Signed-off-by: Michael Forney <mforney@mforney.org>

Reviewd-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>

For out information:
https://gcc.gnu.org/onlinedocs/gcc/Function-Names.html

> ---
>  alsactl/alsactl.h | 16 ++++++++--------
>  aplay/aplay.c     |  4 ++--
>  2 files changed, 10 insertions(+), 10 deletions(-)
> 
> diff --git a/alsactl/alsactl.h b/alsactl/alsactl.h
> index 4f969ec..69b539c 100644
> --- a/alsactl/alsactl.h
> +++ b/alsactl/alsactl.h
> @@ -13,15 +13,15 @@ void cerror_(const char *fcn, long line, int cond, const char *fmt, ...);
>  void dbg_(const char *fcn, long line, const char *fmt, ...);
>  
>  #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)
> -#define info(...) do { info_(__FUNCTION__, __LINE__, __VA_ARGS__); } while (0)
> -#define error(...) do { error_(__FUNCTION__, __LINE__, __VA_ARGS__); } while (0)
> -#define cerror(cond, ...) do { cerror_(__FUNCTION__, __LINE__, (cond) != 0, __VA_ARGS__); } while (0)
> -#define dbg(...) do { dbg_(__FUNCTION__, __LINE__, __VA_ARGS__); } while (0)
> +#define info(...) do { info_(__func__, __LINE__, __VA_ARGS__); } while (0)
> +#define error(...) do { error_(__func__, __LINE__, __VA_ARGS__); } while (0)
> +#define cerror(cond, ...) do { cerror_(__func__, __LINE__, (cond) != 0, __VA_ARGS__); } while (0)
> +#define dbg(...) do { dbg_(__func__, __LINE__, __VA_ARGS__); } while (0)
>  #else
> -#define info(args...) do { info_(__FUNCTION__, __LINE__, ##args); }  while (0)
> -#define error(args...) do { error_(__FUNCTION__, __LINE__, ##args); }  while (0)
> -#define cerror(cond, ...) do { error_(__FUNCTION__, __LINE__, (cond) != 0, ##args); } while (0)
> -#define dbg(args...) do { dbg_(__FUNCTION__, __LINE__, ##args); }  while (0)
> +#define info(args...) do { info_(__func__, __LINE__, ##args); }  while (0)
> +#define error(args...) do { error_(__func__, __LINE__, ##args); }  while (0)
> +#define cerror(cond, ...) do { error_(__func__, __LINE__, (cond) != 0, ##args); } while (0)
> +#define dbg(args...) do { dbg_(__func__, __LINE__, ##args); }  while (0)
>  #endif	
>  
>  int init(const char *file, const char *cardname);
> diff --git a/aplay/aplay.c b/aplay/aplay.c
> index 1a887e4..908093c 100644
> --- a/aplay/aplay.c
> +++ b/aplay/aplay.c
> @@ -186,13 +186,13 @@ static const struct fmt_capture {
>  
>  #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)
>  #define error(...) do {\
> -	fprintf(stderr, "%s: %s:%d: ", command, __FUNCTION__, __LINE__); \
> +	fprintf(stderr, "%s: %s:%d: ", command, __func__, __LINE__); \
>  	fprintf(stderr, __VA_ARGS__); \
>  	putc('\n', stderr); \
>  } while (0)
>  #else
>  #define error(args...) do {\
> -	fprintf(stderr, "%s: %s:%d: ", command, __FUNCTION__, __LINE__); \
> +	fprintf(stderr, "%s: %s:%d: ", command, __func__, __LINE__); \
>  	fprintf(stderr, ##args); \
>  	putc('\n', stderr); \
>  } while (0)
> -- 
> 2.25.0
> 
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@alsa-project.org
> https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [alsa-devel] [PATCH alsa-utils 2/4] Avoid pointer arithmetic on `void *`
  2020-02-05  8:12 ` [alsa-devel] [PATCH alsa-utils 2/4] Avoid pointer arithmetic on `void *` Michael Forney
@ 2020-02-05 10:21   ` Takashi Sakamoto
  2020-02-05 15:50   ` Clemens Ladisch
  1 sibling, 0 replies; 12+ messages in thread
From: Takashi Sakamoto @ 2020-02-05 10:21 UTC (permalink / raw)
  To: Michael Forney; +Cc: alsa-devel

On Wed, Feb 05, 2020 at 12:12:19AM -0800, Michael Forney wrote:
> The pointer operand to the binary `+` operator must be to a complete
> object type.
> 
> Signed-off-by: Michael Forney <mforney@mforney.org>
> ---
>  aplay/aplay.c                     | 4 ++--
>  axfer/xfer-libasound-irq-mmap.c   | 7 ++++---
>  axfer/xfer-libasound-timer-mmap.c | 4 ++--
>  bat/common.c                      | 2 +-
>  seq/aplaymidi/aplaymidi.c         | 2 +-
>  5 files changed, 10 insertions(+), 9 deletions(-)

These changes look good to me.

Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>

> diff --git a/aplay/aplay.c b/aplay/aplay.c
> index 908093c..08395f6 100644
> --- a/aplay/aplay.c
> +++ b/aplay/aplay.c
> @@ -442,7 +442,7 @@ static ssize_t xwrite(int fd, const void *buf, size_t count)
>  	size_t offset = 0;
>  
>  	while (offset < count) {
> -		written = write(fd, buf + offset, count - offset);
> +		written = write(fd, (char *)buf + offset, count - offset);
>  		if (written <= 0)
>  			return written;
>  
> @@ -1210,7 +1210,7 @@ static int test_au(int fd, void *buffer)
>  	hwparams.channels = BE_INT(ap->channels);
>  	if (hwparams.channels < 1 || hwparams.channels > 256)
>  		return -1;
> -	if ((size_t)safe_read(fd, buffer + sizeof(AuHeader), BE_INT(ap->hdr_size) - sizeof(AuHeader)) != BE_INT(ap->hdr_size) - sizeof(AuHeader)) {
> +	if ((size_t)safe_read(fd, (char *)buffer + sizeof(AuHeader), BE_INT(ap->hdr_size) - sizeof(AuHeader)) != BE_INT(ap->hdr_size) - sizeof(AuHeader)) {
>  		error(_("read error"));
>  		prg_exit(EXIT_FAILURE);
>  	}
> diff --git a/axfer/xfer-libasound-irq-mmap.c b/axfer/xfer-libasound-irq-mmap.c
> index a13b3c3..386e741 100644
> --- a/axfer/xfer-libasound-irq-mmap.c
> +++ b/axfer/xfer-libasound-irq-mmap.c
> @@ -146,9 +146,10 @@ static int irq_mmap_process_frames(struct libasound_state *state,
>  	// TODO: Perhaps, the complex layout can be supported as a variation of
>  	// vector type. However, there's no driver with this layout.
>  	if (layout->vector == NULL) {
> -		frame_buf = areas[0].addr;
> -		frame_buf += snd_pcm_frames_to_bytes(state->handle,
> -						     frame_offset);
> +		char *buf;
> +		buf = areas[0].addr;
> +		buf += snd_pcm_frames_to_bytes(state->handle, frame_offset);
> +		frame_buf = buf;
>  	} else {
>  		int i;
>  		for (i = 0; i < layout->samples_per_frame; ++i) {
> diff --git a/axfer/xfer-libasound-timer-mmap.c b/axfer/xfer-libasound-timer-mmap.c
> index 1c642fe..ba26e29 100644
> --- a/axfer/xfer-libasound-timer-mmap.c
> +++ b/axfer/xfer-libasound-timer-mmap.c
> @@ -100,8 +100,8 @@ static void *get_buffer(struct libasound_state *state,
>  
>  	if (layout->vector == NULL) {
>  		char *buf;
> -		buf = areas[0].addr + snd_pcm_frames_to_bytes(state->handle,
> -							      frame_offset);
> +		buf = areas[0].addr;
> +		buf += snd_pcm_frames_to_bytes(state->handle, frame_offset);
>  		frame_buf = buf;
>  	} else {
>  		int i;
> diff --git a/bat/common.c b/bat/common.c
> index d3d1f28..339e749 100644
> --- a/bat/common.c
> +++ b/bat/common.c
> @@ -231,7 +231,7 @@ int generate_input_data(struct bat *bat, void *buffer, int bytes, int frames)
>  		load = 0;
>  
>  		while (1) {
> -			err = fread(buffer + load, 1, bytes - load, bat->fp);
> +			err = fread((char *)buffer + load, 1, bytes - load, bat->fp);
>  			if (0 == err) {
>  				if (feof(bat->fp)) {
>  					fprintf(bat->log,
> diff --git a/seq/aplaymidi/aplaymidi.c b/seq/aplaymidi/aplaymidi.c
> index 12d6fac..b086e70 100644
> --- a/seq/aplaymidi/aplaymidi.c
> +++ b/seq/aplaymidi/aplaymidi.c
> @@ -633,7 +633,7 @@ static void handle_big_sysex(snd_seq_event_t *ev)
>  		check_snd("sync output", err);
>  		if (sleep(1))
>  			fatal("aborted");
> -		ev->data.ext.ptr += MIDI_BYTES_PER_SEC;
> +		ev->data.ext.ptr = (char *)ev->data.ext.ptr + MIDI_BYTES_PER_SEC;
>  		length -= MIDI_BYTES_PER_SEC;
>  	}
>  	ev->data.ext.len = length;
> -- 
> 2.25.0
> 
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@alsa-project.org
> https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [alsa-devel] [PATCH alsa-utils 3/4] Use %lli for long long in printf
  2020-02-05  8:12 ` [alsa-devel] [PATCH alsa-utils 3/4] Use %lli for long long in printf Michael Forney
@ 2020-02-05 10:24   ` Takashi Sakamoto
  0 siblings, 0 replies; 12+ messages in thread
From: Takashi Sakamoto @ 2020-02-05 10:24 UTC (permalink / raw)
  To: Michael Forney; +Cc: alsa-devel

On Wed, Feb 05, 2020 at 12:12:20AM -0800, Michael Forney wrote:
> The `L` length modifier only applies to floating-point conversion
> specifiers, and `ll` is used for `long long` integers.
> 
> Although glibc accepts %Li, musl does not and returns EINVAL.
> 
> Signed-off-by: Michael Forney <mforney@mforney.org>
> ---
>  alsactl/state.c | 4 ++--
>  amixer/amixer.c | 4 ++--
>  2 files changed, 4 insertions(+), 4 deletions(-)
 
Looks good to me.

Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>

> diff --git a/alsactl/state.c b/alsactl/state.c
> index 38e85c0..22e0269 100644
> --- a/alsactl/state.c
> +++ b/alsactl/state.c
> @@ -336,9 +336,9 @@ static int get_control(snd_ctl_t *handle, snd_ctl_elem_id_t *id, snd_config_t *t
>  		long long max = snd_ctl_elem_info_get_max64(info);
>  		long long step = snd_ctl_elem_info_get_step64(info);
>  		if (step)
> -			sprintf(buf, "%Li - %Li (step %Li)", min, max, step);
> +			sprintf(buf, "%lli - %lli (step %lli)", min, max, step);
>  		else
> -			sprintf(buf, "%Li - %Li", min, max);
> +			sprintf(buf, "%lli - %lli", min, max);
>  		err = snd_config_string_add(comment, "range", buf);
>  		if (err < 0) {
>  			error("snd_config_string_add: %s", snd_strerror(err));
> diff --git a/amixer/amixer.c b/amixer/amixer.c
> index 928f7c5..4c19a58 100644
> --- a/amixer/amixer.c
> +++ b/amixer/amixer.c
> @@ -620,7 +620,7 @@ static int show_control(const char *space, snd_hctl_elem_t *elem,
>  		       snd_ctl_elem_info_get_step(info));
>  		break;
>  	case SND_CTL_ELEM_TYPE_INTEGER64:
> -		printf(",min=%Li,max=%Li,step=%Li\n", 
> +		printf(",min=%lli,max=%lli,step=%lli\n",
>  		       snd_ctl_elem_info_get_min64(info),
>  		       snd_ctl_elem_info_get_max64(info),
>  		       snd_ctl_elem_info_get_step64(info));
> @@ -662,7 +662,7 @@ static int show_control(const char *space, snd_hctl_elem_t *elem,
>  				printf("%li", snd_ctl_elem_value_get_integer(control, idx));
>  				break;
>  			case SND_CTL_ELEM_TYPE_INTEGER64:
> -				printf("%Li", snd_ctl_elem_value_get_integer64(control, idx));
> +				printf("%lli", snd_ctl_elem_value_get_integer64(control, idx));
>  				break;
>  			case SND_CTL_ELEM_TYPE_ENUMERATED:
>  				printf("%u", snd_ctl_elem_value_get_enumerated(control, idx));
> -- 
> 2.25.0
> 
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@alsa-project.org
> https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [alsa-devel] [PATCH alsa-utils 4/4] Avoid empty initializer list
  2020-02-05  8:12 ` [alsa-devel] [PATCH alsa-utils 4/4] Avoid empty initializer list Michael Forney
@ 2020-02-05 10:25   ` Takashi Sakamoto
  2020-02-06  0:02     ` Michael Forney
  0 siblings, 1 reply; 12+ messages in thread
From: Takashi Sakamoto @ 2020-02-05 10:25 UTC (permalink / raw)
  To: Michael Forney; +Cc: alsa-devel

On Wed, Feb 05, 2020 at 12:12:21AM -0800, Michael Forney wrote:
> To zero-initialize an object, use `{0}` instead.
> 
> Signed-off-by: Michael Forney <mforney@mforney.org>
> ---
>  alsamixer/cli.c             | 2 +-
>  amidi/amidi.c               | 2 +-
>  seq/aplaymidi/aplaymidi.c   | 2 +-
>  seq/aplaymidi/arecordmidi.c | 2 +-
>  seq/aseqdump/aseqdump.c     | 2 +-
>  5 files changed, 5 insertions(+), 5 deletions(-)
 
Good to me.

Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>

I think it better for you to generate cover-letter (--cover-letter
option for git-send-email) when posting a batch of patches.

> diff --git a/alsamixer/cli.c b/alsamixer/cli.c
> index 3f8f52f..7468325 100644
> --- a/alsamixer/cli.c
> +++ b/alsamixer/cli.c
> @@ -58,7 +58,7 @@ static void parse_options(int argc, char *argv[])
>  		{ .name = "view", .has_arg = 1, .val = 'V' },
>  		{ .name = "no-color", .val = 'g' },
>  		{ .name = "abstraction", .has_arg = 1, .val = 'a' },
> -		{ }
> +		{ 0 }
>  	};
>  	int option;
>  	int card_index;
> diff --git a/amidi/amidi.c b/amidi/amidi.c
> index c6268e4..cde4697 100644
> --- a/amidi/amidi.c
> +++ b/amidi/amidi.c
> @@ -469,7 +469,7 @@ int main(int argc, char *argv[])
>  		{"active-sensing", 0, NULL, 'a'},
>  		{"clock", 0, NULL, 'c'},
>  		{"sysex-interval", 1, NULL, 'i'},
> -		{ }
> +		{0}
>  	};
>  	int c, err, ok = 0;
>  	int ignore_active_sensing = 1;
> diff --git a/seq/aplaymidi/aplaymidi.c b/seq/aplaymidi/aplaymidi.c
> index b086e70..e8491e1 100644
> --- a/seq/aplaymidi/aplaymidi.c
> +++ b/seq/aplaymidi/aplaymidi.c
> @@ -869,7 +869,7 @@ int main(int argc, char *argv[])
>  		{"list", 0, NULL, 'l'},
>  		{"port", 1, NULL, 'p'},
>  		{"delay", 1, NULL, 'd'},
> -		{}
> +		{0}
>  	};
>  	int c;
>  	int do_list = 0;
> diff --git a/seq/aplaymidi/arecordmidi.c b/seq/aplaymidi/arecordmidi.c
> index 604cd0d..2034df7 100644
> --- a/seq/aplaymidi/arecordmidi.c
> +++ b/seq/aplaymidi/arecordmidi.c
> @@ -740,7 +740,7 @@ int main(int argc, char *argv[])
>  		{"metronome", 1, NULL, 'm'},
>  		{"timesig", 1, NULL, 'i'},
>  		{"num-events", 1, NULL, 'n'},
> -		{ }
> +		{0}
>  	};
>  
>  	char *filename = NULL;
> diff --git a/seq/aseqdump/aseqdump.c b/seq/aseqdump/aseqdump.c
> index 578e06f..44ae3bb 100644
> --- a/seq/aseqdump/aseqdump.c
> +++ b/seq/aseqdump/aseqdump.c
> @@ -357,7 +357,7 @@ int main(int argc, char *argv[])
>  		{"version", 0, NULL, 'V'},
>  		{"list", 0, NULL, 'l'},
>  		{"port", 1, NULL, 'p'},
> -		{ }
> +		{0}
>  	};
>  
>  	int do_list = 0;
> -- 
> 2.25.0
> 
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@alsa-project.org
> https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [alsa-devel] [PATCH alsa-utils 2/4] Avoid pointer arithmetic on `void *`
  2020-02-05  8:12 ` [alsa-devel] [PATCH alsa-utils 2/4] Avoid pointer arithmetic on `void *` Michael Forney
  2020-02-05 10:21   ` Takashi Sakamoto
@ 2020-02-05 15:50   ` Clemens Ladisch
  2020-02-06  0:00     ` Michael Forney
  1 sibling, 1 reply; 12+ messages in thread
From: Clemens Ladisch @ 2020-02-05 15:50 UTC (permalink / raw)
  To: alsa-devel

Michael Forney wrote:
> The pointer operand to the binary `+` operator must be to a complete
> object type.

Why are you making this change?  Are you trying to compile alsa-utils
with MSVC?


Regards,
Clemens
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [alsa-devel] [PATCH alsa-utils 2/4] Avoid pointer arithmetic on `void *`
  2020-02-05 15:50   ` Clemens Ladisch
@ 2020-02-06  0:00     ` Michael Forney
  0 siblings, 0 replies; 12+ messages in thread
From: Michael Forney @ 2020-02-06  0:00 UTC (permalink / raw)
  To: Clemens Ladisch; +Cc: alsa-devel

On 2020-02-05, Clemens Ladisch <clemens@ladisch.de> wrote:
> Michael Forney wrote:
>> The pointer operand to the binary `+` operator must be to a complete
>> object type.
>
> Why are you making this change?  Are you trying to compile alsa-utils
> with MSVC?

I'm trying to compile alsa-utils with cproc[0], which is my C compiler project.

[0] https://git.sr.ht/~mcf/cproc
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [alsa-devel] [PATCH alsa-utils 4/4] Avoid empty initializer list
  2020-02-05 10:25   ` Takashi Sakamoto
@ 2020-02-06  0:02     ` Michael Forney
  2020-02-06  1:53       ` Takashi Sakamoto
  0 siblings, 1 reply; 12+ messages in thread
From: Michael Forney @ 2020-02-06  0:02 UTC (permalink / raw)
  To: alsa-devel

On 2020-02-05, Takashi Sakamoto <o-takashi@sakamocchi.jp> wrote:
> Good to me.

Thanks for reviewing.

> I think it better for you to generate cover-letter (--cover-letter
> option for git-send-email) when posting a batch of patches.

Sorry about that. I'll make sure to add a cover letter next time.
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [alsa-devel] [PATCH alsa-utils 4/4] Avoid empty initializer list
  2020-02-06  0:02     ` Michael Forney
@ 2020-02-06  1:53       ` Takashi Sakamoto
  0 siblings, 0 replies; 12+ messages in thread
From: Takashi Sakamoto @ 2020-02-06  1:53 UTC (permalink / raw)
  To: Michael Forney; +Cc: alsa-devel

On Wed, Feb 05, 2020 at 04:02:54PM -0800, Michael Forney wrote:
> On 2020-02-05, Takashi Sakamoto <o-takashi@sakamocchi.jp> wrote:
> > Good to me.
> 
> Thanks for reviewing.
> 
> > I think it better for you to generate cover-letter (--cover-letter
> > option for git-send-email) when posting a batch of patches.
> 
> Sorry about that. I'll make sure to add a cover letter next time.

Oops. It's an option for 'git-format-patch' command... I'd like to
correct it, sorry.


Regards

Takashi Sakamoto
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2020-02-06  1:54 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-05  8:12 [alsa-devel] [PATCH alsa-utils 1/4] Use __func__ instead of __FUNCTION__ Michael Forney
2020-02-05  8:12 ` [alsa-devel] [PATCH alsa-utils 2/4] Avoid pointer arithmetic on `void *` Michael Forney
2020-02-05 10:21   ` Takashi Sakamoto
2020-02-05 15:50   ` Clemens Ladisch
2020-02-06  0:00     ` Michael Forney
2020-02-05  8:12 ` [alsa-devel] [PATCH alsa-utils 3/4] Use %lli for long long in printf Michael Forney
2020-02-05 10:24   ` Takashi Sakamoto
2020-02-05  8:12 ` [alsa-devel] [PATCH alsa-utils 4/4] Avoid empty initializer list Michael Forney
2020-02-05 10:25   ` Takashi Sakamoto
2020-02-06  0:02     ` Michael Forney
2020-02-06  1:53       ` Takashi Sakamoto
2020-02-05 10:19 ` [alsa-devel] [PATCH alsa-utils 1/4] Use __func__ instead of __FUNCTION__ Takashi Sakamoto

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.