OpenSDE Packages Database (without history before r20070)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

65 lines
2.3 KiB

  1. # --- SDE-COPYRIGHT-NOTE-BEGIN ---
  2. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  3. #
  4. # Filename: package/.../musl/0006-fix-padding-string-formats-to-width-in-wide-printf-v.patch
  5. # Copyright (C) 2016 The OpenSDE Project
  6. #
  7. # More information can be found in the files COPYING and README.
  8. #
  9. # This patch file is dual-licensed. It is available under the license the
  10. # patched project is licensed under, as long as it is an OpenSource license
  11. # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
  12. # of the GNU General Public License as published by the Free Software
  13. # Foundation; either version 2 of the License, or (at your option) any later
  14. # version.
  15. # --- SDE-COPYRIGHT-NOTE-END ---
  16. From 4aac019a0efd59011a48d031ad046c934c7e8365 Mon Sep 17 00:00:00 2001
  17. From: Rich Felker <dalias@aerifal.cx>
  18. Date: Wed, 16 Mar 2016 16:35:22 -0400
  19. Subject: [PATCH] fix padding string formats to width in wide printf variants
  20. the idiom fprintf(f, "%.*s", n, "") was wrongly used in vfwprintf as a
  21. means of producing n spaces; instead it produces no output. the
  22. correct form is fprintf(f, "%*s", n, ""), using width instead of
  23. precision, since for %s the later is a maximum rather than a minimum.
  24. ---
  25. src/stdio/vfwprintf.c | 8 ++++----
  26. 1 file changed, 4 insertions(+), 4 deletions(-)
  27. diff --git a/src/stdio/vfwprintf.c b/src/stdio/vfwprintf.c
  28. index f06d5ae..f9f1ecf 100644
  29. --- a/src/stdio/vfwprintf.c
  30. +++ b/src/stdio/vfwprintf.c
  31. @@ -288,9 +288,9 @@ static int wprintf_core(FILE *f, const wchar_t *fmt, va_list *ap, union arg *nl_
  32. z = wmemchr(a, 0, p);
  33. if (z) p=z-a;
  34. if (w<p) w=p;
  35. - if (!(fl&LEFT_ADJ)) fprintf(f, "%.*s", w-p, "");
  36. + if (!(fl&LEFT_ADJ)) fprintf(f, "%*s", w-p, "");
  37. out(f, a, p);
  38. - if ((fl&LEFT_ADJ)) fprintf(f, "%.*s", w-p, "");
  39. + if ((fl&LEFT_ADJ)) fprintf(f, "%*s", w-p, "");
  40. l=w;
  41. continue;
  42. case 'm':
  43. @@ -303,14 +303,14 @@ static int wprintf_core(FILE *f, const wchar_t *fmt, va_list *ap, union arg *nl_
  44. if (i<0) return -1;
  45. p=l;
  46. if (w<p) w=p;
  47. - if (!(fl&LEFT_ADJ)) fprintf(f, "%.*s", w-p, "");
  48. + if (!(fl&LEFT_ADJ)) fprintf(f, "%*s", w-p, "");
  49. bs = arg.p;
  50. while (l--) {
  51. i=mbtowc(&wc, bs, MB_LEN_MAX);
  52. bs+=i;
  53. fputwc(wc, f);
  54. }
  55. - if ((fl&LEFT_ADJ)) fprintf(f, "%.*s", w-p, "");
  56. + if ((fl&LEFT_ADJ)) fprintf(f, "%*s", w-p, "");
  57. l=w;
  58. continue;
  59. }
  60. --
  61. 2.7.4