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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
  14. ---
  15. utils/dvb/dvb-fe-tool.c | 2 ++
  16. utils/dvb/dvb-format-convert.c | 2 ++
  17. utils/dvb/dvbv5-scan.c | 2 ++
  18. utils/dvb/dvbv5-zap.c | 2 ++
  19. utils/keytable/keytable.c | 2 ++
  20. 5 files changed, 10 insertions(+)
  21. diff --git a/utils/dvb/dvb-fe-tool.c b/utils/dvb/dvb-fe-tool.c
  22. index efc2ebf..ba01aa9 100644
  23. --- a/utils/dvb/dvb-fe-tool.c
  24. +++ b/utils/dvb/dvb-fe-tool.c
  25. @@ -276,9 +276,11 @@ int main(int argc, char *argv[])
  26. struct dvb_v5_fe_parms *parms;
  27. int fe_flags = O_RDWR;
  28. +#ifdef ENABLE_NLS
  29. setlocale (LC_ALL, "");
  30. bindtextdomain (PACKAGE, LOCALEDIR);
  31. textdomain (PACKAGE);
  32. +#endif
  33. argp_parse(&argp, argc, argv, ARGP_NO_HELP | ARGP_NO_EXIT, 0, 0);
  34. diff --git a/utils/dvb/dvb-format-convert.c b/utils/dvb/dvb-format-convert.c
  35. index e39df03..09451d4 100644
  36. --- a/utils/dvb/dvb-format-convert.c
  37. +++ b/utils/dvb/dvb-format-convert.c
  38. @@ -132,9 +132,11 @@ int main(int argc, char **argv)
  39. .args_doc = N_("<input file> <output file>"),
  40. };
  41. +#ifdef ENABLE_NLS
  42. setlocale (LC_ALL, "");
  43. bindtextdomain (PACKAGE, LOCALEDIR);
  44. textdomain (PACKAGE);
  45. +#endif
  46. memset(&args, 0, sizeof(args));
  47. argp_parse(&argp, argc, argv, ARGP_NO_HELP | ARGP_NO_EXIT, &idx, &args);
  48. diff --git a/utils/dvb/dvbv5-scan.c b/utils/dvb/dvbv5-scan.c
  49. index be1586d..1bb0ced 100644
  50. --- a/utils/dvb/dvbv5-scan.c
  51. +++ b/utils/dvb/dvbv5-scan.c
  52. @@ -461,9 +461,11 @@ int main(int argc, char **argv)
  53. .args_doc = N_("<initial file>"),
  54. };
  55. +#ifdef ENABLE_NLS
  56. setlocale (LC_ALL, "");
  57. bindtextdomain (PACKAGE, LOCALEDIR);
  58. textdomain (PACKAGE);
  59. +#endif
  60. memset(&args, 0, sizeof(args));
  61. args.sat_number = -1;
  62. diff --git a/utils/dvb/dvbv5-zap.c b/utils/dvb/dvbv5-zap.c
  63. index 2812166..848259b 100644
  64. --- a/utils/dvb/dvbv5-zap.c
  65. +++ b/utils/dvb/dvbv5-zap.c
  66. @@ -758,9 +758,11 @@ int main(int argc, char **argv)
  67. .args_doc = N_("<channel name> [or <frequency> if in monitor mode]"),
  68. };
  69. +#ifdef ENABLE_NLS
  70. setlocale (LC_ALL, "");
  71. bindtextdomain (PACKAGE, LOCALEDIR);
  72. textdomain (PACKAGE);
  73. +#endif
  74. memset(&args, 0, sizeof(args));
  75. args.sat_number = -1;
  76. diff --git a/utils/keytable/keytable.c b/utils/keytable/keytable.c
  77. index 3bf0618..d6d187f 100644
  78. --- a/utils/keytable/keytable.c
  79. +++ b/utils/keytable/keytable.c
  80. @@ -1467,9 +1467,11 @@ int main(int argc, char *argv[])
  81. static struct sysfs_names *names;
  82. struct rc_device rc_dev;
  83. +#ifdef ENABLE_NLS
  84. setlocale (LC_ALL, "");
  85. bindtextdomain (PACKAGE, LOCALEDIR);
  86. textdomain (PACKAGE);
  87. +#endif
  88. argp_parse(&argp, argc, argv, ARGP_NO_HELP | ARGP_NO_EXIT, 0, 0);
  89. --
  90. 2.6.2