-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge PAL's _wcslwr into _wcslwr_s (#43265)
In (non-palsuite) product code, `_wcslwr` is only used within PAL inside `_wcslwr_unsafe()` method, which is exposed as `_wcslwr_s` for PAL consumers. PR inlines the usage of `_wcslwr` in `_wcslwr_unsafe` and fixes up PAL tests.
- Loading branch information
Showing
10 changed files
with
59 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
/*** | ||
*wcslwr_s.cpp - contains _wcslwr_s() routine | ||
* | ||
* | ||
*Purpose: | ||
* _wcslwr_s converts, in place, any upper case letters in input string to | ||
* lowercase. | ||
* | ||
*******************************************************************************/ | ||
|
||
#include <wctype.h> | ||
#include <string.h> | ||
#include <errno.h> | ||
#include <limits.h> | ||
#include "internal_securecrt.h" | ||
|
||
#include "mbusafecrt_internal.h" | ||
|
||
DLLEXPORT errno_t __cdecl _wcslwr_s(char16_t *string, size_t sz) | ||
{ | ||
_VALIDATE_RETURN_ERRCODE(string != NULL, EINVAL); | ||
size_t length = PAL_wcsnlen(string, sz); | ||
if (length >= sz) | ||
{ | ||
_RETURN_DEST_NOT_NULL_TERMINATED(string, sz); | ||
} | ||
|
||
for (int i = 0; string[i] != 0; i++) | ||
{ | ||
string[i] = towlower(string[i]); | ||
} | ||
|
||
_FILL_STRING(string, sz, length + 1); | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters