Closed shenlebantongying closed 2 days ago
strcasecmp is not standard C, it is defined by POSIX.
strcasecmp
(The actual implementation is just looping through chars and do tolower https://github.com/bminor/glibc/blob/master/string/strcasecmp.c )
tolower
Replace them with QByteArrayView which doesn't own the memory, and it is pretty feature rich (than std::string_view).
Let's simply take a "view" and do the comparisons (which invokes lower level C functions, but with a prettier interface).
(I find the result code is quite readable, btw.)
Issues 2 New issues 0 Accepted issues
Measures 0 Security Hotspots 0.0% Coverage on New Code 0.0% Duplication on New Code
See analysis details on SonarQube Cloud
amended by https://github.com/xiaoyifang/goldendict-ng/pull/1971
strcasecmp
is not standard C, it is defined by POSIX.(The actual implementation is just looping through chars and do
tolower
https://github.com/bminor/glibc/blob/master/string/strcasecmp.c )Replace them with QByteArrayView which doesn't own the memory, and it is pretty feature rich (than std::string_view).
Let's simply take a "view" and do the comparisons (which invokes lower level C functions, but with a prettier interface).
(I find the result code is quite readable, btw.)