mirror of
https://github.com/boostorg/system.git
synced 2025-07-29 20:17:13 +02:00
Fix boost::detail::winapi::ERROR_INSUFFICIENT_BUFFER_ in error_code.ipp (Thanks to Lastique). Use <boost/detail/winapi/error_codes.hpp> in windows_error.hpp. Add msvc project to build header-only version of error_code_test.
This commit is contained in:
@ -389,7 +389,7 @@ namespace
|
||||
buf.resize(retval);
|
||||
break;
|
||||
}
|
||||
else if (boost::detail::winapi::GetLastError() != ERROR_INSUFFICIENT_BUFFER)
|
||||
else if (boost::detail::winapi::GetLastError() != boost::detail::winapi::ERROR_INSUFFICIENT_BUFFER_)
|
||||
{
|
||||
return std::string("Unknown error");
|
||||
}
|
||||
|
@ -19,14 +19,16 @@
|
||||
|
||||
#include <boost/system/error_code.hpp>
|
||||
|
||||
// Neither MinGW or Cygwin versions of winerror.h work if used alone, so on
|
||||
// either of those platforms include the full windows.h
|
||||
//// Neither MinGW or Cygwin versions of winerror.h work if used alone, so on
|
||||
//// either of those platforms include the full windows.h
|
||||
//
|
||||
//#if defined(__MINGW32__) || defined(__CYGWIN__)
|
||||
//#include <windows.h>
|
||||
//#else
|
||||
//#include <winerror.h>
|
||||
//#endif
|
||||
|
||||
#if defined(__MINGW32__) || defined(__CYGWIN__)
|
||||
#include <windows.h>
|
||||
#else
|
||||
#include <winerror.h>
|
||||
#endif
|
||||
#include <boost/detail/winapi/error_codes.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
@ -45,59 +47,59 @@ namespace boost
|
||||
{
|
||||
success = 0,
|
||||
// These names and values are based on Windows winerror.h
|
||||
invalid_function = ERROR_INVALID_FUNCTION,
|
||||
file_not_found = ERROR_FILE_NOT_FOUND,
|
||||
path_not_found = ERROR_PATH_NOT_FOUND,
|
||||
too_many_open_files = ERROR_TOO_MANY_OPEN_FILES,
|
||||
access_denied = ERROR_ACCESS_DENIED,
|
||||
invalid_handle = ERROR_INVALID_HANDLE,
|
||||
arena_trashed = ERROR_ARENA_TRASHED,
|
||||
not_enough_memory = ERROR_NOT_ENOUGH_MEMORY,
|
||||
invalid_block = ERROR_INVALID_BLOCK,
|
||||
bad_environment = ERROR_BAD_ENVIRONMENT,
|
||||
bad_format = ERROR_BAD_FORMAT,
|
||||
invalid_access = ERROR_INVALID_ACCESS,
|
||||
outofmemory = ERROR_OUTOFMEMORY,
|
||||
invalid_drive = ERROR_INVALID_DRIVE,
|
||||
current_directory = ERROR_CURRENT_DIRECTORY,
|
||||
not_same_device = ERROR_NOT_SAME_DEVICE,
|
||||
no_more_files = ERROR_NO_MORE_FILES,
|
||||
write_protect = ERROR_WRITE_PROTECT,
|
||||
bad_unit = ERROR_BAD_UNIT,
|
||||
not_ready = ERROR_NOT_READY,
|
||||
bad_command = ERROR_BAD_COMMAND,
|
||||
crc = ERROR_CRC,
|
||||
bad_length = ERROR_BAD_LENGTH,
|
||||
seek = ERROR_SEEK,
|
||||
not_dos_disk = ERROR_NOT_DOS_DISK,
|
||||
sector_not_found = ERROR_SECTOR_NOT_FOUND,
|
||||
out_of_paper = ERROR_OUT_OF_PAPER,
|
||||
write_fault = ERROR_WRITE_FAULT,
|
||||
read_fault = ERROR_READ_FAULT,
|
||||
gen_failure = ERROR_GEN_FAILURE,
|
||||
sharing_violation = ERROR_SHARING_VIOLATION,
|
||||
lock_violation = ERROR_LOCK_VIOLATION,
|
||||
wrong_disk = ERROR_WRONG_DISK,
|
||||
sharing_buffer_exceeded = ERROR_SHARING_BUFFER_EXCEEDED,
|
||||
handle_eof = ERROR_HANDLE_EOF,
|
||||
handle_disk_full= ERROR_HANDLE_DISK_FULL,
|
||||
rem_not_list = ERROR_REM_NOT_LIST,
|
||||
dup_name = ERROR_DUP_NAME,
|
||||
bad_net_path = ERROR_BAD_NETPATH,
|
||||
network_busy = ERROR_NETWORK_BUSY,
|
||||
invalid_function = boost::detail::winapi::ERROR_INVALID_FUNCTION_,
|
||||
file_not_found = boost::detail::winapi::ERROR_FILE_NOT_FOUND_,
|
||||
path_not_found = boost::detail::winapi::ERROR_PATH_NOT_FOUND_,
|
||||
too_many_open_files = boost::detail::winapi::ERROR_TOO_MANY_OPEN_FILES_,
|
||||
access_denied = boost::detail::winapi::ERROR_ACCESS_DENIED_,
|
||||
invalid_handle = boost::detail::winapi::ERROR_INVALID_HANDLE_,
|
||||
arena_trashed = boost::detail::winapi::ERROR_ARENA_TRASHED_,
|
||||
not_enough_memory = boost::detail::winapi::ERROR_NOT_ENOUGH_MEMORY_,
|
||||
invalid_block = boost::detail::winapi::ERROR_INVALID_BLOCK_,
|
||||
bad_environment = boost::detail::winapi::ERROR_BAD_ENVIRONMENT_,
|
||||
bad_format = boost::detail::winapi::ERROR_BAD_FORMAT_,
|
||||
invalid_access = boost::detail::winapi::ERROR_INVALID_ACCESS_,
|
||||
outofmemory = boost::detail::winapi::ERROR_OUTOFMEMORY_,
|
||||
invalid_drive = boost::detail::winapi::ERROR_INVALID_DRIVE_,
|
||||
current_directory = boost::detail::winapi::ERROR_CURRENT_DIRECTORY_,
|
||||
not_same_device = boost::detail::winapi::ERROR_NOT_SAME_DEVICE_,
|
||||
no_more_files = boost::detail::winapi::ERROR_NO_MORE_FILES_,
|
||||
write_protect = boost::detail::winapi::ERROR_WRITE_PROTECT_,
|
||||
bad_unit = boost::detail::winapi::ERROR_BAD_UNIT_,
|
||||
not_ready = boost::detail::winapi::ERROR_NOT_READY_,
|
||||
bad_command = boost::detail::winapi::ERROR_BAD_COMMAND_,
|
||||
crc = boost::detail::winapi::ERROR_CRC_,
|
||||
bad_length = boost::detail::winapi::ERROR_BAD_LENGTH_,
|
||||
seek = boost::detail::winapi::ERROR_SEEK_,
|
||||
not_dos_disk = boost::detail::winapi::ERROR_NOT_DOS_DISK_,
|
||||
sector_not_found = boost::detail::winapi::ERROR_SECTOR_NOT_FOUND_,
|
||||
out_of_paper = boost::detail::winapi::ERROR_OUT_OF_PAPER_,
|
||||
write_fault = boost::detail::winapi::ERROR_WRITE_FAULT_,
|
||||
read_fault = boost::detail::winapi::ERROR_READ_FAULT_,
|
||||
gen_failure = boost::detail::winapi::ERROR_GEN_FAILURE_,
|
||||
sharing_violation = boost::detail::winapi::ERROR_SHARING_VIOLATION_,
|
||||
lock_violation = boost::detail::winapi::ERROR_LOCK_VIOLATION_,
|
||||
wrong_disk = boost::detail::winapi::ERROR_WRONG_DISK_,
|
||||
sharing_buffer_exceeded = boost::detail::winapi::ERROR_SHARING_BUFFER_EXCEEDED_,
|
||||
handle_eof = boost::detail::winapi::ERROR_HANDLE_EOF_,
|
||||
handle_disk_full= boost::detail::winapi::ERROR_HANDLE_DISK_FULL_,
|
||||
rem_not_list = boost::detail::winapi::ERROR_REM_NOT_LIST_,
|
||||
dup_name = boost::detail::winapi::ERROR_DUP_NAME_,
|
||||
bad_net_path = boost::detail::winapi::ERROR_BAD_NETPATH_,
|
||||
network_busy = boost::detail::winapi::ERROR_NETWORK_BUSY_,
|
||||
// ...
|
||||
file_exists = ERROR_FILE_EXISTS,
|
||||
cannot_make = ERROR_CANNOT_MAKE,
|
||||
file_exists = boost::detail::winapi::ERROR_FILE_EXISTS_,
|
||||
cannot_make = boost::detail::winapi::ERROR_CANNOT_MAKE_,
|
||||
// ...
|
||||
broken_pipe = ERROR_BROKEN_PIPE,
|
||||
open_failed = ERROR_OPEN_FAILED,
|
||||
buffer_overflow = ERROR_BUFFER_OVERFLOW,
|
||||
disk_full= ERROR_DISK_FULL,
|
||||
broken_pipe = boost::detail::winapi::ERROR_BROKEN_PIPE_,
|
||||
open_failed = boost::detail::winapi::ERROR_OPEN_FAILED_,
|
||||
buffer_overflow = boost::detail::winapi::ERROR_BUFFER_OVERFLOW_,
|
||||
disk_full= boost::detail::winapi::ERROR_DISK_FULL_,
|
||||
// ...
|
||||
lock_failed = ERROR_LOCK_FAILED,
|
||||
busy = ERROR_BUSY,
|
||||
cancel_violation = ERROR_CANCEL_VIOLATION,
|
||||
already_exists = ERROR_ALREADY_EXISTS
|
||||
lock_failed = boost::detail::winapi::ERROR_LOCK_FAILED_,
|
||||
busy = boost::detail::winapi::ERROR_BUSY_,
|
||||
cancel_violation = boost::detail::winapi::ERROR_CANCEL_VIOLATION_,
|
||||
already_exists = boost::detail::winapi::ERROR_ALREADY_EXISTS_
|
||||
// ...
|
||||
|
||||
// TODO: add more Windows errors
|
||||
|
@ -0,0 +1,151 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>15.0</VCProjectVersion>
|
||||
<ProjectGuid>{C25D7BD7-1B99-4DA9-A1A5-3034410CBEF7}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>header_only_error_code_test</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0.14393.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="..\common.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="..\common.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="..\common.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="..\common.props" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions);BOOST_ERROR_CODE_HEADER_ONLY</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions);BOOST_ERROR_CODE_HEADER_ONLY</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);BOOST_ERROR_CODE_HEADER_ONLY</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions);BOOST_ERROR_CODE_HEADER_ONLY</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\error_code_test.cpp" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
@ -18,6 +18,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "std_interop_test", "std_int
|
||||
{419402D4-F990-4B05-A459-655E2DC33DC2} = {419402D4-F990-4B05-A459-655E2DC33DC2}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "header_only_error_code_test", "header_only_error_code_test\header_only_error_code_test.vcxproj", "{C25D7BD7-1B99-4DA9-A1A5-3034410CBEF7}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
@ -66,6 +68,14 @@ Global
|
||||
{47B0A041-1EB5-4842-BD17-BA0DCC5E0313}.Release|Win32.Build.0 = Release|Win32
|
||||
{47B0A041-1EB5-4842-BD17-BA0DCC5E0313}.Release|x64.ActiveCfg = Release|x64
|
||||
{47B0A041-1EB5-4842-BD17-BA0DCC5E0313}.Release|x64.Build.0 = Release|x64
|
||||
{C25D7BD7-1B99-4DA9-A1A5-3034410CBEF7}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{C25D7BD7-1B99-4DA9-A1A5-3034410CBEF7}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{C25D7BD7-1B99-4DA9-A1A5-3034410CBEF7}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{C25D7BD7-1B99-4DA9-A1A5-3034410CBEF7}.Debug|x64.Build.0 = Debug|x64
|
||||
{C25D7BD7-1B99-4DA9-A1A5-3034410CBEF7}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{C25D7BD7-1B99-4DA9-A1A5-3034410CBEF7}.Release|Win32.Build.0 = Release|Win32
|
||||
{C25D7BD7-1B99-4DA9-A1A5-3034410CBEF7}.Release|x64.ActiveCfg = Release|x64
|
||||
{C25D7BD7-1B99-4DA9-A1A5-3034410CBEF7}.Release|x64.Build.0 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
Reference in New Issue
Block a user