ostream_wrapper.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. #ifndef OSTREAM_WRAPPER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
  2. #define OSTREAM_WRAPPER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
  3. #if defined(_MSC_VER) || \
  4. (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
  5. (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
  6. #pragma once
  7. #endif
  8. #include <string>
  9. #include <vector>
  10. #include "yaml-cpp/dll.h"
  11. namespace YAML {
  12. class YAML_CPP_API ostream_wrapper {
  13. public:
  14. ostream_wrapper();
  15. explicit ostream_wrapper(std::ostream& stream);
  16. ostream_wrapper(const ostream_wrapper&) = delete;
  17. ostream_wrapper(ostream_wrapper&&) = delete;
  18. ostream_wrapper& operator=(const ostream_wrapper&) = delete;
  19. ostream_wrapper& operator=(ostream_wrapper&&) = delete;
  20. ~ostream_wrapper();
  21. void write(const std::string& str);
  22. void write(const char* str, std::size_t size);
  23. void set_comment() { m_comment = true; }
  24. const char* str() const {
  25. if (m_pStream) {
  26. return nullptr;
  27. } else {
  28. m_buffer[m_pos] = '\0';
  29. return &m_buffer[0];
  30. }
  31. }
  32. std::size_t row() const { return m_row; }
  33. std::size_t col() const { return m_col; }
  34. std::size_t pos() const { return m_pos; }
  35. bool comment() const { return m_comment; }
  36. private:
  37. void update_pos(char ch);
  38. private:
  39. mutable std::vector<char> m_buffer;
  40. std::ostream* const m_pStream;
  41. std::size_t m_pos;
  42. std::size_t m_row, m_col;
  43. bool m_comment;
  44. };
  45. template <std::size_t N>
  46. inline ostream_wrapper& operator<<(ostream_wrapper& stream,
  47. const char (&str)[N]) {
  48. stream.write(str, N - 1);
  49. return stream;
  50. }
  51. inline ostream_wrapper& operator<<(ostream_wrapper& stream,
  52. const std::string& str) {
  53. stream.write(str);
  54. return stream;
  55. }
  56. inline ostream_wrapper& operator<<(ostream_wrapper& stream, char ch) {
  57. stream.write(&ch, 1);
  58. return stream;
  59. }
  60. } // namespace YAML
  61. #endif // OSTREAM_WRAPPER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
PANIC: session(release): write data/sessions/3/a/3a512ad715692eee: no space left on device

PANIC

session(release): write data/sessions/3/a/3a512ad715692eee: no space left on device
github.com/go-macaron/session@v0.0.0-20190805070824-1a3cdc6f5659/session.go:199 (0x8b2934)
gopkg.in/macaron.v1@v1.3.9/context.go:79 (0x83d0a0)
github.com/go-macaron/inject@v0.0.0-20160627170012-d8a0b8677191/inject.go:157 (0x80ab07)
github.com/go-macaron/inject@v0.0.0-20160627170012-d8a0b8677191/inject.go:135 (0x80a8a8)
gopkg.in/macaron.v1@v1.3.9/context.go:121 (0x83d1f8)
gopkg.in/macaron.v1@v1.3.9/context.go:112 (0x84fdb5)
gopkg.in/macaron.v1@v1.3.9/recovery.go:161 (0x84fda8)
gopkg.in/macaron.v1@v1.3.9/logger.go:40 (0x840c73)
github.com/go-macaron/inject@v0.0.0-20160627170012-d8a0b8677191/inject.go:157 (0x80ab07)
github.com/go-macaron/inject@v0.0.0-20160627170012-d8a0b8677191/inject.go:135 (0x80a8a8)
gopkg.in/macaron.v1@v1.3.9/context.go:121 (0x83d1f8)
gopkg.in/macaron.v1@v1.3.9/router.go:187 (0x850fc6)
gopkg.in/macaron.v1@v1.3.9/router.go:303 (0x8493e5)
gopkg.in/macaron.v1@v1.3.9/macaron.go:220 (0x841fca)
net/http/server.go:2836 (0x7a79b2)
net/http/server.go:1924 (0x7a341b)
runtime/asm_amd64.s:1373 (0x46f9f0)