diff options
author | chai <chaifix@163.com> | 2019-01-12 21:48:33 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2019-01-12 21:48:33 +0800 |
commit | 8b00d67febf133e89f6a0bfabc41feed555dc4a9 (patch) | |
tree | fe48ef17c250afa40c2588300fcdb5920dba6951 /src/libjin/common/je_exception.cpp | |
parent | a907c39756ef6b368d06643afa491c49a9044a8e (diff) |
*去掉文件前缀je_
Diffstat (limited to 'src/libjin/common/je_exception.cpp')
-rw-r--r-- | src/libjin/common/je_exception.cpp | 46 |
1 files changed, 0 insertions, 46 deletions
diff --git a/src/libjin/common/je_exception.cpp b/src/libjin/common/je_exception.cpp deleted file mode 100644 index 5489a42..0000000 --- a/src/libjin/common/je_exception.cpp +++ /dev/null @@ -1,46 +0,0 @@ -#include <stdarg.h> - -#include "je_exception.h" - -namespace JinEngine -{ - - Exception::Exception(const char *fmt, ...) - { - va_list args; - int size_buffer = 256, size_out; - char *buffer; - while (true) - { - buffer = new char[size_buffer]; - memset(buffer, 0, size_buffer); - - va_start(args, fmt); - size_out = vsnprintf(buffer, size_buffer, fmt, args); - va_end(args); - - // see http://perfec.to/vsnprintf/pasprintf.c - // if size_out ... - // == -1 --> output was truncated - // == size_buffer --> output was truncated - // == size_buffer-1 --> ambiguous, /may/ have been truncated - // > size_buffer --> output was truncated, and size_out - // bytes would have been written - if (size_out == size_buffer || size_out == -1 || size_out == size_buffer - 1) - size_buffer *= 2; - else if (size_out > size_buffer) - size_buffer = size_out + 2; // to avoid the ambiguous case - else - break; - - delete[] buffer; - } - mMessage = std::string(buffer); - delete[] buffer; - } - - Exception::~Exception() throw() - { - } - -} // namespace JinEngine
\ No newline at end of file |