MCPcopy Create free account
hub / github.com/cgsecurity/testdisk / strncasecmp

Function strncasecmp

src/common.c:142–153  ·  view source on GitHub ↗

Case-insensitive, size-constrained, lexical comparison. * * Compares a specified maximum number of characters of two strings for * lexical equivalence in a case-insensitive manner. * * @param[in] s1 - The first string to be compared. * @param[in] s2 - The second string to be compared. * @param[in] len - The maximum number of characters to compare. * * @return Zero if at least @p len chara

Source from the content-addressed store, hash-verified

140 * @internal
141 */
142int strncasecmp(const char * s1, const char * s2, size_t len)
143{
144 while (*s1 && (*s1 == *s2 || tolower(*s1) == tolower(*s2)))
145 {
146 len--;
147 if (len == 0)
148 return 0;
149 s1++;
150 s2++;
151 }
152 return (int)*(const unsigned char *)s1 - (int)*(const unsigned char *)s2;
153}
154#endif
155
156#ifndef HAVE_STRCASESTR

Callers 8

header_check_gzFunction · 0.85
data_check_htmlFunction · 0.85
file_rename_fodsFunction · 0.85
file_rename_htmlFunction · 0.85
header_check_txtFunction · 0.85
header_check_xmlFunction · 0.85
header_check_xml_utf8Function · 0.85
zip_parse_file_entry_fnFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected