This commit is contained in:
Svido 2020-02-06 04:27:43 +01:00 коммит произвёл GitHub
Родитель b3504262fe
Коммит 5a8afb99ef
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
1 изменённых файлов: 11 добавлений и 13 удалений

Просмотреть файл

@ -97,12 +97,11 @@ static const _Win_errtab_t _Win_errtab[] = {
{WSAEWOULDBLOCK, errc::operation_would_block},
};
_CRTIMP2_PURE int __CLRCALL_PURE_OR_CDECL _Winerror_map(
int _Errcode) { // convert Windows error to Posix error if possible, otherwise 0
const _Win_errtab_t* _Ptr = &_Win_errtab[0];
for (; _Ptr != _STD end(_Win_errtab); ++_Ptr) {
if (_Ptr->_Windows == _Errcode) {
return static_cast<int>(_Ptr->_Posix);
_CRTIMP2_PURE int __CLRCALL_PURE_OR_CDECL _Winerror_map(int _Errcode) {
// convert Windows error to Posix error if possible, otherwise 0
for (const auto& _Entry : _Win_errtab) {
if (_Entry._Windows == _Errcode) {
return static_cast<int>(_Entry._Posix);
}
}
@ -110,9 +109,9 @@ _CRTIMP2_PURE int __CLRCALL_PURE_OR_CDECL _Winerror_map(
}
_CRTIMP2_PURE unsigned long __CLRCALL_PURE_OR_CDECL _Winerror_message(
unsigned long _Message_id, char* _Narrow, unsigned long _Size) { // convert to name of Windows error, return 0 for
// failure, otherwise return number of chars
// written pre: _Size < INT_MAX
unsigned long _Message_id, char* _Narrow, unsigned long _Size) {
// convert to name of Windows error, return 0 for failure, otherwise return number of chars written
// pre: _Size < INT_MAX
const unique_ptr<wchar_t[]> _Wide(new wchar_t[_Size]); // not using make_unique because we want default-init
const auto _First = _Wide.get();
unsigned long _Wide_chars =
@ -224,10 +223,9 @@ static const _Sys_errtab_t _Sys_errtab[] = {
};
_CRTIMP2_PURE const char* __CLRCALL_PURE_OR_CDECL _Syserror_map(int _Errcode) { // convert to name of generic error
const _Sys_errtab_t* _Ptr = &_Sys_errtab[0];
for (; _Ptr != _STD end(_Sys_errtab); ++_Ptr) {
if ((int) _Ptr->_Errcode == _Errcode) {
return _Ptr->_Name;
for (const auto& _Entry : _Sys_errtab) {
if (static_cast<int>(_Entry._Errcode) == _Errcode) {
return _Entry._Name;
}
}