Added support for wide characters when creating named resources in operating systems with wide-char APIs (at this time, Windows).

Fixes #93 and fixes #134.
This commit is contained in:
Ion Gaztañaga
2021-01-31 00:27:15 +01:00
parent 8f63c6054c
commit 140b50efb3
59 changed files with 2591 additions and 405 deletions

View File

@@ -20,14 +20,6 @@
using namespace boost::interprocess;
inline std::string get_filename()
{
std::string ret (ipcdetail::get_temporary_path());
ret += "/";
ret += test::get_process_id_name();
return ret;
}
file_mapping get_file_mapping()
{
file_mapping f;
@@ -141,6 +133,27 @@ int main ()
}
}
}
#ifdef BOOST_INTERPROCESS_WCHAR_NAMED_RESOURCES
{
//Create a file mapping
file_mapping mapping(get_wfilename().c_str(), read_only);
//Create a single regions, mapping all the file
mapped_region region (mapping
,read_only
);
//Check pattern
unsigned char *pattern = static_cast<unsigned char*>(region.get_address());
for(std::size_t i = 0
;i < FileSize
;++i, ++pattern){
if(*pattern != static_cast<unsigned char>(i)){
return 1;
}
}
}
#endif //BOOST_INTERPROCESS_WCHAR_NAMED_RESOURCES
{
//Now test move semantics
file_mapping mapping(get_filename().c_str(), read_only);