smpl_buf: Fix str_code() param and print unknown error val

Change-Id: I95fadac15b9ad337ebc7cfb44a20dcf803ff8a47
This commit is contained in:
Pau Espin 2020-01-13 14:34:19 +01:00
parent dccc82491c
commit 1421adbc61
2 changed files with 5 additions and 3 deletions

View File

@ -154,7 +154,7 @@ std::string smpl_buf::str_status(TIMESTAMP timestamp) const
return ost.str(); return ost.str();
} }
std::string smpl_buf::str_code(ssize_t code) std::string smpl_buf::str_code(int code)
{ {
switch (code) { switch (code) {
case ERROR_TIMESTAMP: case ERROR_TIMESTAMP:
@ -166,6 +166,8 @@ std::string smpl_buf::str_code(ssize_t code)
case ERROR_OVERFLOW: case ERROR_OVERFLOW:
return "Sample buffer: Overrun"; return "Sample buffer: Overrun";
default: default:
return "Sample buffer: Unknown error"; std::stringstream ss;
ss << "Sample buffer: Unknown error " << code;
return ss.str();
} }
} }

View File

@ -68,7 +68,7 @@ public:
@param code an error code @param code an error code
@return a formatted error string @return a formatted error string
*/ */
static std::string str_code(ssize_t code); static std::string str_code(int code);
enum err_code { enum err_code {
ERROR_TIMESTAMP = -1, ERROR_TIMESTAMP = -1,