File tree Expand file tree Collapse file tree 2 files changed +16
-10
lines changed
Expand file tree Collapse file tree 2 files changed +16
-10
lines changed Original file line number Diff line number Diff line change @@ -2841,13 +2841,13 @@ associated with the last error. The system error is:
28412841const char* srt_strerror(int code, int errnoval);
28422842```
28432843
2844- Returns a string message that represents a given SRT error code and possibly the
2845- ` errno ` value, if not 0.
2844+ Returns a string message that represents a given SRT error code.
28462845
2847- ** NOTE:** * This function isn't thread safe. It uses a static variable to hold the
2848- error description. There's no problem with using it in a multithreaded environment,
2849- as long as only one thread in the whole application calls this function at the
2850- moment*
2846+ ** NOTE:** * The ` errnoval ` parameter is ignored. This function's old version
2847+ was intended to get both the SRT error description and system error description,
2848+ but this requires resolution of the reentrancy problem and dynamic strings.
2849+ For getting the error description for a system error, you need to use the
2850+ ` strerror ` function or some of its reentrant version.*
28512851
28522852
28532853[ :arrow_up :   ; Back to List of Functions & Structures] ( #srt-api-functions )
Original file line number Diff line number Diff line change @@ -26,6 +26,14 @@ written by
2626using namespace std ;
2727using namespace srt ;
2828
29+ namespace srt
30+ {
31+ // This is provided in strerror_defs.cpp, which doesn't have
32+ // its header file.
33+ // XXX Consider adding some static function to CUDTException.
34+ const char * strerror_get_message (size_t major, size_t minor);
35+ }
36+
2937
3038extern " C" {
3139
@@ -248,11 +256,9 @@ int srt_getlasterror(int* loc_errno)
248256 return CUDT::getlasterror ().getErrorCode ();
249257}
250258
251- const char * srt_strerror (int code, int err)
259+ const char * srt_strerror (int code, int /* err ignored */ )
252260{
253- static srt::CUDTException e;
254- e = srt::CUDTException (CodeMajor (code/1000 ), CodeMinor (code%1000 ), err);
255- return (e.getErrorMessage ());
261+ return strerror_get_message (CodeMajor (code/1000 ), CodeMinor (code%1000 ));
256262}
257263
258264
You can’t perform that action at this time.
0 commit comments