From df3b23968d5bda4050b7f7a002a7e5a1d7a48a74 Mon Sep 17 00:00:00 2001 From: Chris Dyer Date: Thu, 25 Apr 2013 23:32:02 -0400 Subject: only turn on c++11 for extractor --- utils/filelib.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'utils') diff --git a/utils/filelib.h b/utils/filelib.h index bb6e7415..b9ea3940 100644 --- a/utils/filelib.h +++ b/utils/filelib.h @@ -27,7 +27,7 @@ struct BaseFile { } bool is_null() const { return !ps_; } operator bool() const { - return ps_; + return ps_.get(); } S* stream() { return ps_.get(); } S* operator->() { return ps_.get(); } // compat with old ReadFile * -> new Readfile. remove? -- cgit v1.2.3 From 9b656ed347ee098574b98a59ce11ccecb81e52f6 Mon Sep 17 00:00:00 2001 From: Chris Dyer Date: Mon, 6 May 2013 22:22:36 -0400 Subject: fix --- utils/stringlib.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'utils') diff --git a/utils/stringlib.h b/utils/stringlib.h index ff5dc89d..1bb533d8 100644 --- a/utils/stringlib.h +++ b/utils/stringlib.h @@ -268,6 +268,16 @@ inline unsigned int UTF8Len(unsigned char x) { else return 0; } +inline unsigned int UTF8StringLen(const std::string& x) { + unsigned pos = 0; + int len = 0; + while(pos < x.size()) { + ++len; + pos += UTF8Len(x[pos]); + } + return len; +} + std::string md5(const std::string& in); #endif -- cgit v1.2.3