Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This changes are for users who use pjsip under non english Windows redactions.
PJ_ERR_MSG_SIZE
For example russian language is not so laconic as English. Windows FormatMessage function often requires more than 80 character for message buffer. Thats why I need to increase PJ_ERR_MSG_SIZE value (in fact I use 160 - twice more!), but I preffere to declare PJ_ERR_MSG_SIZE in my config_site.h file. The only change I need for this purpose is to surrond #define PJ_ERR_MSG_SIZE by #ifndef
PJ_STRERROR_USE_WIN_GET_THREAD_LOCALE
pj_strerror() calls Windows FormatMessage function with the value of languageId parameter meaning "User default language" which is language configured for user session. This is not always comfortable. For example pjlib_project errno_test() failes for non English user language because FormatMessage return national language string (for examle cyrillic string) not containing the word "invalid" which is test criteria.
But starting from Windows XP application can set locale (and language) information on application and thread basis. It's logically to expect the program will reflect to current thread locale. My idea is to use current thread language to obtain OS error description.
To support this I have modified platform_strerror() (for Windows platform) so that it calls FormatMessage with current thread language instead of user default language.
For compatibility reason I have introduced PJ_STRERROR_USE_WIN_GET_THREAD_LOCALE macro wich may be set in config_site.h file. By default behaviour is not changed, but if user define PJ_STRERROR_USE_WIN_GET_THREAD_LOCALE platform_strerror() will call GetThreadLocale() to get current locale (and language).
As an usage example: if that macro is defined, error_test() fors English thread locale before calling pj_strerror() and now test is succeeded under non English Windows redactions.