Skip to content

Commit

Permalink
Fix build and test errors on Ubuntu in windows 10
Browse files Browse the repository at this point in the history
  • Loading branch information
chen3feng committed Jan 15, 2017
1 parent 4f74915 commit d7d42b0
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 7 deletions.
4 changes: 2 additions & 2 deletions base/string/format/print_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ TEST(StringPrint, Signed)
short s = 9527;
int i = 95279527;
long l = 95279527L;
long ll = 9527952795279527LL;
long long ll = 9527952795279527LL;

EXPECT_EQ("42", StringPrint("%i", sc));

Expand All @@ -74,7 +74,7 @@ TEST(StringPrint, Unsigned)
unsigned short us = 9527;
unsigned int ui = 95279527U;
unsigned long ul = 95279527UL;
unsigned long ull = 9527952795279527ULL;
unsigned long long ull = 9527952795279527ULL;

EXPECT_EQ("142", StringPrint("%d", uc));
EXPECT_EQ("142", StringPrint("%i", uc));
Expand Down
4 changes: 2 additions & 2 deletions crypto/hash/md5.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,8 @@ void MD5::FinalInternal() {
byteReverse(context_.in, 14);

/* Append length in bits and transform */
((uint32_t *) context_.in)[14] = context_.bits[0];
((uint32_t *) context_.in)[15] = context_.bits[1];
memcpy(context_.in + 14 * 4, &context_.bits[0], 4);
memcpy(context_.in + 15 * 4, &context_.bits[1], 4);

MD5Transform(context_.buf, (uint32_t *) context_.in);
byteReverse((unsigned char *) context_.buf, 4);
Expand Down
4 changes: 3 additions & 1 deletion system/net/socket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,9 @@ bool DataSocket::Connect(const SocketAddress& address, int64_t timeout_ms)
case EWOULDBLOCK: // For winsock
case EINPROGRESS:
{
timeval tv = { timeout_ms / 1000, timeout_ms % 1000 * 1000 };
timeval tv = {
static_cast<time_t>(timeout_ms / 1000),
static_cast<suseconds_t>(timeout_ms % 1000 * 1000) };
if (WaitWriteable(&tv))
{
// WaitWriteable success doesn't means connect success.
Expand Down
3 changes: 2 additions & 1 deletion system/threading/rwlock.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <assert.h>
#include <errno.h>
#include <pthread.h>
#include <string.h>

#include "toft/base/uncopyable.h"
#include "toft/system/check_error.h"
Expand Down Expand Up @@ -108,7 +109,7 @@ class RwLock
#ifdef __GLIBC__
// If your program crashed here at runtime, maybe the rwlock object
// has been destructed.
if (m_lock.__data.__flags == 0xFFFFFFFFU)
if (memcmp(&m_lock.__data.__flags, "\xFF\xFF\xFF\xFF", 4) == 0)
TOFT_CHECK_ERRNO_ERROR(EINVAL);
#endif
}
Expand Down
2 changes: 1 addition & 1 deletion system/threading/thread_pool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ void ThreadPool::AddTaskInternal(
}

context.pending_tasks.push_back(task);
context.cond.Signal();
}
context.cond.Signal();
}

void ThreadPool::AddTask(Closure<void()>* callback) {
Expand Down

0 comments on commit d7d42b0

Please sign in to comment.