瀏覽代碼

ColorizedStreamBuf::str: Append character prefix to stream directly

Tatsuhiro Tsujikawa 12 年之前
父節點
當前提交
03d5b4627b
共有 1 個文件被更改,包括 1 次插入3 次删除
  1. 1 3
      src/ColorizedStream.cc

+ 1 - 3
src/ColorizedStream.cc

@@ -86,9 +86,7 @@ std::string ColorizedStreamBuf::str(bool color, size_t max) const
     }
     auto size = e.second.size();
     if (size > max) {
-      auto cut = e.second;
-      cut.resize(max);
-      rv << cut;
+      rv.write(e.second.c_str(), max);
       break;
     }
     rv << e.second;