Fix OS X 10.9 compiling issues

This commit is contained in:
Richard Lee 2014-01-17 19:11:39 +08:00
parent bca6e7717f
commit af7fedd3ef
3 changed files with 17 additions and 4 deletions

View File

@ -12,7 +12,7 @@ namespace Husky
class ThreadManager class ThreadManager
{ {
private: private:
typedef int HANDLE; typedef pthread_t HANDLE;
typedef void *(* PThreadFunc)(void* param); typedef void *(* PThreadFunc)(void* param);
public: public:
ThreadManager(){;} ThreadManager(){;}
@ -25,7 +25,7 @@ namespace Husky
_handles.clear(); _handles.clear();
} }
HANDLE CreateThread( PThreadFunc pFunc,void *pPara) int CreateThread( PThreadFunc pFunc,void *pPara)
{ {
pthread_t pt; pthread_t pt;
int nErrorCode = pthread_create(&pt,NULL,pFunc,pPara); int nErrorCode = pthread_create(&pt,NULL,pFunc,pPara);

View File

@ -29,7 +29,7 @@ TEST(KeywordExtractorTest, Test2)
TEST(KeywordExtractorTest, Test3) TEST(KeywordExtractorTest, Test3)
{ {
ifstream ifs("../test/testdata/weicheng.utf8"); ifstream ifs("../test/testdata/weicheng.utf8");
ASSERT_TRUE(ifs); ASSERT_TRUE(!!ifs);
string str((istreambuf_iterator<char>(ifs)), (istreambuf_iterator<char>())); string str((istreambuf_iterator<char>(ifs)), (istreambuf_iterator<char>()));
KeywordExtractor extractor("../dict/jieba.dict.utf8", "../dict/idf.utf8"); KeywordExtractor extractor("../dict/jieba.dict.utf8", "../dict/idf.utf8");
const char* res[] = {"小姐", "孙小姐", "方鸿渐", "自己", "没有"}; const char* res[] = {"小姐", "孙小姐", "方鸿渐", "自己", "没有"};
@ -42,7 +42,7 @@ TEST(KeywordExtractorTest, Test3)
TEST(KeywordExtractorTest, Test4) TEST(KeywordExtractorTest, Test4)
{ {
ifstream ifs("../test/testdata/weicheng.utf8"); ifstream ifs("../test/testdata/weicheng.utf8");
ASSERT_TRUE(ifs); ASSERT_TRUE(!!ifs);
string str((istreambuf_iterator<char>(ifs)), (istreambuf_iterator<char>())); string str((istreambuf_iterator<char>(ifs)), (istreambuf_iterator<char>()));
KeywordExtractor extractor("../dict/jieba.dict.utf8", "../dict/idf.utf8"); KeywordExtractor extractor("../dict/jieba.dict.utf8", "../dict/idf.utf8");
//const char* res[] = {"小姐", "孙小姐", "方鸿渐", "自己", "没有"}; //const char* res[] = {"小姐", "孙小姐", "方鸿渐", "自己", "没有"};

View File

@ -496,7 +496,20 @@
# undef _TR1_FUNCTIONAL // Allows the user to #include # undef _TR1_FUNCTIONAL // Allows the user to #include
// <tr1/functional> if he chooses to. // <tr1/functional> if he chooses to.
# else # else
# if defined (__cplusplus) && __cplusplus > 199711L
# include <tuple>
namespace std {
namespace tr1 {
using std::tuple;
using std::tuple_element;
using std::get;
using std::tuple_size;
using std::make_tuple;
}
}
# else
# include <tr1/tuple> // NOLINT # include <tr1/tuple> // NOLINT
# endif
# endif // !GTEST_HAS_RTTI && GTEST_GCC_VER_ < 40302 # endif // !GTEST_HAS_RTTI && GTEST_GCC_VER_ < 40302
# else # else