We had to introduce out-of-order construction for those classes, but we
forgot to implement out-of-order destruction. File gets closed first
by cached_file::m_source destructor, then inherited destructor
cache::~cache() which flushes the cache is called.
Signed-off-by: Simon Rozman <simon@rozman.si>
Previous implementation had only strcat-class conversion using vague
function names. This commit makes function names more explicit by adding
"cat" and deprecating previous function variants.
Since many situation required strcpy variant, the move above made space
to add strcpy variants too.
Signed-off-by: Simon Rozman <simon@rozman.si>
Reusing same class instance for different files reused cache content
as well.
Reported-by: Peter Holozan <peter.holozan@amebis.si>
Signed-off-by: Simon Rozman <simon@rozman.si>
Our test program runs 15 minutes using our streams vs. 25 minutes using
std::iostream derived streams.
Streams were ported from Amebis AOsn project.
Signed-off-by: Simon Rozman <simon@rozman.si>
Windows is very peculiar with #include <windows.h>. Besides we need some
OS primitive wrappers that are OS-specific.
Signed-off-by: Simon Rozman <simon@rozman.si>
We need this for a rare use-case, so maintaining three flavors of
diagstream is too expensive. Furthermore, the buffering was removed
for simplicity.
Signed-off-by: Simon Rozman <simon@rozman.si>
One can always revert to default locale by specifying NULL. Mind that
stdlib locale_t is used, as we are using its sprintf() implementation
and it is not simple to convert from std::locale to locale_t.
Signed-off-by: Simon Rozman <simon@rozman.si>
Functions are allowed to be called with nullptr string input as long as
the length of those strings is set to 0.
Signed-off-by: Simon Rozman <simon@rozman.si>
The sgml.hpp is about converting between SGML and UTF-16/Unicode
actually. The "wstr" naming aligns better with std::wstring, wchar_t
etc.
Signed-off-by: Simon Rozman <simon@rozman.si>
This information is a side product of these templates and saves an extra
strnlen when caller plans on appending dst string some more data.
Signed-off-by: Simon Rozman <simon@rozman.si>
POSIX C strchr and strstr implementations return pointers and pointer
arithmetic is error prone. Switch to std C++ index search offsets.
Signed-off-by: Simon Rozman <simon@rozman.si>