Fix Windows build. %zu isn't supported in the crt implementation
we use there, so it just crashes. Review URL: http://webrtc-codereview.appspot.com/213001 git-svn-id: http://webrtc.googlecode.com/svn/trunk@712 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
@@ -228,8 +228,8 @@ bool PeerChannel::AddMember(DataSocket* ds) {
|
||||
HandleDeliveryFailures(&failures);
|
||||
members_.push_back(new_guy);
|
||||
|
||||
printf("New member added (total=%zu): %s\n",
|
||||
members_.size(), new_guy->name().c_str());
|
||||
printf("New member added (total=%s): %s\n",
|
||||
size_t2str(members_.size()).c_str(), new_guy->name().c_str());
|
||||
|
||||
// Let the newly connected peer know about other members of the channel.
|
||||
std::string content_type;
|
||||
@@ -261,7 +261,7 @@ void PeerChannel::OnClosing(DataSocket* ds) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
printf("Total connected: %zu\n", members_.size());
|
||||
printf("Total connected: %s\n", size_t2str(members_.size()).c_str());
|
||||
}
|
||||
|
||||
void PeerChannel::CheckForTimeout() {
|
||||
|
||||
@@ -17,3 +17,14 @@ std::string int2str(int i) {
|
||||
sprintf(buffer, "%d", i); // NOLINT
|
||||
return buffer;
|
||||
}
|
||||
|
||||
std::string size_t2str(size_t i) {
|
||||
char buffer[32] = {0};
|
||||
#ifdef WIN32
|
||||
// %zu isn't supported on Windows.
|
||||
sprintf(buffer, "%Iu", i); // NOLINT
|
||||
#else
|
||||
sprintf(buffer, "%zu", i); // NOLINT
|
||||
#endif
|
||||
return buffer;
|
||||
}
|
||||
|
||||
@@ -18,5 +18,6 @@
|
||||
#endif
|
||||
|
||||
std::string int2str(int i);
|
||||
std::string size_t2str(size_t i);
|
||||
|
||||
#endif // PEERCONNECTION_SAMPLES_SERVER_UTILS_H_
|
||||
|
||||
Reference in New Issue
Block a user