[2/3] topology/builder: Fix absolute value warning
diff mbox series

Message ID 20191210091047.143081-2-rosenp@gmail.com
State New
Headers show
Series
  • [1/3] treewide: Fix -Wformat=2 warnings
Related show

Commit Message

Rosen Penev Dec. 10, 2019, 9:10 a.m. UTC
next_hdr_pos is unsigned and promotes offset as such. This makes
the abs call useless.

Changed the abs call to labs and the offset to off_t to avoid this.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
 src/topology/builder.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Patch
diff mbox series

diff --git a/src/topology/builder.c b/src/topology/builder.c
index 3adbad45..98956dac 100644
--- a/src/topology/builder.c
+++ b/src/topology/builder.c
@@ -45,7 +45,7 @@  static int write_block_header(snd_tplg_t *tplg, unsigned int type,
 {
 	struct snd_soc_tplg_hdr hdr;
 	size_t bytes;
-	int offset = lseek(tplg->out_fd, 0, SEEK_CUR);
+	off_t offset = lseek(tplg->out_fd, 0, SEEK_CUR);
 
 	memset(&hdr, 0, sizeof(hdr));
 	hdr.magic = SND_SOC_TPLG_MAGIC;
@@ -64,7 +64,7 @@  static int write_block_header(snd_tplg_t *tplg, unsigned int type,
 			" offset 0x%x is %s by %d bytes\n",
 			tplg->next_hdr_pos, offset,
 			(unsigned int)offset > tplg->next_hdr_pos ? "ahead" : "behind",
-			abs(offset - tplg->next_hdr_pos));
+			labs(offset - (off_t)tplg->next_hdr_pos));
 		exit(-EINVAL);
 	}