[PATCH v4 02/31] lib: Add a function to convert a string to upper case
Heinrich Schuchardt
xypron.glpk at gmx.de
Thu Apr 9 07:32:36 CEST 2020
Am April 8, 2020 2:20:47 PM UTC schrieb Simon Glass <sjg at chromium.org>:
>Hi Heinrich,
>
>On Tue, 7 Apr 2020 at 22:41, Heinrich Schuchardt <xypron.glpk at gmx.de>
>wrote:
>>
>> Am April 8, 2020 4:18:12 AM UTC schrieb Heinrich Schuchardt
><xypron.glpk at gmx.de>:
>> >Am April 8, 2020 3:00:38 AM UTC schrieb Simon Glass
><sjg at chromium.org>:
>> >>Add a helper function for this operation. Update the strtoul()
>tests
>> >to
>> >>check upper case as well.
>> >>
>> >>Update FAT writing to use this new function.
>> >>
>> >>Signed-off-by: Simon Glass <sjg at chromium.org>
>> >>---
>> >>
>> >>Changes in v4:
>> >>- Add a new patch to convert a string to upper case
>> >>
>> >>Changes in v3: None
>> >>Changes in v2: None
>> >>
>> >> fs/fat/fat_write.c | 13 ++-------
>> >> include/vsprintf.h | 12 ++++++++
>> >> lib/strto.c | 8 +++++
>> >> test/str_ut.c | 73
>> >++++++++++++++++++++++++++++++++++------------
>> >> 4 files changed, 77 insertions(+), 29 deletions(-)
>> >>
>> >>diff --git a/fs/fat/fat_write.c b/fs/fat/fat_write.c
>> >>index 4f96699e363..472c206f64c 100644
>> >>--- a/fs/fat/fat_write.c
>> >>+++ b/fs/fat/fat_write.c
>> >>@@ -10,6 +10,7 @@
>> >> #include <config.h>
>> >> #include <fat.h>
>> >> #include <malloc.h>
>> >>+#include <vsprintf.h>
>> >> #include <asm/byteorder.h>
>> >> #include <part.h>
>> >> #include <linux/ctype.h>
>> >>@@ -17,16 +18,6 @@
>> >> #include <linux/math64.h>
>> >> #include "fat.c"
>> >>
>> >>-static void uppercase(char *str, int len)
>> >>-{
>> >>- int i;
>> >>-
>> >>- for (i = 0; i < len; i++) {
>> >>- *str = toupper(*str);
>> >>- str++;
>> >>- }
>> >>-}
>>
>> We should not use toupper() here. We have to consider the FAT charset
>defined by CONFIG_FAT_DEFAULT_CODEPAGE.
>
>It seems to match the existing code. Is there a pending patch
>somewhere for changing it?
This is an open TODO. We have capitalization.h which contains the relevant codepoints, e.g. in CP437_CAPITALIZATION_TABLE.
Best regards
Heinrich
>
>Regards,
>Simon
More information about the U-Boot
mailing list