#include <cstdarg>
#include <cstring>
+#include <boost/container/small_vector.hpp>
#include "common/ceph_context.h"
#include "common/ceph_releases.h"
#include "common/config.h"
// the classical OSD, it's different b/c of how the dout macro expands.
int cls_log(int level, const char *format, ...)
{
- int size = 256;
+ size_t size = 256;
va_list ap;
while (1) {
- char buf[size];
+ boost::container::small_vector<char, 256> buf(size);
va_start(ap, format);
- int n = vsnprintf(buf, size, format, ap);
+ int n = vsnprintf(buf.data(), size, format, ap);
va_end(ap);
-#define MAX_SIZE 8196
- if ((n > -1 && n < size) || size > MAX_SIZE) {
- dout(ceph::dout::need_dynamic(level)) << buf << dendl;
+#define MAX_SIZE 8196UL
+ if ((n > -1 && static_cast<size_t>(n) < size) || size > MAX_SIZE) {
+ dout(ceph::dout::need_dynamic(level)) << buf.data() << dendl;
return n;
}
size *= 2;
// vim: ts=8 sw=2 smarttab
#include <cstdarg>
+#include <boost/container/small_vector.hpp>
#include "common/ceph_context.h"
#include "common/ceph_releases.h"
#include "common/config.h"
// crimson-osd, it's different b/c of how the dout macro expands.
int cls_log(int level, const char *format, ...)
{
- int size = 256;
+ size_t size = 256;
va_list ap;
while (1) {
- char buf[size];
+ boost::container::small_vector<char, 256> buf(size);
va_start(ap, format);
- int n = vsnprintf(buf, size, format, ap);
+ int n = vsnprintf(buf.data(), size, format, ap);
va_end(ap);
-#define MAX_SIZE 8196
- if ((n > -1 && n < size) || size > MAX_SIZE) {
- dout(ceph::dout::need_dynamic(level)) << buf << dendl;
+#define MAX_SIZE 8196UL
+ if ((n > -1 && static_cast<size_t>(n) < size) || size > MAX_SIZE) {
+ dout(ceph::dout::need_dynamic(level)) << buf.data() << dendl;
return n;
}
size *= 2;