0004-utils-Properly-use-ENABLE_NLS-for-locale-related-cod.patch 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. From 12e5dded4747bf3a3f1eb392a17d10e46ecbc90b Mon Sep 17 00:00:00 2001
  2. From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
  3. Date: Wed, 28 Oct 2015 09:29:08 +0100
  4. Subject: [PATCH] utils: Properly use ENABLE_NLS for locale related code
  5. Various tools in utils/ use ENABLE_NLS to decide whether locale
  6. support is available or not, and only include <locale.h> if ENABLE_NLS
  7. is defined. However, they unconditionally use functions defined in
  8. <locale.h> such as setlocale(), bindtextdomain() or textdomain(),
  9. which causes build failures when the prototypes of such functions are
  10. not available due to <locale.h> not being included.
  11. In order to fix this, we add ENABLE_NLS conditionals around the calls
  12. to these functions.
  13. Patch upstream at:
  14. http://git.linuxtv.org/v4l-utils.git/commit/?id=defad307a09c11ba989e6338bb0293c0e1acba87.
  15. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
  16. ---
  17. utils/dvb/dvb-fe-tool.c | 2 ++
  18. utils/dvb/dvb-format-convert.c | 2 ++
  19. utils/dvb/dvbv5-scan.c | 2 ++
  20. utils/dvb/dvbv5-zap.c | 2 ++
  21. utils/keytable/keytable.c | 2 ++
  22. 5 files changed, 10 insertions(+)
  23. diff --git a/utils/dvb/dvb-fe-tool.c b/utils/dvb/dvb-fe-tool.c
  24. index efc2ebf..ba01aa9 100644
  25. --- a/utils/dvb/dvb-fe-tool.c
  26. +++ b/utils/dvb/dvb-fe-tool.c
  27. @@ -276,9 +276,11 @@ int main(int argc, char *argv[])
  28. struct dvb_v5_fe_parms *parms;
  29. int fe_flags = O_RDWR;
  30. +#ifdef ENABLE_NLS
  31. setlocale (LC_ALL, "");
  32. bindtextdomain (PACKAGE, LOCALEDIR);
  33. textdomain (PACKAGE);
  34. +#endif
  35. argp_parse(&argp, argc, argv, ARGP_NO_HELP | ARGP_NO_EXIT, 0, 0);
  36. diff --git a/utils/dvb/dvb-format-convert.c b/utils/dvb/dvb-format-convert.c
  37. index e39df03..09451d4 100644
  38. --- a/utils/dvb/dvb-format-convert.c
  39. +++ b/utils/dvb/dvb-format-convert.c
  40. @@ -132,9 +132,11 @@ int main(int argc, char **argv)
  41. .args_doc = N_("<input file> <output file>"),
  42. };
  43. +#ifdef ENABLE_NLS
  44. setlocale (LC_ALL, "");
  45. bindtextdomain (PACKAGE, LOCALEDIR);
  46. textdomain (PACKAGE);
  47. +#endif
  48. memset(&args, 0, sizeof(args));
  49. argp_parse(&argp, argc, argv, ARGP_NO_HELP | ARGP_NO_EXIT, &idx, &args);
  50. diff --git a/utils/dvb/dvbv5-scan.c b/utils/dvb/dvbv5-scan.c
  51. index be1586d..1bb0ced 100644
  52. --- a/utils/dvb/dvbv5-scan.c
  53. +++ b/utils/dvb/dvbv5-scan.c
  54. @@ -461,9 +461,11 @@ int main(int argc, char **argv)
  55. .args_doc = N_("<initial file>"),
  56. };
  57. +#ifdef ENABLE_NLS
  58. setlocale (LC_ALL, "");
  59. bindtextdomain (PACKAGE, LOCALEDIR);
  60. textdomain (PACKAGE);
  61. +#endif
  62. memset(&args, 0, sizeof(args));
  63. args.sat_number = -1;
  64. diff --git a/utils/dvb/dvbv5-zap.c b/utils/dvb/dvbv5-zap.c
  65. index 2812166..848259b 100644
  66. --- a/utils/dvb/dvbv5-zap.c
  67. +++ b/utils/dvb/dvbv5-zap.c
  68. @@ -758,9 +758,11 @@ int main(int argc, char **argv)
  69. .args_doc = N_("<channel name> [or <frequency> if in monitor mode]"),
  70. };
  71. +#ifdef ENABLE_NLS
  72. setlocale (LC_ALL, "");
  73. bindtextdomain (PACKAGE, LOCALEDIR);
  74. textdomain (PACKAGE);
  75. +#endif
  76. memset(&args, 0, sizeof(args));
  77. args.sat_number = -1;
  78. diff --git a/utils/keytable/keytable.c b/utils/keytable/keytable.c
  79. index 3bf0618..d6d187f 100644
  80. --- a/utils/keytable/keytable.c
  81. +++ b/utils/keytable/keytable.c
  82. @@ -1467,9 +1467,11 @@ int main(int argc, char *argv[])
  83. static struct sysfs_names *names;
  84. struct rc_device rc_dev;
  85. +#ifdef ENABLE_NLS
  86. setlocale (LC_ALL, "");
  87. bindtextdomain (PACKAGE, LOCALEDIR);
  88. textdomain (PACKAGE);
  89. +#endif
  90. argp_parse(&argp, argc, argv, ARGP_NO_HELP | ARGP_NO_EXIT, 0, 0);
  91. --
  92. 2.6.2