diff options
author | Alex Ray <aray@google.com> | 2013-09-11 16:20:07 -0700 |
---|---|---|
committer | Alex Ray <aray@google.com> | 2013-09-11 17:51:19 -0700 |
commit | d9d105a0ce6bbaa8d1d1cf70a255612a5dd33701 (patch) | |
tree | ec58f857468d2f78d142d7d67ece67cb8fd9b9d9 /modules/consumerir | |
parent | c900b4230c5f33abc1b7bc590c4ffe21ec8a59d0 (diff) | |
download | hardware_libhardware-d9d105a0ce6bbaa8d1d1cf70a255612a5dd33701.zip hardware_libhardware-d9d105a0ce6bbaa8d1d1cf70a255612a5dd33701.tar.gz hardware_libhardware-d9d105a0ce6bbaa8d1d1cf70a255612a5dd33701.tar.bz2 |
consumer_ir: add array length to get carrier freq
Change-Id: Iefb424db6f16ffefa40da56c765c9b7a24bea397
Diffstat (limited to 'modules/consumerir')
-rw-r--r-- | modules/consumerir/consumerir.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/modules/consumerir/consumerir.c b/modules/consumerir/consumerir.c index 6a032a7..83eba75 100644 --- a/modules/consumerir/consumerir.c +++ b/modules/consumerir/consumerir.c @@ -54,10 +54,13 @@ static int consumerir_get_num_carrier_freqs(struct consumerir_device *dev) } static int consumerir_get_carrier_freqs(struct consumerir_device *dev, - consumerir_freq_range_t *ranges) + size_t len, consumerir_freq_range_t *ranges) { - memcpy(ranges, consumerir_freqs, sizeof(consumerir_freqs)); - return ARRAY_SIZE(consumerir_freqs); + size_t to_copy = ARRAY_SIZE(consumerir_freqs); + + to_copy = len < to_copy ? len : to_copy; + memcpy(ranges, consumerir_freqs, to_copy * sizeof(consumerir_freq_range_t)); + return to_copy; } static int consumerir_close(hw_device_t *dev) |