diff options
author | Mark Greer <mgreer@animalcreek.com> | 2016-10-25 09:26:55 -0700 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2017-11-10 00:15:10 +0100 |
commit | 7afe8460dce3275da71fa2ac8aa338deb373df34 (patch) | |
tree | 8a5907adc112d81915f53fb03c029b296d8c80c9 | |
parent | b18c489bf8c1c8e087cc97ca7ad8bfaded856e4d (diff) | |
download | neard-7afe8460dce3275da71fa2ac8aa338deb373df34.tar.gz |
ndef: Add default language ("en") for Text records
Despite section 3.3 of the NFC Forum RTD-Text 1.0 Technical
Specification stating in part, "The language code MAY NOT be
omitted", some tags have a 0-length language field. A 0-length
language field currently causes neard to exit which isn't ideal
so choose a default language (generic English) which will be
used in these situations.
There is no particular reason to choose English other than it
is the native language of the patch author and it is the
language neard is coded in.
Signed-off-by: Mark Greer <mgreer@animalcreek.com>
---
This is identical to an earlier patch submitted to the linux-nfc
mail list in October (link below) so that patch can be discarded.
https://lists.01.org/pipermail/linux-nfc/2016-October/004292.html
-rw-r--r-- | src/ndef.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -409,7 +409,10 @@ static const char *get_text_payload(const GDBusPropertyTable *property, if (!strcmp(property->name, "Encoding")) return text->encoding; else if (!strcmp(property->name, "Language")) - return text->language_code; + if (!text->language_code) + return "en"; + else + return text->language_code; else if (!strcmp(property->name, "Representation")) return text->data; else |