bug: assignment of IR code to 32 bit variable

Markus Grabner <[email protected]> Tue, 16 Jan 2018 22:27:20 +0100
Newsgroups gmane.comp.hardware.lirc
Message-ID <2663435.7Dbg2VfJpF@mark>
	Hi!

I noticed a bug in irrecord.c which breaks the offline processing of raw IR 
codes longer than 32 bits (command line option "--analyse"). There is a 
"round-trip assignment" of IR codes involving the datatypes 

ir_code -> int -> ir_code

where the upper 32 bits are discarded for IR codes larger than 32 bits. The 
attached patch (against be62884be227a027d1369ac05ce805ca75e2ffac) fixes this 
issue, as can be confirmed with the attached (compressed) lircd raw 
configuration file.

Can a developer please review (and eventually merge) this patch?

	Thanks & kind regards,
		Markus

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
lirc-irrecord-fix-code-type.patch (text/x-patch, 452 B)
diff --git a/lib/irrecord.c b/lib/irrecord.c
index a7b461c9..0de63cc8 100644
--- a/lib/irrecord.c
+++ b/lib/irrecord.c
@@ -1669,8 +1669,8 @@ int analyse_remote(struct ir_remote* raw_data, const struct opts* opts)
 	struct ir_ncode* codes;
 	struct decode_ctx_t decode_ctx;
 	struct lengths_state lengths_state;
-	int code;
-	int code2;
+	ir_code code;
+	ir_code code2;
 	struct ir_ncode* new_codes;
 	size_t new_codes_count = 100;
 	int new_index = 0;
N2QAYB000957.lircd.raw.conf.bz2 (application/x-bzip, 1.4 KB) - not displayed