Source

swish_comet / include / comet / bstr.h

Author Commit Message Labels Comments Date
alamaison
Fixed bizarre header interaction. Including variant.h at the bottom of bstr.h prevented datetime.h from compiling on its own! Removed the include as well as several unused forward-decls. Added a test case to verify this works.
alamaison
Fixed bounds error in bstr_t::s_str(). The method was reading on character too many from the wrapped BSTR and writing the converted character to one byte after the std::string buffer. While this mostly works because this will write the the NULL-terminator that mostly implementation put after the buffer it is not legal and could cause problems if the character happens not to be NULL (possible as BSTRs don't have to be NULL-terminated).
alamaison
Fixed conversion from size_t to int warning in bstr::s_str(). Caused by passing size_t values to WideCharToMultiByte. Fixed by adding an explicit length check before casting the size_t to int.
alamaison
Fixed conversion from size_t to int warning. Caused by convert_str which stored the result of the first call to MultiByteToWideChar in a size_t and then passed that to the second call which was expecting an int. Also added an explicit length check to construct(const char* s, size_t len) before casting the original size_t to an int and changed expection specifications into comments.
alamaison
Removed extra level of indentation from bstr_t. Part of the bstr_t definition was randomly indented by one tabstop more than the rest.
sofusmortensen
1b32