Home GnuPG
Diffusion GPGME 2656d3ee5b1a

cpp: Add safer member function returning text describing an error

Description

cpp: Add safer member function returning text describing an error

* lang/cpp/src/error.h, lang/cpp/src/context.cpp (class Error): New
member function asStdString.

Unlike asString the new function doesn't cache the value returned by
gpgme_strerror_r. This ensures that on Windows the UTF-8 encoded text
is returned for the main thread even if the function was called before
for another thread. For other threads asStdString will still return the
natively encoded error description until UTF-8 encoded error
descriptions can be enabled for all threads (T7185).