Browse Source

Fixed compilation warning for MSVC

Paul-Louis Ageneau 5 years ago
parent
commit
f5faeba7b0
4 changed files with 10 additions and 9 deletions
  1. 1 0
      Jamfile
  2. 2 1
      src/description.cpp
  3. 4 5
      src/icetransport.cpp
  4. 3 3
      src/sctptransport.cpp

+ 1 - 0
Jamfile

@@ -22,6 +22,7 @@ lib libdatachannel
 	<library>/libdatachannel//plog
 	<toolset>gcc:<cxxflags>"-pthread -Wno-pedantic -Wno-unused-parameter -Wno-unused-variable"
 	<toolset>clang:<cxxflags>"-pthread -Wno-pedantic -Wno-unused-parameter -Wno-unused-variable"
+	<toolset>msvc:<cxxflags>"-DWIN32_LEAN_AND_MEAN -DNOMINMAX -D_CRT_SECURE_NO_WARNINGS -D_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING"
 	;
 
 feature gnutls : off on : composite propagated ;

+ 2 - 1
src/description.cpp

@@ -113,7 +113,8 @@ Description::Description(const string &sdp, Type type, Role role)
 				if (match_prefix(value, "sha-256 ")) {
 					mFingerprint = value.substr(8);
 					std::transform(mFingerprint->begin(), mFingerprint->end(),
-					               mFingerprint->begin(), [](char c) { return std::toupper(c); });
+					               mFingerprint->begin(),
+					               [](char c) { return char(std::toupper(c)); });
 				} else {
 					PLOG_WARNING << "Unknown SDP fingerprint type: " << value;
 				}

+ 4 - 5
src/icetransport.cpp

@@ -207,7 +207,7 @@ void IceTransport::processCandidate(const string &candidate) {
 
 void IceTransport::processGatheringDone() { changeGatheringState(GatheringState::Complete); }
 
-void IceTransport::StateChangeCallback(juice_agent_t *agent, juice_state_t state, void *user_ptr) {
+void IceTransport::StateChangeCallback(juice_agent_t *, juice_state_t state, void *user_ptr) {
 	auto iceTransport = static_cast<rtc::IceTransport *>(user_ptr);
 	try {
 		iceTransport->processStateChange(static_cast<unsigned int>(state));
@@ -216,7 +216,7 @@ void IceTransport::StateChangeCallback(juice_agent_t *agent, juice_state_t state
 	}
 }
 
-void IceTransport::CandidateCallback(juice_agent_t *agent, const char *sdp, void *user_ptr) {
+void IceTransport::CandidateCallback(juice_agent_t *, const char *sdp, void *user_ptr) {
 	auto iceTransport = static_cast<rtc::IceTransport *>(user_ptr);
 	try {
 		iceTransport->processCandidate(sdp);
@@ -225,7 +225,7 @@ void IceTransport::CandidateCallback(juice_agent_t *agent, const char *sdp, void
 	}
 }
 
-void IceTransport::GatheringDoneCallback(juice_agent_t *agent, void *user_ptr) {
+void IceTransport::GatheringDoneCallback(juice_agent_t *, void *user_ptr) {
 	auto iceTransport = static_cast<rtc::IceTransport *>(user_ptr);
 	try {
 		iceTransport->processGatheringDone();
@@ -234,8 +234,7 @@ void IceTransport::GatheringDoneCallback(juice_agent_t *agent, void *user_ptr) {
 	}
 }
 
-void IceTransport::RecvCallback(juice_agent_t *agent, const char *data, size_t size,
-                                void *user_ptr) {
+void IceTransport::RecvCallback(juice_agent_t *, const char *data, size_t size, void *user_ptr) {
 	auto iceTransport = static_cast<rtc::IceTransport *>(user_ptr);
 	try {
 		PLOG_VERBOSE << "Incoming size=" << size;

+ 3 - 3
src/sctptransport.cpp

@@ -262,7 +262,7 @@ bool SctpTransport::send(message_ptr message) {
 		return true;
 
 	mSendQueue.push(message);
-	updateBufferedAmount(message->stream, long(message_size_func(message)));
+	updateBufferedAmount(uint16_t(message->stream), long(message_size_func(message)));
 	return false;
 }
 
@@ -302,7 +302,7 @@ bool SctpTransport::trySendQueue() {
 		if (!trySendMessage(message))
 			return false;
 		mSendQueue.pop();
-		updateBufferedAmount(message->stream, -long(message_size_func(message)));
+		updateBufferedAmount(uint16_t(message->stream), -long(message_size_func(message)));
 	}
 	return true;
 }
@@ -324,7 +324,7 @@ bool SctpTransport::trySendMessage(message_ptr message) {
 		ppid = PPID_CONTROL;
 		break;
 	case Message::Reset:
-		sendReset(message->stream);
+		sendReset(uint16_t(message->stream));
 		return true;
 	default:
 		// Ignore