diff --git a/EchoCanceller.cpp b/EchoCanceller.cpp index 604a905..d11f110 100755 --- a/EchoCanceller.cpp +++ b/EchoCanceller.cpp @@ -16,6 +16,7 @@ #include "VoIPServerConfig.h" #include #include +#include using namespace tgvoip; @@ -144,6 +145,7 @@ void EchoCanceller::Enable(bool enabled){ } void EchoCanceller::ProcessInput(int16_t* inOut, size_t numSamples, bool& hasVoice){ +#ifndef TGVOIP_NO_DSP if(!isOn || (!enableAEC && !enableAGC && !enableNS)){ return; } @@ -165,6 +167,7 @@ void EchoCanceller::ProcessInput(int16_t* inOut, size_t numSamples, bool& hasVoi hasVoice=hasVoice || apm->voice_detection()->stream_has_voice(); } memcpy(inOut+480, audioFrame->data(), 480*2); +#endif } void EchoCanceller::SetAECStrength(int strength){ @@ -182,7 +185,9 @@ void EchoCanceller::SetAECStrength(int strength){ void EchoCanceller::SetVoiceDetectionEnabled(bool enabled){ enableVAD=enabled; +#ifndef TGVOIP_NO_DSP apm->voice_detection()->Enable(enabled); +#endif } using namespace tgvoip::effects; diff --git a/Makefile.am b/Makefile.am index 40cc325..91b2d33 100644 --- a/Makefile.am +++ b/Makefile.am @@ -365,9 +365,7 @@ SRC += \ ./webrtc_dsp/common_audio/vad/webrtc_vad.c \ ./webrtc_dsp/common_audio/vad/vad_filterbank.c \ ./webrtc_dsp/common_audio/vad/vad_core.c \ -./webrtc_dsp/common_audio/vad/vad_gmm.c \ -webrtc_dsp/common_audio/signal_processing/complex_bit_reverse.c \ -webrtc_dsp/common_audio/third_party/spl_sqrt_floor/spl_sqrt_floor.c +./webrtc_dsp/common_audio/vad/vad_gmm.c if TARGET_OS_OSX CFLAGS += -DWEBRTC_MAC @@ -395,7 +393,7 @@ endif if TARGET_CPU_ARM SRC += \ webrtc_dsp/common_audio/signal_processing/complex_bit_reverse_arm.S \ -webrtc_dsp/common_audio/signal_processing/spl_sqrt_floor_arm.S +webrtc_dsp/common_audio/third_party/spl_sqrt_floor/spl_sqrt_floor_arm.S if TARGET_CPU_ARMV7 CFLAGS += -mfpu=neon -mfloat-abi=hard CCASFLAGS += -mfpu=neon -mfloat-abi=hard @@ -409,6 +407,10 @@ webrtc_dsp/modules/audio_processing/ns/nsx_core_neon.c \ webrtc_dsp/modules/audio_processing/utility/ooura_fft_neon.cc # webrtc_dsp/common_audio/signal_processing/filter_ar_fast_q12_armv7.S endif +else +SRC += \ +webrtc_dsp/common_audio/signal_processing/complex_bit_reverse.c \ +webrtc_dsp/common_audio/third_party/spl_sqrt_floor/spl_sqrt_floor.c endif # headers diff --git a/Makefile.in b/Makefile.in index 0aacce6..8645a62 100644 --- a/Makefile.in +++ b/Makefile.in @@ -392,9 +392,7 @@ host_triplet = @host@ @ENABLE_DSP_TRUE@./webrtc_dsp/common_audio/vad/webrtc_vad.c \ @ENABLE_DSP_TRUE@./webrtc_dsp/common_audio/vad/vad_filterbank.c \ @ENABLE_DSP_TRUE@./webrtc_dsp/common_audio/vad/vad_core.c \ -@ENABLE_DSP_TRUE@./webrtc_dsp/common_audio/vad/vad_gmm.c \ -@ENABLE_DSP_TRUE@webrtc_dsp/common_audio/signal_processing/complex_bit_reverse.c \ -@ENABLE_DSP_TRUE@webrtc_dsp/common_audio/third_party/spl_sqrt_floor/spl_sqrt_floor.c +@ENABLE_DSP_TRUE@./webrtc_dsp/common_audio/vad/vad_gmm.c @ENABLE_DSP_TRUE@@TARGET_OS_OSX_TRUE@am__append_11 = -DWEBRTC_MAC @ENABLE_DSP_TRUE@@TARGET_OS_OSX_TRUE@am__append_12 = \ @@ -415,7 +413,7 @@ host_triplet = @host@ @ENABLE_DSP_TRUE@@TARGET_CPU_ARM_TRUE@am__append_18 = \ @ENABLE_DSP_TRUE@@TARGET_CPU_ARM_TRUE@webrtc_dsp/common_audio/signal_processing/complex_bit_reverse_arm.S \ -@ENABLE_DSP_TRUE@@TARGET_CPU_ARM_TRUE@webrtc_dsp/common_audio/signal_processing/spl_sqrt_floor_arm.S +@ENABLE_DSP_TRUE@@TARGET_CPU_ARM_TRUE@webrtc_dsp/common_audio/third_party/spl_sqrt_floor/spl_sqrt_floor_arm.S @ENABLE_DSP_TRUE@@TARGET_CPU_ARMV7_TRUE@@TARGET_CPU_ARM_TRUE@am__append_19 = -mfpu=neon -mfloat-abi=hard @ENABLE_DSP_TRUE@@TARGET_CPU_ARMV7_TRUE@@TARGET_CPU_ARM_TRUE@am__append_20 = -mfpu=neon -mfloat-abi=hard @@ -429,9 +427,13 @@ host_triplet = @host@ @ENABLE_DSP_TRUE@@TARGET_CPU_ARMV7_TRUE@@TARGET_CPU_ARM_TRUE@webrtc_dsp/modules/audio_processing/utility/ooura_fft_neon.cc # webrtc_dsp/common_audio/signal_processing/filter_ar_fast_q12_armv7.S +@ENABLE_DSP_TRUE@@TARGET_CPU_ARM_FALSE@am__append_22 = \ +@ENABLE_DSP_TRUE@@TARGET_CPU_ARM_FALSE@webrtc_dsp/common_audio/signal_processing/complex_bit_reverse.c \ +@ENABLE_DSP_TRUE@@TARGET_CPU_ARM_FALSE@webrtc_dsp/common_audio/third_party/spl_sqrt_floor/spl_sqrt_floor.c + # headers -@ENABLE_DSP_TRUE@am__append_22 = \ +@ENABLE_DSP_TRUE@am__append_23 = \ @ENABLE_DSP_TRUE@webrtc_dsp/system_wrappers/include/field_trial.h \ @ENABLE_DSP_TRUE@webrtc_dsp/system_wrappers/include/cpu_features_wrapper.h \ @ENABLE_DSP_TRUE@webrtc_dsp/system_wrappers/include/asm_defines.h \ @@ -751,7 +753,7 @@ host_triplet = @host@ @ENABLE_DSP_TRUE@webrtc_dsp/common_audio/vad/vad_sp.h \ @ENABLE_DSP_TRUE@webrtc_dsp/common_audio/vad/vad_filterbank.h -@ENABLE_DSP_FALSE@am__append_23 = -DTGVOIP_NO_DSP +@ENABLE_DSP_FALSE@am__append_24 = -DTGVOIP_NO_DSP subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac @@ -1076,15 +1078,13 @@ am__libtgvoip_la_SOURCES_DIST = VoIPController.cpp Buffers.cpp \ ./webrtc_dsp/common_audio/vad/vad_filterbank.c \ ./webrtc_dsp/common_audio/vad/vad_core.c \ ./webrtc_dsp/common_audio/vad/vad_gmm.c \ - webrtc_dsp/common_audio/signal_processing/complex_bit_reverse.c \ - webrtc_dsp/common_audio/third_party/spl_sqrt_floor/spl_sqrt_floor.c \ webrtc_dsp/rtc_base/logging_mac.mm \ webrtc_dsp/rtc_base/logging_mac.h \ webrtc_dsp/modules/audio_processing/aec/aec_core_sse2.cc \ webrtc_dsp/modules/audio_processing/utility/ooura_fft_sse2.cc \ audio/AudioIOCallback.cpp \ webrtc_dsp/common_audio/signal_processing/complex_bit_reverse_arm.S \ - webrtc_dsp/common_audio/signal_processing/spl_sqrt_floor_arm.S \ + webrtc_dsp/common_audio/third_party/spl_sqrt_floor/spl_sqrt_floor_arm.S \ webrtc_dsp/common_audio/signal_processing/cross_correlation_neon.c \ webrtc_dsp/common_audio/signal_processing/downsample_fast_neon.c \ webrtc_dsp/common_audio/signal_processing/min_max_operations_neon.c \ @@ -1092,6 +1092,8 @@ am__libtgvoip_la_SOURCES_DIST = VoIPController.cpp Buffers.cpp \ webrtc_dsp/modules/audio_processing/aecm/aecm_core_neon.cc \ webrtc_dsp/modules/audio_processing/ns/nsx_core_neon.c \ webrtc_dsp/modules/audio_processing/utility/ooura_fft_neon.cc \ + webrtc_dsp/common_audio/signal_processing/complex_bit_reverse.c \ + webrtc_dsp/common_audio/third_party/spl_sqrt_floor/spl_sqrt_floor.c \ webrtc_dsp/system_wrappers/include/field_trial.h \ webrtc_dsp/system_wrappers/include/cpu_features_wrapper.h \ webrtc_dsp/system_wrappers/include/asm_defines.h \ @@ -1696,15 +1698,13 @@ am__dirstamp = $(am__leading_dot)dirstamp @ENABLE_DSP_TRUE@ ./webrtc_dsp/common_audio/vad/webrtc_vad.lo \ @ENABLE_DSP_TRUE@ ./webrtc_dsp/common_audio/vad/vad_filterbank.lo \ @ENABLE_DSP_TRUE@ ./webrtc_dsp/common_audio/vad/vad_core.lo \ -@ENABLE_DSP_TRUE@ ./webrtc_dsp/common_audio/vad/vad_gmm.lo \ -@ENABLE_DSP_TRUE@ webrtc_dsp/common_audio/signal_processing/complex_bit_reverse.lo \ -@ENABLE_DSP_TRUE@ webrtc_dsp/common_audio/third_party/spl_sqrt_floor/spl_sqrt_floor.lo +@ENABLE_DSP_TRUE@ ./webrtc_dsp/common_audio/vad/vad_gmm.lo @ENABLE_DSP_TRUE@@TARGET_OS_OSX_TRUE@am__objects_5 = webrtc_dsp/rtc_base/logging_mac.lo @ENABLE_DSP_TRUE@@TARGET_CPU_X86_TRUE@am__objects_6 = webrtc_dsp/modules/audio_processing/aec/aec_core_sse2.lo \ @ENABLE_DSP_TRUE@@TARGET_CPU_X86_TRUE@ webrtc_dsp/modules/audio_processing/utility/ooura_fft_sse2.lo @ENABLE_AUDIO_CALLBACK_TRUE@@ENABLE_DSP_TRUE@am__objects_7 = audio/AudioIOCallback.lo @ENABLE_DSP_TRUE@@TARGET_CPU_ARM_TRUE@am__objects_8 = webrtc_dsp/common_audio/signal_processing/complex_bit_reverse_arm.lo \ -@ENABLE_DSP_TRUE@@TARGET_CPU_ARM_TRUE@ webrtc_dsp/common_audio/signal_processing/spl_sqrt_floor_arm.lo +@ENABLE_DSP_TRUE@@TARGET_CPU_ARM_TRUE@ webrtc_dsp/common_audio/third_party/spl_sqrt_floor/spl_sqrt_floor_arm.lo @ENABLE_DSP_TRUE@@TARGET_CPU_ARMV7_TRUE@@TARGET_CPU_ARM_TRUE@am__objects_9 = webrtc_dsp/common_audio/signal_processing/cross_correlation_neon.lo \ @ENABLE_DSP_TRUE@@TARGET_CPU_ARMV7_TRUE@@TARGET_CPU_ARM_TRUE@ webrtc_dsp/common_audio/signal_processing/downsample_fast_neon.lo \ @ENABLE_DSP_TRUE@@TARGET_CPU_ARMV7_TRUE@@TARGET_CPU_ARM_TRUE@ webrtc_dsp/common_audio/signal_processing/min_max_operations_neon.lo \ @@ -1712,8 +1712,10 @@ am__dirstamp = $(am__leading_dot)dirstamp @ENABLE_DSP_TRUE@@TARGET_CPU_ARMV7_TRUE@@TARGET_CPU_ARM_TRUE@ webrtc_dsp/modules/audio_processing/aecm/aecm_core_neon.lo \ @ENABLE_DSP_TRUE@@TARGET_CPU_ARMV7_TRUE@@TARGET_CPU_ARM_TRUE@ webrtc_dsp/modules/audio_processing/ns/nsx_core_neon.lo \ @ENABLE_DSP_TRUE@@TARGET_CPU_ARMV7_TRUE@@TARGET_CPU_ARM_TRUE@ webrtc_dsp/modules/audio_processing/utility/ooura_fft_neon.lo -am__objects_10 = -am__objects_11 = VoIPController.lo Buffers.lo CongestionControl.lo \ +@ENABLE_DSP_TRUE@@TARGET_CPU_ARM_FALSE@am__objects_10 = webrtc_dsp/common_audio/signal_processing/complex_bit_reverse.lo \ +@ENABLE_DSP_TRUE@@TARGET_CPU_ARM_FALSE@ webrtc_dsp/common_audio/third_party/spl_sqrt_floor/spl_sqrt_floor.lo +am__objects_11 = +am__objects_12 = VoIPController.lo Buffers.lo CongestionControl.lo \ EchoCanceller.lo JitterBuffer.lo logging.lo MediaStreamItf.lo \ MessageThread.lo NetworkSocket.lo OpusDecoder.lo \ OpusEncoder.lo PacketReassembler.lo VoIPGroupController.lo \ @@ -1723,10 +1725,11 @@ am__objects_11 = VoIPController.lo Buffers.lo CongestionControl.lo \ video/VideoRenderer.lo json11.lo $(am__objects_1) \ $(am__objects_2) $(am__objects_3) $(am__objects_4) \ $(am__objects_5) $(am__objects_6) $(am__objects_7) \ - $(am__objects_8) $(am__objects_9) $(am__objects_10) -am__objects_12 = $(am__objects_10) $(am__objects_10) $(am__objects_10) \ - $(am__objects_10) -am_libtgvoip_la_OBJECTS = $(am__objects_11) $(am__objects_12) + $(am__objects_8) $(am__objects_9) $(am__objects_10) \ + $(am__objects_11) +am__objects_13 = $(am__objects_11) $(am__objects_11) $(am__objects_11) \ + $(am__objects_11) +am_libtgvoip_la_OBJECTS = $(am__objects_12) $(am__objects_13) libtgvoip_la_OBJECTS = $(am_libtgvoip_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) @@ -2043,8 +2046,8 @@ am__depfiles_remade = ./$(DEPDIR)/Buffers.Plo \ webrtc_dsp/common_audio/signal_processing/$(DEPDIR)/cross_correlation_neon.Plo \ webrtc_dsp/common_audio/signal_processing/$(DEPDIR)/downsample_fast_neon.Plo \ webrtc_dsp/common_audio/signal_processing/$(DEPDIR)/min_max_operations_neon.Plo \ - webrtc_dsp/common_audio/signal_processing/$(DEPDIR)/spl_sqrt_floor_arm.Plo \ webrtc_dsp/common_audio/third_party/spl_sqrt_floor/$(DEPDIR)/spl_sqrt_floor.Plo \ + webrtc_dsp/common_audio/third_party/spl_sqrt_floor/$(DEPDIR)/spl_sqrt_floor_arm.Plo \ webrtc_dsp/modules/audio_processing/aec/$(DEPDIR)/aec_core_neon.Plo \ webrtc_dsp/modules/audio_processing/aec/$(DEPDIR)/aec_core_sse2.Plo \ webrtc_dsp/modules/audio_processing/aecm/$(DEPDIR)/aecm_core_neon.Plo \ @@ -2198,7 +2201,7 @@ CCASFLAGS = @CCASFLAGS@ $(am__append_9) $(am__append_20) CCDEPMODE = @CCDEPMODE@ CFLAGS = -Wall -DHAVE_CONFIG_H -Wno-unknown-pragmas $(am__append_8) \ $(am__append_11) $(am__append_13) $(am__append_15) \ - $(am__append_19) $(am__append_23) + $(am__append_19) $(am__append_24) CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ @@ -2324,7 +2327,8 @@ SRC = VoIPController.cpp Buffers.cpp CongestionControl.cpp \ video/VideoRenderer.cpp json11.cpp $(am__append_1) \ $(am__append_4) $(am__append_6) $(am__append_10) \ $(am__append_12) $(am__append_14) $(am__append_16) \ - $(am__append_18) $(am__append_21) $(am__append_22) + $(am__append_18) $(am__append_21) $(am__append_22) \ + $(am__append_23) TGVOIP_HDRS = VoIPController.h Buffers.h BlockingQueue.h \ PrivateDefines.h CongestionControl.h EchoCanceller.h \ JitterBuffer.h logging.h threading.h MediaStreamItf.h \ @@ -3434,17 +3438,6 @@ webrtc_dsp/common_audio/vad/$(DEPDIR)/$(am__dirstamp): ./webrtc_dsp/common_audio/vad/vad_gmm.lo: \ webrtc_dsp/common_audio/vad/$(am__dirstamp) \ webrtc_dsp/common_audio/vad/$(DEPDIR)/$(am__dirstamp) -webrtc_dsp/common_audio/signal_processing/complex_bit_reverse.lo: \ - webrtc_dsp/common_audio/signal_processing/$(am__dirstamp) \ - webrtc_dsp/common_audio/signal_processing/$(DEPDIR)/$(am__dirstamp) -webrtc_dsp/common_audio/third_party/spl_sqrt_floor/$(am__dirstamp): - @$(MKDIR_P) webrtc_dsp/common_audio/third_party/spl_sqrt_floor - @: > webrtc_dsp/common_audio/third_party/spl_sqrt_floor/$(am__dirstamp) -webrtc_dsp/common_audio/third_party/spl_sqrt_floor/$(DEPDIR)/$(am__dirstamp): - @$(MKDIR_P) webrtc_dsp/common_audio/third_party/spl_sqrt_floor/$(DEPDIR) - @: > webrtc_dsp/common_audio/third_party/spl_sqrt_floor/$(DEPDIR)/$(am__dirstamp) -webrtc_dsp/common_audio/third_party/spl_sqrt_floor/spl_sqrt_floor.lo: webrtc_dsp/common_audio/third_party/spl_sqrt_floor/$(am__dirstamp) \ - webrtc_dsp/common_audio/third_party/spl_sqrt_floor/$(DEPDIR)/$(am__dirstamp) webrtc_dsp/rtc_base/logging_mac.lo: \ webrtc_dsp/rtc_base/$(am__dirstamp) \ webrtc_dsp/rtc_base/$(DEPDIR)/$(am__dirstamp) @@ -3459,9 +3452,14 @@ audio/AudioIOCallback.lo: audio/$(am__dirstamp) \ webrtc_dsp/common_audio/signal_processing/complex_bit_reverse_arm.lo: \ webrtc_dsp/common_audio/signal_processing/$(am__dirstamp) \ webrtc_dsp/common_audio/signal_processing/$(DEPDIR)/$(am__dirstamp) -webrtc_dsp/common_audio/signal_processing/spl_sqrt_floor_arm.lo: \ - webrtc_dsp/common_audio/signal_processing/$(am__dirstamp) \ - webrtc_dsp/common_audio/signal_processing/$(DEPDIR)/$(am__dirstamp) +webrtc_dsp/common_audio/third_party/spl_sqrt_floor/$(am__dirstamp): + @$(MKDIR_P) webrtc_dsp/common_audio/third_party/spl_sqrt_floor + @: > webrtc_dsp/common_audio/third_party/spl_sqrt_floor/$(am__dirstamp) +webrtc_dsp/common_audio/third_party/spl_sqrt_floor/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) webrtc_dsp/common_audio/third_party/spl_sqrt_floor/$(DEPDIR) + @: > webrtc_dsp/common_audio/third_party/spl_sqrt_floor/$(DEPDIR)/$(am__dirstamp) +webrtc_dsp/common_audio/third_party/spl_sqrt_floor/spl_sqrt_floor_arm.lo: webrtc_dsp/common_audio/third_party/spl_sqrt_floor/$(am__dirstamp) \ + webrtc_dsp/common_audio/third_party/spl_sqrt_floor/$(DEPDIR)/$(am__dirstamp) webrtc_dsp/common_audio/signal_processing/cross_correlation_neon.lo: \ webrtc_dsp/common_audio/signal_processing/$(am__dirstamp) \ webrtc_dsp/common_audio/signal_processing/$(DEPDIR)/$(am__dirstamp) @@ -3483,6 +3481,11 @@ webrtc_dsp/modules/audio_processing/ns/nsx_core_neon.lo: \ webrtc_dsp/modules/audio_processing/utility/ooura_fft_neon.lo: \ webrtc_dsp/modules/audio_processing/utility/$(am__dirstamp) \ webrtc_dsp/modules/audio_processing/utility/$(DEPDIR)/$(am__dirstamp) +webrtc_dsp/common_audio/signal_processing/complex_bit_reverse.lo: \ + webrtc_dsp/common_audio/signal_processing/$(am__dirstamp) \ + webrtc_dsp/common_audio/signal_processing/$(DEPDIR)/$(am__dirstamp) +webrtc_dsp/common_audio/third_party/spl_sqrt_floor/spl_sqrt_floor.lo: webrtc_dsp/common_audio/third_party/spl_sqrt_floor/$(am__dirstamp) \ + webrtc_dsp/common_audio/third_party/spl_sqrt_floor/$(DEPDIR)/$(am__dirstamp) libtgvoip.la: $(libtgvoip_la_OBJECTS) $(libtgvoip_la_DEPENDENCIES) $(EXTRA_libtgvoip_la_DEPENDENCIES) $(AM_V_OBJCXXLD)$(OBJCXXLINK) -rpath $(libdir) $(libtgvoip_la_OBJECTS) $(libtgvoip_la_LIBADD) $(LIBS) @@ -3885,8 +3888,8 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@webrtc_dsp/common_audio/signal_processing/$(DEPDIR)/cross_correlation_neon.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@webrtc_dsp/common_audio/signal_processing/$(DEPDIR)/downsample_fast_neon.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@webrtc_dsp/common_audio/signal_processing/$(DEPDIR)/min_max_operations_neon.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@webrtc_dsp/common_audio/signal_processing/$(DEPDIR)/spl_sqrt_floor_arm.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@webrtc_dsp/common_audio/third_party/spl_sqrt_floor/$(DEPDIR)/spl_sqrt_floor.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@webrtc_dsp/common_audio/third_party/spl_sqrt_floor/$(DEPDIR)/spl_sqrt_floor_arm.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@webrtc_dsp/modules/audio_processing/aec/$(DEPDIR)/aec_core_neon.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@webrtc_dsp/modules/audio_processing/aec/$(DEPDIR)/aec_core_sse2.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@webrtc_dsp/modules/audio_processing/aecm/$(DEPDIR)/aecm_core_neon.Plo@am__quote@ # am--include-marker @@ -4748,8 +4751,8 @@ distclean: distclean-am -rm -f webrtc_dsp/common_audio/signal_processing/$(DEPDIR)/cross_correlation_neon.Plo -rm -f webrtc_dsp/common_audio/signal_processing/$(DEPDIR)/downsample_fast_neon.Plo -rm -f webrtc_dsp/common_audio/signal_processing/$(DEPDIR)/min_max_operations_neon.Plo - -rm -f webrtc_dsp/common_audio/signal_processing/$(DEPDIR)/spl_sqrt_floor_arm.Plo -rm -f webrtc_dsp/common_audio/third_party/spl_sqrt_floor/$(DEPDIR)/spl_sqrt_floor.Plo + -rm -f webrtc_dsp/common_audio/third_party/spl_sqrt_floor/$(DEPDIR)/spl_sqrt_floor_arm.Plo -rm -f webrtc_dsp/modules/audio_processing/aec/$(DEPDIR)/aec_core_neon.Plo -rm -f webrtc_dsp/modules/audio_processing/aec/$(DEPDIR)/aec_core_sse2.Plo -rm -f webrtc_dsp/modules/audio_processing/aecm/$(DEPDIR)/aecm_core_neon.Plo @@ -5106,8 +5109,8 @@ maintainer-clean: maintainer-clean-am -rm -f webrtc_dsp/common_audio/signal_processing/$(DEPDIR)/cross_correlation_neon.Plo -rm -f webrtc_dsp/common_audio/signal_processing/$(DEPDIR)/downsample_fast_neon.Plo -rm -f webrtc_dsp/common_audio/signal_processing/$(DEPDIR)/min_max_operations_neon.Plo - -rm -f webrtc_dsp/common_audio/signal_processing/$(DEPDIR)/spl_sqrt_floor_arm.Plo -rm -f webrtc_dsp/common_audio/third_party/spl_sqrt_floor/$(DEPDIR)/spl_sqrt_floor.Plo + -rm -f webrtc_dsp/common_audio/third_party/spl_sqrt_floor/$(DEPDIR)/spl_sqrt_floor_arm.Plo -rm -f webrtc_dsp/modules/audio_processing/aec/$(DEPDIR)/aec_core_neon.Plo -rm -f webrtc_dsp/modules/audio_processing/aec/$(DEPDIR)/aec_core_sse2.Plo -rm -f webrtc_dsp/modules/audio_processing/aecm/$(DEPDIR)/aecm_core_neon.Plo diff --git a/NetworkSocket.cpp b/NetworkSocket.cpp index 6176c8e..4ee314e 100644 --- a/NetworkSocket.cpp +++ b/NetworkSocket.cpp @@ -158,6 +158,15 @@ std::string IPv4Address::ToString() const{ #endif } +bool IPv4Address::PrefixMatches(const unsigned int prefix, const NetworkAddress &other) const{ + const IPv4Address* v4=dynamic_cast(&other); + if(v4){ + uint32_t mask=0xFFFFFFFF << (32-prefix); + return (address & mask) == (v4->address & mask); + } + return false; +} + /*sockaddr &IPv4Address::ToSockAddr(uint16_t port){ sockaddr_in sa; sa.sin_family=AF_INET; @@ -198,6 +207,10 @@ std::string IPv6Address::ToString() const{ #endif } +bool IPv6Address::PrefixMatches(const unsigned int prefix, const NetworkAddress &other) const{ + return false; +} + bool IPv6Address::IsEmpty() const{ const uint64_t* a=reinterpret_cast(address); return a[0]==0LL && a[1]==0LL; diff --git a/NetworkSocket.h b/NetworkSocket.h index fd98bbb..67b1342 100644 --- a/NetworkSocket.h +++ b/NetworkSocket.h @@ -31,6 +31,7 @@ namespace tgvoip { bool operator!=(const NetworkAddress& other) const; virtual ~NetworkAddress()=default; virtual bool IsEmpty() const =0; + virtual bool PrefixMatches(const unsigned int prefix, const NetworkAddress& other) const =0; }; class IPv4Address : public NetworkAddress{ @@ -41,6 +42,11 @@ namespace tgvoip { virtual std::string ToString() const override; uint32_t GetAddress() const; virtual bool IsEmpty() const override; + virtual bool PrefixMatches(const unsigned int prefix, const NetworkAddress& other) const override; + + static const IPv4Address Broadcast(){ + return IPv4Address(0xFFFFFFFF); + } private: uint32_t address; }; @@ -53,6 +59,7 @@ namespace tgvoip { virtual std::string ToString() const override; const uint8_t* GetAddress() const; virtual bool IsEmpty() const override; + virtual bool PrefixMatches(const unsigned int prefix, const NetworkAddress& other) const override; private: uint8_t address[16]; }; diff --git a/OpusEncoder.h b/OpusEncoder.h index bf919e0..10313e7 100755 --- a/OpusEncoder.h +++ b/OpusEncoder.h @@ -40,6 +40,9 @@ public: void SetVadMode(bool vad); void AddAudioEffect(effects::AudioEffect* effect); void RemoveAudioEffect(effects::AudioEffect* effect); + int GetComplexity(){ + return complexity; + } private: static size_t Callback(unsigned char* data, size_t len, void* param); diff --git a/PrivateDefines.h b/PrivateDefines.h index ab54465..e6668be 100644 --- a/PrivateDefines.h +++ b/PrivateDefines.h @@ -26,7 +26,7 @@ #define IS_MOBILE_NETWORK(x) (x==NET_TYPE_GPRS || x==NET_TYPE_EDGE || x==NET_TYPE_3G || x==NET_TYPE_HSPA || x==NET_TYPE_LTE || x==NET_TYPE_OTHER_MOBILE) #define PROTOCOL_NAME 0x50567247 // "GrVP" in little endian (reversed here) -#define PROTOCOL_VERSION 8 +#define PROTOCOL_VERSION 9 #define MIN_PROTOCOL_VERSION 3 #define STREAM_DATA_FLAG_LEN16 0x40 diff --git a/VoIPController.cpp b/VoIPController.cpp index 7e06f11..f550834 100755 --- a/VoIPController.cpp +++ b/VoIPController.cpp @@ -26,6 +26,7 @@ #include #include #include +#include #include #include @@ -282,17 +283,17 @@ VoIPController::~VoIPController(){ delete echoCanceller; } delete conctl; - if(tgvoipLogFile){ - FILE* log=tgvoipLogFile; - tgvoipLogFile=NULL; - fclose(log); - } if(statsDump) fclose(statsDump); if(resolvedProxyAddress) delete resolvedProxyAddress; delete selectCanceller; LOGD("Left VoIPController::~VoIPController"); + if(tgvoipLogFile){ + FILE* log=tgvoipLogFile; + tgvoipLogFile=NULL; + fclose(log); + } } void VoIPController::Stop(){ @@ -435,6 +436,7 @@ void VoIPController::SetNetworkType(int type){ activeNetItfName=itfName; if(isFirstChange) return; + wasNetworkHandover=true; if(currentEndpoint){ const Endpoint& _currentEndpoint=endpoints.at(currentEndpoint); const Endpoint& _preferredRelay=endpoints.at(preferredRelay); @@ -453,8 +455,8 @@ void VoIPController::SetNetworkType(int type){ } }else if(endpoint.type==Endpoint::Type::TCP_RELAY && endpoint.socket){ endpoint.socket->Close(); - delete endpoint.socket; - endpoint.socket=NULL; + //delete endpoint.socket; + //endpoint.socket=NULL; } //if(endpoint->type==Endpoint::Type::UDP_P2P_INET){ endpoint.averageRTT=0; @@ -650,10 +652,6 @@ void VoIPController::GetStats(TrafficStats *stats){ } string VoIPController::GetDebugLog(){ - vector lpkts; - for(DebugLoggedPacket& lpkt:debugLoggedPackets){ - lpkts.push_back(json11::Json::array{lpkt.timestamp, lpkt.seq, lpkt.length}); - } map network{ {"type", NetworkTypeToString(networkType)} }; @@ -665,6 +663,23 @@ string VoIPController::GetDebugLog(){ network["mcc"]=carrier.mcc; network["mnc"]=carrier.mnc; } + }else if(networkType==NET_TYPE_WIFI){ +#ifdef __ANDROID__ + jni::DoWithJNI([&](JNIEnv* env){ + jmethodID getWifiInfoMethod=env->GetStaticMethodID(jniUtilitiesClass, "getWifiInfo", "()[I"); + jintArray res=static_cast(env->CallStaticObjectMethod(jniUtilitiesClass, getWifiInfoMethod)); + if(res){ + jint* wifiInfo=env->GetIntArrayElements(res, NULL); + network["rssi"]=wifiInfo[0]; + network["link_speed"]=wifiInfo[1]; + env->ReleaseIntArrayElements(res, wifiInfo, JNI_ABORT); + } + }); +#endif + } + /*vector lpkts; + for(DebugLoggedPacket& lpkt:debugLoggedPackets){ + lpkts.push_back(json11::Json::array{lpkt.timestamp, lpkt.seq, lpkt.length}); } return json11::Json(json11::Json::object{ {"log_type", "out_packet_stats"}, @@ -677,6 +692,50 @@ string VoIPController::GetDebugLog(){ }}, {"call_duration", GetCurrentTime()-connectionInitTime}, {"out_packet_stats", lpkts} + }).dump();*/ + + string p2pType="none"; + Endpoint& cur=endpoints[currentEndpoint]; + if(cur.type==Endpoint::Type::UDP_P2P_INET) + p2pType=cur.IsIPv6Only() ? "inet6" : "inet"; + else if(cur.type==Endpoint::Type::UDP_P2P_LAN) + p2pType="lan"; + + vector problems; + if(lastError==ERROR_TIMEOUT) + problems.push_back("timeout"); + if(wasReconnecting) + problems.push_back("reconnecting"); + if(wasExtraEC) + problems.push_back("extra_ec"); + if(wasEncoderLaggy) + problems.push_back("encoder_lag"); + if(!wasEstablished) + problems.push_back("not_inited"); + if(wasNetworkHandover) + problems.push_back("network_handover"); + + ostringstream prefRelay; + prefRelay << preferredRelay; + + return json11::Json(json11::Json::object{ + {"log_type", "call_stats"}, + {"libtgvoip_version", LIBTGVOIP_VERSION}, + {"network", network}, + {"protocol_version", std::min(peerVersion, PROTOCOL_VERSION)}, + {"udp_avail", udpConnectivityState==UDP_AVAILABLE}, + {"tcp_used", useTCP}, + {"relay_rtt", (int)(endpoints[preferredRelay].averageRTT*1000.0)}, + {"p2p_type", p2pType}, + {"rtt", (int)(endpoints[currentEndpoint].averageRTT*1000.0)}, + {"packet_stats", json11::Json::object{ + {"out", (int)seq}, + {"in", (int)packetsReceived}, + {"lost_out", (int)conctl->GetSendLossCount()}, + {"lost_in", (int)recvLossCount} + }}, + {"problems", problems}, + {"pref_relay", prefRelay.str()} }).dump(); } @@ -869,7 +928,8 @@ vector VoIPController::GetPersistentState(){ {"tcp", proxySupportsTCP} }}); } - const char* jstr=Json(obj).dump().c_str(); + string _jstr=Json(obj).dump(); + const char* jstr=_jstr.c_str(); return vector(jstr, jstr+strlen(jstr)); } @@ -1598,6 +1658,15 @@ void VoIPController::RunRecvThread(){ } } } + if(!srcEndpointID && packet.protocol==PROTO_UDP){ + try{ + Endpoint &p2p=GetEndpointByType(Endpoint::Type::UDP_P2P_INET); + if(p2p.rtts[0]==0.0 && p2p.address.PrefixMatches(24, *packet.address)){ + LOGD("Packet source matches p2p endpoint partially: %s:%u", packet.address->ToString().c_str(), packet.port); + srcEndpointID=p2p.id; + } + }catch(out_of_range& ex){} + } }else{ IPv6Address *src6=dynamic_cast(packet.address); if(src6){ @@ -1668,16 +1737,20 @@ bool VoIPController::WasOutgoingPacketAcknowledged(uint32_t seq){ } void VoIPController::ProcessIncomingPacket(NetworkPacket &packet, Endpoint& srcEndpoint){ - unsigned char* buffer=packet.data; + unsigned char *buffer=packet.data; size_t len=packet.length; - BufferInputStream in(buffer, (size_t)len); - if(memcmp(buffer, srcEndpoint.type==Endpoint::Type::UDP_RELAY || srcEndpoint.type==Endpoint::Type::TCP_RELAY ? (void*)srcEndpoint.peerTag : (void*)callID, 16)!=0){ - LOGW("Received packet has wrong peerTag"); - return; + BufferInputStream in(buffer, (size_t) len); + bool hasPeerTag=false; + if(peerVersion<9 || srcEndpoint.type==Endpoint::Type::UDP_RELAY || srcEndpoint.type==Endpoint::Type::TCP_RELAY){ + if(memcmp(buffer, srcEndpoint.type==Endpoint::Type::UDP_RELAY || srcEndpoint.type==Endpoint::Type::TCP_RELAY ? (void *) srcEndpoint.peerTag : (void *) callID, 16)!=0){ + LOGW("Received packet has wrong peerTag"); + return; + } + in.Seek(16); + hasPeerTag=true; } - in.Seek(16); if(in.Remaining()>=16 && (srcEndpoint.type==Endpoint::Type::UDP_RELAY || srcEndpoint.type==Endpoint::Type::TCP_RELAY) - && *reinterpret_cast(buffer+16)==0xFFFFFFFFFFFFFFFFLL && *reinterpret_cast(buffer+24)==0xFFFFFFFF){ + && *reinterpret_cast(buffer+16)==0xFFFFFFFFFFFFFFFFLL && *reinterpret_cast(buffer+24)==0xFFFFFFFF){ // relay special request response in.Seek(16+12); uint32_t tlid=(uint32_t) in.ReadInt32(); @@ -1690,7 +1763,7 @@ void VoIPController::ProcessIncomingPacket(NetworkPacket &packet, Endpoint& srcE in.ReadBytes(myIP, 16); int32_t myPort=in.ReadInt32(); //udpConnectivityState=UDP_AVAILABLE; - LOGV("Received UDP ping reply from %s:%d: date=%d, queryID=%ld, my IP=%s, my port=%d", srcEndpoint.address.ToString().c_str(), srcEndpoint.port, date, (long int)queryID, IPv4Address(*reinterpret_cast(myIP+12)).ToString().c_str(), myPort); + LOGV("Received UDP ping reply from %s:%d: date=%d, queryID=%ld, my IP=%s, my port=%d", srcEndpoint.address.ToString().c_str(), srcEndpoint.port, date, (long int) queryID, IPv4Address(*reinterpret_cast(myIP+12)).ToString().c_str(), myPort); srcEndpoint.udpPongCount++; if(srcEndpoint.IsIPv6Only() && !didSendIPv6Endpoint){ IPv6Address realAddr(myIP); @@ -1709,15 +1782,15 @@ void VoIPController::ProcessIncomingPacket(NetworkPacket &packet, Endpoint& srcE } } }else if(tlid==TLID_UDP_REFLECTOR_PEER_INFO){ - if(waitingForRelayPeerInfo && in.Remaining()>=16){ + if(in.Remaining()>=16){ MutexGuard _m(endpointsMutex); uint32_t myAddr=(uint32_t) in.ReadInt32(); uint32_t myPort=(uint32_t) in.ReadInt32(); uint32_t peerAddr=(uint32_t) in.ReadInt32(); uint32_t peerPort=(uint32_t) in.ReadInt32(); - constexpr int64_t p2pID=(int64_t)(FOURCC('P','2','P','4')) << 32; - constexpr int64_t lanID=(int64_t)(FOURCC('L','A','N','4')) << 32; + constexpr int64_t p2pID=(int64_t) (FOURCC('P', '2', 'P', '4')) << 32; + constexpr int64_t lanID=(int64_t) (FOURCC('L', 'A', 'N', '4')) << 32; if(currentEndpoint==p2pID || currentEndpoint==lanID) currentEndpoint=preferredRelay; @@ -1727,25 +1800,27 @@ void VoIPController::ProcessIncomingPacket(NetworkPacket &packet, Endpoint& srcE IPv4Address _peerAddr(peerAddr); IPv6Address emptyV6(string("::0")); unsigned char peerTag[16]; - Endpoint p2p(p2pID, (uint16_t) peerPort, _peerAddr, emptyV6, Endpoint::Type::UDP_P2P_INET, peerTag); - endpoints[p2pID]=p2p; LOGW("Received reflector peer info, my=%s:%u, peer=%s:%u", IPv4Address(myAddr).ToString().c_str(), myPort, IPv4Address(peerAddr).ToString().c_str(), peerPort); - if(myAddr==peerAddr){ - LOGW("Detected LAN"); - IPv4Address lanAddr(0); - udpSocket->GetLocalInterfaceInfo(&lanAddr, NULL); + if(waitingForRelayPeerInfo){ + Endpoint p2p(p2pID, (uint16_t) peerPort, _peerAddr, emptyV6, Endpoint::Type::UDP_P2P_INET, peerTag); + endpoints[p2pID]=p2p; + if(myAddr==peerAddr){ + LOGW("Detected LAN"); + IPv4Address lanAddr(0); + udpSocket->GetLocalInterfaceInfo(&lanAddr, NULL); - BufferOutputStream pkt(8); - pkt.WriteInt32(lanAddr.GetAddress()); - pkt.WriteInt32(udpSocket->GetLocalPort()); - if(peerVersion<6){ - SendPacketReliably(PKT_LAN_ENDPOINT, pkt.GetBuffer(), pkt.GetLength(), 0.5, 10); - }else{ - Buffer buf(move(pkt)); - SendExtra(buf, EXTRA_TYPE_LAN_ENDPOINT); + BufferOutputStream pkt(8); + pkt.WriteInt32(lanAddr.GetAddress()); + pkt.WriteInt32(udpSocket->GetLocalPort()); + if(peerVersion<6){ + SendPacketReliably(PKT_LAN_ENDPOINT, pkt.GetBuffer(), pkt.GetLength(), 0.5, 10); + }else{ + Buffer buf(move(pkt)); + SendExtra(buf, EXTRA_TYPE_LAN_ENDPOINT); + } } + waitingForRelayPeerInfo=false; } - waitingForRelayPeerInfo=false; } }else{ LOGV("Received relay response with unknown tl id: 0x%08X", tlid); @@ -1775,7 +1850,7 @@ void VoIPController::ProcessIncomingPacket(NetworkPacket &packet, Endpoint& srcE unsigned char sha[SHA1_LENGTH]; uint32_t _len=(uint32_t) _in.ReadInt32(); if(_len>_in.Remaining()) - _len=(uint32_t)_in.Remaining(); + _len=(uint32_t) _in.Remaining(); crypto.sha1((uint8_t *) (aesOut), (size_t) (_len+4), sha); if(memcmp(msgHash, sha+(SHA1_LENGTH-16), 16)!=0){ LOGW("Received packet has wrong hash after decryption"); @@ -1790,7 +1865,8 @@ void VoIPController::ProcessIncomingPacket(NetworkPacket &packet, Endpoint& srcE } if(useMTProto2 || retryWith2){ - in.Seek(16); // peer tag + if(hasPeerTag) + in.Seek(16); // peer tag unsigned char fingerprint[8], msgKey[16]; if(!shortFormat){ @@ -1833,11 +1909,11 @@ void VoIPController::ProcessIncomingPacket(NetworkPacket &packet, Endpoint& srcE innerLen=(uint32_t) (shortFormat ? in.ReadInt16() : in.ReadInt32()); if(innerLen>decryptedLen-sizeSize){ - LOGW("Received packet has wrong inner length (%d with total of %u)", (int)innerLen, (unsigned int)decryptedLen); + LOGW("Received packet has wrong inner length (%d with total of %u)", (int) innerLen, (unsigned int) decryptedLen); return; } if(decryptedLen-innerLen<(shortFormat ? 16 : 12)){ - LOGW("Received packet has too little padding (%u)", (unsigned int)(decryptedLen-innerLen)); + LOGW("Received packet has too little padding (%u)", (unsigned int) (decryptedLen-innerLen)); return; } memcpy(buffer, decrypted+(shortFormat ? 2 : 4), innerLen); @@ -1855,6 +1931,17 @@ void VoIPController::ProcessIncomingPacket(NetworkPacket &packet, Endpoint& srcE SetState(STATE_ESTABLISHED); } + if(srcEndpoint.type==Endpoint::Type::UDP_P2P_INET && !srcEndpoint.IsIPv6Only()){ + if(srcEndpoint.port!=packet.port || srcEndpoint.address!=*packet.address){ + IPv4Address *v4=dynamic_cast(packet.address); + if(v4){ + LOGI("Incoming packet was decrypted successfully, changing P2P endpoint to %s:%u", packet.address->ToString().c_str(), packet.port); + srcEndpoint.address=*v4; + srcEndpoint.port=packet.port; + } + } + } + /*decryptedAudioBlock random_id:long random_bytes:string flags:# voice_call_id:flags.2?int128 in_seq_no:flags.4?int out_seq_no:flags.4?int * recent_received_mask:flags.5?int proto:flags.3?int extra:flags.1?string raw_data:flags.0?string = DecryptedAudioBlock simpleAudioBlock random_id:long random_bytes:string raw_data:string = DecryptedAudioBlock; @@ -2556,6 +2643,7 @@ void VoIPController::ProcessExtraData(Buffer &data){ endpoints[lanID]=lan; }else if(type==EXTRA_TYPE_NETWORK_CHANGED){ LOGI("Peer network changed"); + wasNetworkHandover=true; const Endpoint& _currentEndpoint=endpoints.at(currentEndpoint); if(_currentEndpoint.type!=Endpoint::Type::UDP_RELAY && _currentEndpoint.type!=Endpoint::Type::TCP_RELAY) currentEndpoint=preferredRelay; @@ -2695,7 +2783,7 @@ void VoIPController::SendPacket(unsigned char *data, size_t len, Endpoint& ep, P BufferOutputStream out(len+128); if(ep.type==Endpoint::Type::UDP_RELAY || ep.type==Endpoint::Type::TCP_RELAY) out.WriteBytes((unsigned char*)ep.peerTag, 16); - else + else if(peerVersion<9) out.WriteBytes(callID, 16); if(len>0){ if(useMTProto2){ @@ -3502,6 +3590,7 @@ void VoIPController::UpdateCongestion(){ LOGW("Enabling extra EC"); if(needRateFlags & NEED_RATE_FLAG_SHITTY_INTERNET_MODE) needRate=true; + wasExtraEC=true; } } @@ -3541,6 +3630,8 @@ void VoIPController::UpdateCongestion(){ encoder->SetSecondaryEncoderEnabled(false); LOGW("Disabling extra EC"); } + if(!wasEncoderLaggy && encoder->GetComplexity()<10) + wasEncoderLaggy=true; } } @@ -3570,6 +3661,7 @@ void VoIPController::UpdateAudioBitrate(){ SetState(STATE_RECONNECTING); if(needRateFlags & NEED_RATE_FLAG_RECONNECTING) needRate=true; + wasReconnecting=true; ResetUdpAvailability(); } diff --git a/VoIPController.h b/VoIPController.h index 2fcb497..a17b555 100755 --- a/VoIPController.h +++ b/VoIPController.h @@ -751,7 +751,13 @@ namespace tgvoip{ std::vector sentVideoFrames; Mutex sentVideoFramesMutex; bool videoKeyframeRequested=false; - + + /*** debug report problems ***/ + bool wasReconnecting=false; + bool wasExtraEC=false; + bool wasEncoderLaggy=false; + bool wasNetworkHandover=false; + /*** persistable state values ***/ bool proxySupportsUDP=true; bool proxySupportsTCP=true; diff --git a/aclocal.m4 b/aclocal.m4 index 5e9a876..897cabf 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -22,7 +22,7 @@ To do so, use the procedure documented by the package, typically 'autoreconf'.]) # libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- # -# Copyright (C) 1996-2001, 2003-2015 Free Software Foundation, Inc. +# Copyright (C) 1996-2001, 2003-2018 Free Software Foundation, Inc. # Written by Gordon Matzigkeit, 1996 # # This file is free software; the Free Software Foundation gives @@ -241,8 +241,8 @@ esac ofile=libtool can_build_shared=yes -# All known linkers require a '.a' archive for static linking (except MSVC, -# which needs '.lib'). +# All known linkers require a '.a' archive for static linking (except MSVC and +# ICC, which need '.lib'). libext=a with_gnu_ld=$lt_cv_prog_gnu_ld @@ -1056,8 +1056,8 @@ int forced_loaded() { return 2;} _LT_EOF echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&AS_MESSAGE_LOG_FD $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&AS_MESSAGE_LOG_FD - echo "$AR cru libconftest.a conftest.o" >&AS_MESSAGE_LOG_FD - $AR cru libconftest.a conftest.o 2>&AS_MESSAGE_LOG_FD + echo "$AR $AR_FLAGS libconftest.a conftest.o" >&AS_MESSAGE_LOG_FD + $AR $AR_FLAGS libconftest.a conftest.o 2>&AS_MESSAGE_LOG_FD echo "$RANLIB libconftest.a" >&AS_MESSAGE_LOG_FD $RANLIB libconftest.a 2>&AS_MESSAGE_LOG_FD cat > conftest.c << _LT_EOF @@ -1507,9 +1507,22 @@ need_locks=$enable_libtool_lock m4_defun([_LT_PROG_AR], [AC_CHECK_TOOLS(AR, [ar], false) : ${AR=ar} -: ${AR_FLAGS=cru} _LT_DECL([], [AR], [1], [The archiver]) -_LT_DECL([], [AR_FLAGS], [1], [Flags to create an archive]) + +# Use ARFLAGS variable as AR's operation code to sync the variable naming with +# Automake. If both AR_FLAGS and ARFLAGS are specified, AR_FLAGS should have +# higher priority because thats what people were doing historically (setting +# ARFLAGS for automake and AR_FLAGS for libtool). FIXME: Make the AR_FLAGS +# variable obsoleted/removed. + +test ${AR_FLAGS+y} || AR_FLAGS=${ARFLAGS-cr} +lt_ar_flags=$AR_FLAGS +_LT_DECL([], [lt_ar_flags], [0], [Flags to create an archive (by configure)]) + +# Make AR_FLAGS overridable by 'make ARFLAGS='. Don't try to run-time override +# by AR_FLAGS because that was never working and AR_FLAGS is about to die. +_LT_DECL([], [AR_FLAGS], [\@S|@{ARFLAGS-"\@S|@lt_ar_flags"}], + [Flags to create an archive]) AC_CACHE_CHECK([for archiver @FILE support], [lt_cv_ar_at_file], [lt_cv_ar_at_file=no @@ -2221,26 +2234,35 @@ m4_defun([_LT_CMD_STRIPLIB], striplib= old_striplib= AC_MSG_CHECKING([whether stripping libraries is possible]) -if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then - test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" - test -z "$striplib" && striplib="$STRIP --strip-unneeded" - AC_MSG_RESULT([yes]) +if test -z "$STRIP"; then + AC_MSG_RESULT([no]) else -# FIXME - insert some real tests, host_os isn't really good enough - case $host_os in - darwin*) - if test -n "$STRIP"; then + if $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then + old_striplib="$STRIP --strip-debug" + striplib="$STRIP --strip-unneeded" + AC_MSG_RESULT([yes]) + else + case $host_os in + darwin*) + # FIXME - insert some real tests, host_os isn't really good enough striplib="$STRIP -x" old_striplib="$STRIP -S" AC_MSG_RESULT([yes]) - else + ;; + freebsd*) + if $STRIP -V 2>&1 | $GREP "elftoolchain" >/dev/null; then + old_striplib="$STRIP --strip-debug" + striplib="$STRIP --strip-unneeded" + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + fi + ;; + *) AC_MSG_RESULT([no]) - fi - ;; - *) - AC_MSG_RESULT([no]) - ;; - esac + ;; + esac + fi fi _LT_DECL([], [old_striplib], [1], [Commands to strip libraries]) _LT_DECL([], [striplib], [1]) @@ -2579,8 +2601,8 @@ m4_if([$1], [],[ dynamic_linker='Win32 ld.exe' ;; - *,cl*) - # Native MSVC + *,cl* | *,icl*) + # Native MSVC or ICC libname_spec='$name' soname_spec='$libname`echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext' library_names_spec='$libname.dll.lib' @@ -2636,7 +2658,7 @@ m4_if([$1], [],[ ;; *) - # Assume MSVC wrapper + # Assume MSVC and ICC wrapper library_names_spec='$libname`echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext $libname.lib' dynamic_linker='Win32 ld.exe' ;; @@ -4024,7 +4046,7 @@ for ac_symprfx in "" "_"; do if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Fake it for dumpbin and say T for any non-static function, # D for any global variable and I for any imported variable. - # Also find C++ and __fastcall symbols from MSVC++, + # Also find C++ and __fastcall symbols from MSVC++ or ICC, # which start with @ or ?. lt_cv_sys_global_symbol_pipe="$AWK ['"\ " {last_section=section; section=\$ 3};"\ @@ -4933,7 +4955,7 @@ m4_if([$1], [CXX], [ if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols' else - _LT_TAGVAR(export_symbols_cmds, $1)='`func_echo_all $NM | $SED -e '\''s/B\([[^B]]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && ([substr](\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols' + _LT_TAGVAR(export_symbols_cmds, $1)='`func_echo_all $NM | $SED -e '\''s/B\([[^B]]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "L") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && ([substr](\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols' fi ;; pw32*) @@ -4941,7 +4963,7 @@ m4_if([$1], [CXX], [ ;; cygwin* | mingw* | cegcc*) case $cc_basename in - cl*) + cl* | icl*) _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' ;; *) @@ -4998,15 +5020,15 @@ dnl Note also adjust exclude_expsyms for C++ above. case $host_os in cygwin* | mingw* | pw32* | cegcc*) - # FIXME: the MSVC++ port hasn't been tested in a loooong time + # FIXME: the MSVC++ and ICC port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. + # Microsoft Visual C++ or Intel C++ Compiler. if test yes != "$GCC"; then with_gnu_ld=no fi ;; interix*) - # we just hope/assume this is gcc and not c89 (= MSVC++) + # we just hope/assume this is gcc and not c89 (= MSVC++ or ICC) with_gnu_ld=yes ;; openbsd* | bitrig*) @@ -5170,6 +5192,7 @@ _LT_EOF emximp -o $lib $output_objdir/$libname.def' _LT_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + _LT_TAGVAR(file_list_spec, $1)='@' ;; interix[[3-9]]*) @@ -5387,7 +5410,7 @@ _LT_EOF if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols' else - _LT_TAGVAR(export_symbols_cmds, $1)='`func_echo_all $NM | $SED -e '\''s/B\([[^B]]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && ([substr](\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols' + _LT_TAGVAR(export_symbols_cmds, $1)='`func_echo_all $NM | $SED -e '\''s/B\([[^B]]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "L") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && ([substr](\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no @@ -5570,12 +5593,12 @@ _LT_EOF cygwin* | mingw* | pw32* | cegcc*) # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. + # Microsoft Visual C++ or Intel C++ Compiler. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. case $cc_basename in - cl*) - # Native MSVC + cl* | icl*) + # Native MSVC or ICC _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=yes @@ -5616,7 +5639,7 @@ _LT_EOF fi' ;; *) - # Assume MSVC wrapper + # Assume MSVC and ICC wrapper _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Tell ltmain to make .lib files, not .a files. @@ -5875,6 +5898,7 @@ _LT_EOF emximp -o $lib $output_objdir/$libname.def' _LT_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + _LT_TAGVAR(file_list_spec, $1)='@' ;; osf3*) @@ -6641,8 +6665,8 @@ if test yes != "$_lt_caught_CXX_error"; then cygwin* | mingw* | pw32* | cegcc*) case $GXX,$cc_basename in - ,cl* | no,cl*) - # Native MSVC + ,cl* | no,cl* | ,icl* | no,icl*) + # Native MSVC or ICC # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' @@ -6740,6 +6764,7 @@ if test yes != "$_lt_caught_CXX_error"; then emximp -o $lib $output_objdir/$libname.def' _LT_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + _LT_TAGVAR(file_list_spec, $1)='@' ;; dgux*) @@ -8370,7 +8395,7 @@ _LT_DECL([to_tool_file_cmd], [lt_cv_to_tool_file_cmd], # Helper functions for option handling. -*- Autoconf -*- # -# Copyright (C) 2004-2005, 2007-2009, 2011-2015 Free Software +# Copyright (C) 2004-2005, 2007-2009, 2011-2018 Free Software # Foundation, Inc. # Written by Gary V. Vaughan, 2004 # @@ -8802,7 +8827,7 @@ LT_OPTION_DEFINE([LTDL_INIT], [convenience], # ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*- # -# Copyright (C) 2004-2005, 2007-2008, 2011-2015 Free Software +# Copyright (C) 2004-2005, 2007-2008, 2011-2018 Free Software # Foundation, Inc. # Written by Gary V. Vaughan, 2004 # @@ -8927,7 +8952,7 @@ m4_define([lt_dict_filter], # ltversion.m4 -- version numbers -*- Autoconf -*- # -# Copyright (C) 2004, 2011-2015 Free Software Foundation, Inc. +# Copyright (C) 2004, 2011-2018 Free Software Foundation, Inc. # Written by Scott James Remnant, 2004 # # This file is free software; the Free Software Foundation gives @@ -8936,22 +8961,22 @@ m4_define([lt_dict_filter], # @configure_input@ -# serial 4179 ltversion.m4 +# serial 4221 ltversion.m4 # This file is part of GNU Libtool -m4_define([LT_PACKAGE_VERSION], [2.4.6]) -m4_define([LT_PACKAGE_REVISION], [2.4.6]) +m4_define([LT_PACKAGE_VERSION], [2.4.6.42-b88ce]) +m4_define([LT_PACKAGE_REVISION], [2.4.6.42]) AC_DEFUN([LTVERSION_VERSION], -[macro_version='2.4.6' -macro_revision='2.4.6' +[macro_version='2.4.6.42-b88ce' +macro_revision='2.4.6.42' _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) _LT_DECL(, macro_revision, 0) ]) # lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*- # -# Copyright (C) 2004-2005, 2007, 2009, 2011-2015 Free Software +# Copyright (C) 2004-2005, 2007, 2009, 2011-2018 Free Software # Foundation, Inc. # Written by Scott James Remnant, 2004. # diff --git a/configure b/configure index e6582a1..719376e 100755 --- a/configure +++ b/configure @@ -3270,8 +3270,8 @@ esac -macro_version='2.4.6' -macro_revision='2.4.6' +macro_version='2.4.6.42-b88ce' +macro_revision='2.4.6.42' @@ -5973,13 +5973,29 @@ esac fi : ${AR=ar} -: ${AR_FLAGS=cru} +# Use ARFLAGS variable as AR's operation code to sync the variable naming with +# Automake. If both AR_FLAGS and ARFLAGS are specified, AR_FLAGS should have +# higher priority because thats what people were doing historically (setting +# ARFLAGS for automake and AR_FLAGS for libtool). FIXME: Make the AR_FLAGS +# variable obsoleted/removed. + +test ${AR_FLAGS+y} || AR_FLAGS=${ARFLAGS-cr} +lt_ar_flags=$AR_FLAGS + + + + + + +# Make AR_FLAGS overridable by 'make ARFLAGS='. Don't try to run-time override +# by AR_FLAGS because that was never working and AR_FLAGS is about to die. + @@ -6428,7 +6444,7 @@ for ac_symprfx in "" "_"; do if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Fake it for dumpbin and say T for any non-static function, # D for any global variable and I for any imported variable. - # Also find C++ and __fastcall symbols from MSVC++, + # Also find C++ and __fastcall symbols from MSVC++ or ICC, # which start with @ or ?. lt_cv_sys_global_symbol_pipe="$AWK '"\ " {last_section=section; section=\$ 3};"\ @@ -7697,8 +7713,8 @@ int forced_loaded() { return 2;} _LT_EOF echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&5 $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5 - echo "$AR cru libconftest.a conftest.o" >&5 - $AR cru libconftest.a conftest.o 2>&5 + echo "$AR $AR_FLAGS libconftest.a conftest.o" >&5 + $AR $AR_FLAGS libconftest.a conftest.o 2>&5 echo "$RANLIB libconftest.a" >&5 $RANLIB libconftest.a 2>&5 cat > conftest.c << _LT_EOF @@ -8361,8 +8377,8 @@ esac ofile=libtool can_build_shared=yes -# All known linkers require a '.a' archive for static linking (except MSVC, -# which needs '.lib'). +# All known linkers require a '.a' archive for static linking (except MSVC and +# ICC, which need '.lib'). libext=a with_gnu_ld=$lt_cv_prog_gnu_ld @@ -9285,15 +9301,15 @@ $as_echo_n "checking whether the $compiler linker ($LD) supports shared librarie case $host_os in cygwin* | mingw* | pw32* | cegcc*) - # FIXME: the MSVC++ port hasn't been tested in a loooong time + # FIXME: the MSVC++ and ICC port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. + # Microsoft Visual C++ or Intel C++ Compiler. if test yes != "$GCC"; then with_gnu_ld=no fi ;; interix*) - # we just hope/assume this is gcc and not c89 (= MSVC++) + # we just hope/assume this is gcc and not c89 (= MSVC++ or ICC) with_gnu_ld=yes ;; openbsd* | bitrig*) @@ -9457,6 +9473,7 @@ _LT_EOF emximp -o $lib $output_objdir/$libname.def' old_archive_From_new_cmds='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' enable_shared_with_static_runtimes=yes + file_list_spec='@' ;; interix[3-9]*) @@ -9674,7 +9691,7 @@ _LT_EOF if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols' else - export_symbols_cmds='`func_echo_all $NM | $SED -e '\''s/B\([^B]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && (substr(\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols' + export_symbols_cmds='`func_echo_all $NM | $SED -e '\''s/B\([^B]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "L") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && (substr(\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no @@ -9941,12 +9958,12 @@ fi cygwin* | mingw* | pw32* | cegcc*) # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. + # Microsoft Visual C++ or Intel C++ Compiler. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. case $cc_basename in - cl*) - # Native MSVC + cl* | icl*) + # Native MSVC or ICC hardcode_libdir_flag_spec=' ' allow_undefined_flag=unsupported always_export_symbols=yes @@ -9987,7 +10004,7 @@ fi fi' ;; *) - # Assume MSVC wrapper + # Assume MSVC and ICC wrapper hardcode_libdir_flag_spec=' ' allow_undefined_flag=unsupported # Tell ltmain to make .lib files, not .a files. @@ -10311,6 +10328,7 @@ $as_echo "$lt_cv_irix_exported_symbol" >&6; } emximp -o $lib $output_objdir/$libname.def' old_archive_From_new_cmds='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' enable_shared_with_static_runtimes=yes + file_list_spec='@' ;; osf3*) @@ -11018,8 +11036,8 @@ cygwin* | mingw* | pw32* | cegcc*) dynamic_linker='Win32 ld.exe' ;; - *,cl*) - # Native MSVC + *,cl* | *,icl*) + # Native MSVC or ICC libname_spec='$name' soname_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' library_names_spec='$libname.dll.lib' @@ -11075,7 +11093,7 @@ cygwin* | mingw* | pw32* | cegcc*) ;; *) - # Assume MSVC wrapper + # Assume MSVC and ICC wrapper library_names_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext $libname.lib' dynamic_linker='Win32 ld.exe' ;; @@ -12254,30 +12272,41 @@ striplib= old_striplib= { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5 $as_echo_n "checking whether stripping libraries is possible... " >&6; } -if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then - test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" - test -z "$striplib" && striplib="$STRIP --strip-unneeded" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } +if test -z "$STRIP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } else -# FIXME - insert some real tests, host_os isn't really good enough - case $host_os in - darwin*) - if test -n "$STRIP"; then + if $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then + old_striplib="$STRIP --strip-debug" + striplib="$STRIP --strip-unneeded" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + else + case $host_os in + darwin*) + # FIXME - insert some real tests, host_os isn't really good enough striplib="$STRIP -x" old_striplib="$STRIP -S" { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } - else + ;; + freebsd*) + if $STRIP -V 2>&1 | $GREP "elftoolchain" >/dev/null; then + old_striplib="$STRIP --strip-debug" + striplib="$STRIP --strip-unneeded" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + fi + ;; + *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } - fi - ;; - *) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - ;; - esac + ;; + esac + fi fi @@ -13464,8 +13493,8 @@ fi cygwin* | mingw* | pw32* | cegcc*) case $GXX,$cc_basename in - ,cl* | no,cl*) - # Native MSVC + ,cl* | no,cl* | ,icl* | no,icl*) + # Native MSVC or ICC # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. hardcode_libdir_flag_spec_CXX=' ' @@ -13595,6 +13624,7 @@ fi emximp -o $lib $output_objdir/$libname.def' old_archive_From_new_cmds_CXX='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' enable_shared_with_static_runtimes_CXX=yes + file_list_spec_CXX='@' ;; dgux*) @@ -15030,7 +15060,7 @@ $as_echo_n "checking whether the $compiler linker ($LD) supports shared librarie if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then export_symbols_cmds_CXX='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols' else - export_symbols_cmds_CXX='`func_echo_all $NM | $SED -e '\''s/B\([^B]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && (substr(\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols' + export_symbols_cmds_CXX='`func_echo_all $NM | $SED -e '\''s/B\([^B]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "L") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && (substr(\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols' fi ;; pw32*) @@ -15038,7 +15068,7 @@ $as_echo_n "checking whether the $compiler linker ($LD) supports shared librarie ;; cygwin* | mingw* | cegcc*) case $cc_basename in - cl*) + cl* | icl*) exclude_expsyms_CXX='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' ;; *) @@ -15400,8 +15430,8 @@ cygwin* | mingw* | pw32* | cegcc*) dynamic_linker='Win32 ld.exe' ;; - *,cl*) - # Native MSVC + *,cl* | *,icl*) + # Native MSVC or ICC libname_spec='$name' soname_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' library_names_spec='$libname.dll.lib' @@ -15457,7 +15487,7 @@ cygwin* | mingw* | pw32* | cegcc*) ;; *) - # Assume MSVC wrapper + # Assume MSVC and ICC wrapper library_names_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext $libname.lib' dynamic_linker='Win32 ld.exe' ;; @@ -19370,6 +19400,7 @@ want_nocaseglob='`$ECHO "$want_nocaseglob" | $SED "$delay_single_quote_subst"`' DLLTOOL='`$ECHO "$DLLTOOL" | $SED "$delay_single_quote_subst"`' sharedlib_from_linklib_cmd='`$ECHO "$sharedlib_from_linklib_cmd" | $SED "$delay_single_quote_subst"`' AR='`$ECHO "$AR" | $SED "$delay_single_quote_subst"`' +lt_ar_flags='`$ECHO "$lt_ar_flags" | $SED "$delay_single_quote_subst"`' AR_FLAGS='`$ECHO "$AR_FLAGS" | $SED "$delay_single_quote_subst"`' archiver_list_spec='`$ECHO "$archiver_list_spec" | $SED "$delay_single_quote_subst"`' STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`' @@ -19552,7 +19583,6 @@ want_nocaseglob \ DLLTOOL \ sharedlib_from_linklib_cmd \ AR \ -AR_FLAGS \ archiver_list_spec \ STRIP \ RANLIB \ @@ -20561,8 +20591,11 @@ sharedlib_from_linklib_cmd=$lt_sharedlib_from_linklib_cmd # The archiver. AR=$lt_AR +# Flags to create an archive (by configure). +lt_ar_flags=$lt_ar_flags + # Flags to create an archive. -AR_FLAGS=$lt_AR_FLAGS +AR_FLAGS=\${ARFLAGS-"\$lt_ar_flags"} # How to feed a file listing to the archiver. archiver_list_spec=$lt_archiver_list_spec diff --git a/json11.cpp b/json11.cpp index a969859..812e610 100755 --- a/json11.cpp +++ b/json11.cpp @@ -58,9 +58,10 @@ static void dump(NullStruct, string &out) { static void dump(double value, string &out) { if (std::isfinite(value)) { - char buf[32]; - snprintf(buf, sizeof buf, "%.17g", value); - out += buf; + std::ostringstream stm; + stm.imbue(std::locale("C")); + stm << value; + out += stm.str(); } else { out += "null"; } diff --git a/ltmain.sh b/ltmain.sh index 0f0a2da..d3ab94d 100644 --- a/ltmain.sh +++ b/ltmain.sh @@ -1,12 +1,12 @@ #! /bin/sh ## DO NOT EDIT - This file generated from ./build-aux/ltmain.in -## by inline-source v2014-01-03.01 +## by inline-source v2018-07-24.06 -# libtool (GNU libtool) 2.4.6 +# libtool (GNU libtool) 2.4.6.42-b88ce # Provide generalized library-building support services. # Written by Gordon Matzigkeit , 1996 -# Copyright (C) 1996-2015 Free Software Foundation, Inc. +# Copyright (C) 1996-2018 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. @@ -31,8 +31,8 @@ PROGRAM=libtool PACKAGE=libtool -VERSION=2.4.6 -package_revision=2.4.6 +VERSION=2.4.6.42-b88ce +package_revision=2.4.6.42 ## ------ ## @@ -64,34 +64,25 @@ package_revision=2.4.6 # libraries, which are installed to $pkgauxdir. # Set a version string for this script. -scriptversion=2015-01-20.17; # UTC +scriptversion=2018-07-24.06; # UTC # General shell script boiler plate, and helper functions. # Written by Gary V. Vaughan, 2004 -# Copyright (C) 2004-2015 Free Software Foundation, Inc. -# This is free software; see the source for copying conditions. There is NO -# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# This is free software. There is NO warranty; not even for +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# +# Copyright (C) 2004-2018 Bootstrap Authors +# +# This file is dual licensed under the terms of the MIT license +# , and GPL version 3 or later +# . You must apply one of +# these licenses when using or redistributing this software or any of +# the files within it. See the URLs above, or the file `LICENSE` +# included in the Bootstrap distribution for the full license texts. -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. - -# As a special exception to the GNU General Public License, if you distribute -# this file as part of a program or library that is built using GNU Libtool, -# you may include this file under the same distribution terms that you use -# for the rest of that program. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNES FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -# Please report bugs or propose patches to gary@gnu.org. +# Please report bugs or propose patches to: +# ## ------ ## @@ -140,9 +131,6 @@ do fi" done -# CDPATH. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - # Make sure IFS has a sensible default sp=' ' nl=' @@ -159,6 +147,26 @@ if test "${PATH_SEPARATOR+set}" != set; then fi +# func_unset VAR +# -------------- +# Portably unset VAR. +# In some shells, an 'unset VAR' statement leaves a non-zero return +# status if VAR is already unset, which might be problematic if the +# statement is used at the end of a function (thus poisoning its return +# value) or when 'set -e' is active (causing even a spurious abort of +# the script in this case). +func_unset () +{ + { eval $1=; (eval unset $1) >/dev/null 2>&1 && eval unset $1 || : ; } +} + + +# Make sure CDPATH doesn't cause `cd` commands to output the target dir. +func_unset CDPATH + +# Make sure ${,E,F}GREP behave sanely. +func_unset GREP_OPTIONS + ## ------------------------- ## ## Locate command utilities. ## @@ -259,7 +267,7 @@ test -z "$SED" && { rm -f conftest.in conftest.tmp conftest.nl conftest.out } - func_path_progs "sed gsed" func_check_prog_sed $PATH:/usr/xpg4/bin + func_path_progs "sed gsed" func_check_prog_sed "$PATH:/usr/xpg4/bin" rm -f conftest.sed SED=$func_path_progs_result } @@ -295,7 +303,7 @@ test -z "$GREP" && { rm -f conftest.in conftest.tmp conftest.nl conftest.out } - func_path_progs "grep ggrep" func_check_prog_grep $PATH:/usr/xpg4/bin + func_path_progs "grep ggrep" func_check_prog_grep "$PATH:/usr/xpg4/bin" GREP=$func_path_progs_result } @@ -580,16 +588,16 @@ if test yes = "$_G_HAVE_PLUSEQ_OP"; then { $debug_cmd - func_quote_for_eval "$2" - eval "$1+=\\ \$func_quote_for_eval_result" + func_quote_arg pretty "$2" + eval "$1+=\\ \$func_quote_arg_result" }' else func_append_quoted () { $debug_cmd - func_quote_for_eval "$2" - eval "$1=\$$1\\ \$func_quote_for_eval_result" + func_quote_arg pretty "$2" + eval "$1=\$$1\\ \$func_quote_arg_result" } fi @@ -1091,85 +1099,199 @@ func_relative_path () } -# func_quote_for_eval ARG... -# -------------------------- -# Aesthetically quote ARGs to be evaled later. -# This function returns two values: -# i) func_quote_for_eval_result -# double-quoted, suitable for a subsequent eval -# ii) func_quote_for_eval_unquoted_result -# has all characters that are still active within double -# quotes backslashified. -func_quote_for_eval () +# func_quote_portable EVAL ARG +# ---------------------------- +# Internal function to portably implement func_quote_arg. Note that we still +# keep attention to performance here so we as much as possible try to avoid +# calling sed binary (so far O(N) complexity as long as func_append is O(1)). +func_quote_portable () { $debug_cmd - func_quote_for_eval_unquoted_result= - func_quote_for_eval_result= - while test 0 -lt $#; do - case $1 in + func_quote_portable_result=$2 + + # one-time-loop (easy break) + while true + do + if $1; then + func_quote_portable_result=`$ECHO "$2" | $SED \ + -e "$sed_double_quote_subst" -e "$sed_double_backslash"` + break + fi + + # Quote for eval. + case $func_quote_portable_result in *[\\\`\"\$]*) - _G_unquoted_arg=`printf '%s\n' "$1" |$SED "$sed_quote_subst"` ;; - *) - _G_unquoted_arg=$1 ;; - esac - if test -n "$func_quote_for_eval_unquoted_result"; then - func_append func_quote_for_eval_unquoted_result " $_G_unquoted_arg" - else - func_append func_quote_for_eval_unquoted_result "$_G_unquoted_arg" - fi + case $func_quote_portable_result in + *[\[\*\?]*) + func_quote_portable_result=`$ECHO "$func_quote_portable_result" \ + | $SED "$sed_quote_subst"` + break + ;; + esac - case $_G_unquoted_arg in - # Double-quote args containing shell metacharacters to delay - # word splitting, command substitution and variable expansion - # for a subsequent eval. - # Many Bourne shells cannot handle close brackets correctly - # in scan sets, so we specify it separately. - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - _G_quoted_arg=\"$_G_unquoted_arg\" + func_quote_portable_old_IFS=$IFS + for _G_char in '\' '`' '"' '$' + do + # STATE($1) PREV($2) SEPARATOR($3) + set start "" "" + func_quote_portable_result=dummy"$_G_char$func_quote_portable_result$_G_char"dummy + IFS=$_G_char + for _G_part in $func_quote_portable_result + do + case $1 in + quote) + func_append func_quote_portable_result "$3$2" + set quote "$_G_part" "\\$_G_char" + ;; + start) + set first "" "" + func_quote_portable_result= + ;; + first) + set quote "$_G_part" "" + ;; + esac + done + done + IFS=$func_quote_portable_old_IFS ;; - *) - _G_quoted_arg=$_G_unquoted_arg - ;; + *) ;; esac - - if test -n "$func_quote_for_eval_result"; then - func_append func_quote_for_eval_result " $_G_quoted_arg" - else - func_append func_quote_for_eval_result "$_G_quoted_arg" - fi - shift + break done + + func_quote_portable_unquoted_result=$func_quote_portable_result + case $func_quote_portable_result in + # double-quote args containing shell metacharacters to delay + # word splitting, command substitution and variable expansion + # for a subsequent eval. + # many bourne shells cannot handle close brackets correctly + # in scan sets, so we specify it separately. + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + func_quote_portable_result=\"$func_quote_portable_result\" + ;; + esac } -# func_quote_for_expand ARG -# ------------------------- -# Aesthetically quote ARG to be evaled later; same as above, -# but do not quote variable references. -func_quote_for_expand () +# func_quotefast_eval ARG +# ----------------------- +# Quote one ARG (internal). This is equivalent to 'func_quote_arg eval ARG', +# but optimized for speed. Result is stored in $func_quotefast_eval. +if test xyes = `(x=; printf -v x %q yes; echo x"$x") 2>/dev/null`; then + printf -v _GL_test_printf_tilde %q '~' + if test '\~' = "$_GL_test_printf_tilde"; then + func_quotefast_eval () + { + printf -v func_quotefast_eval_result %q "$1" + } + else + # Broken older Bash implementations. Make those faster too if possible. + func_quotefast_eval () + { + case $1 in + '~'*) + func_quote_portable false "$1" + func_quotefast_eval_result=$func_quote_portable_result + ;; + *) + printf -v func_quotefast_eval_result %q "$1" + ;; + esac + } + fi +else + func_quotefast_eval () + { + func_quote_portable false "$1" + func_quotefast_eval_result=$func_quote_portable_result + } +fi + + +# func_quote_arg MODEs ARG +# ------------------------ +# Quote one ARG to be evaled later. MODEs argument may contain zero or more +# specifiers listed below separated by ',' character. This function returns two +# values: +# i) func_quote_arg_result +# double-quoted (when needed), suitable for a subsequent eval +# ii) func_quote_arg_unquoted_result +# has all characters that are still active within double +# quotes backslashified. Available only if 'unquoted' is specified. +# +# Available modes: +# ---------------- +# 'eval' (default) +# - escape shell special characters +# 'expand' +# - the same as 'eval'; but do not quote variable references +# 'pretty' +# - request aesthetic output, i.e. '"a b"' instead of 'a\ b'. This might +# be used later in func_quote to get output like: 'echo "a b"' instead +# of 'echo a\ b'. This is slower than default on some shells. +# 'unquoted' +# - produce also $func_quote_arg_unquoted_result which does not contain +# wrapping double-quotes. +# +# Examples for 'func_quote_arg pretty,unquoted string': +# +# string | *_result | *_unquoted_result +# ------------+-----------------------+------------------- +# " | \" | \" +# a b | "a b" | a b +# "a b" | "\"a b\"" | \"a b\" +# * | "*" | * +# z="${x-$y}" | "z=\"\${x-\$y}\"" | z=\"\${x-\$y}\" +# +# Examples for 'func_quote_arg pretty,unquoted,expand string': +# +# string | *_result | *_unquoted_result +# --------------+---------------------+-------------------- +# z="${x-$y}" | "z=\"${x-$y}\"" | z=\"${x-$y}\" +func_quote_arg () { - $debug_cmd - - case $1 in - *[\\\`\"]*) - _G_arg=`$ECHO "$1" | $SED \ - -e "$sed_double_quote_subst" -e "$sed_double_backslash"` ;; - *) - _G_arg=$1 ;; - esac - - case $_G_arg in - # Double-quote args containing shell metacharacters to delay - # word splitting and command substitution for a subsequent eval. - # Many Bourne shells cannot handle close brackets correctly - # in scan sets, so we specify it separately. - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - _G_arg=\"$_G_arg\" + _G_quote_expand=false + case ,$1, in + *,expand,*) + _G_quote_expand=: ;; esac - func_quote_for_expand_result=$_G_arg + case ,$1, in + *,pretty,*|*,expand,*|*,unquoted,*) + func_quote_portable $_G_quote_expand "$2" + func_quote_arg_result=$func_quote_portable_result + func_quote_arg_unquoted_result=$func_quote_portable_unquoted_result + ;; + *) + # Faster quote-for-eval for some shells. + func_quotefast_eval "$2" + func_quote_arg_result=$func_quotefast_eval_result + ;; + esac +} + + +# func_quote MODEs ARGs... +# ------------------------ +# Quote all ARGs to be evaled later and join them into single command. See +# func_quote_arg's description for more info. +func_quote () +{ + $debug_cmd + _G_func_quote_mode=$1 ; shift + func_quote_result= + while test 0 -lt $#; do + func_quote_arg "$_G_func_quote_mode" "$1" + if test -n "$func_quote_result"; then + func_append func_quote_result " $func_quote_arg_result" + else + func_append func_quote_result "$func_quote_arg_result" + fi + shift + done } @@ -1215,8 +1337,8 @@ func_show_eval () _G_cmd=$1 _G_fail_exp=${2-':'} - func_quote_for_expand "$_G_cmd" - eval "func_notquiet $func_quote_for_expand_result" + func_quote_arg pretty,expand "$_G_cmd" + eval "func_notquiet $func_quote_arg_result" $opt_dry_run || { eval "$_G_cmd" @@ -1241,8 +1363,8 @@ func_show_eval_locale () _G_fail_exp=${2-':'} $opt_quiet || { - func_quote_for_expand "$_G_cmd" - eval "func_echo $func_quote_for_expand_result" + func_quote_arg expand,pretty "$_G_cmd" + eval "func_echo $func_quote_arg_result" } $opt_dry_run || { @@ -1369,30 +1491,26 @@ func_lt_ver () # End: #! /bin/sh -# Set a version string for this script. -scriptversion=2014-01-07.03; # UTC - # A portable, pluggable option parser for Bourne shell. # Written by Gary V. Vaughan, 2010 -# Copyright (C) 2010-2015 Free Software Foundation, Inc. -# This is free software; see the source for copying conditions. There is NO -# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# This is free software. There is NO warranty; not even for +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# +# Copyright (C) 2010-2018 Bootstrap Authors +# +# This file is dual licensed under the terms of the MIT license +# , and GPL version 3 or later +# . You must apply one of +# these licenses when using or redistributing this software or any of +# the files within it. See the URLs above, or the file `LICENSE` +# included in the Bootstrap distribution for the full license texts. -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. +# Please report bugs or propose patches to: +# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -# Please report bugs or propose patches to gary@gnu.org. +# Set a version string for this script. +scriptversion=2018-07-24.06; # UTC ## ------ ## @@ -1415,7 +1533,7 @@ scriptversion=2014-01-07.03; # UTC # # In order for the '--version' option to work, you will need to have a # suitably formatted comment like the one at the top of this file -# starting with '# Written by ' and ending with '# warranty; '. +# starting with '# Written by ' and ending with '# Copyright'. # # For '-h' and '--help' to work, you will also need a one line # description of your script's purpose in a comment directly above the @@ -1427,7 +1545,7 @@ scriptversion=2014-01-07.03; # UTC # to display verbose messages only when your user has specified # '--verbose'. # -# After sourcing this file, you can plug processing for additional +# After sourcing this file, you can plug in processing for additional # options by amending the variables from the 'Configuration' section # below, and following the instructions in the 'Option parsing' # section further down. @@ -1476,8 +1594,8 @@ fatal_help="Try '\$progname --help' for more information." ## ------------------------- ## # This section contains functions for adding, removing, and running hooks -# to the main code. A hook is just a named list of of function, that can -# be run in order later on. +# in the main code. A hook is just a list of function names that can be +# run in order later on. # func_hookable FUNC_NAME # ----------------------- @@ -1510,7 +1628,8 @@ func_add_hook () # func_remove_hook FUNC_NAME HOOK_FUNC # ------------------------------------ -# Remove HOOK_FUNC from the list of functions called by FUNC_NAME. +# Remove HOOK_FUNC from the list of hook functions to be called by +# FUNC_NAME. func_remove_hook () { $debug_cmd @@ -1519,10 +1638,28 @@ func_remove_hook () } +# func_propagate_result FUNC_NAME_A FUNC_NAME_B +# --------------------------------------------- +# If the *_result variable of FUNC_NAME_A _is set_, assign its value to +# *_result variable of FUNC_NAME_B. +func_propagate_result () +{ + $debug_cmd + + func_propagate_result_result=: + if eval "test \"\${${1}_result+set}\" = set" + then + eval "${2}_result=\$${1}_result" + else + func_propagate_result_result=false + fi +} + + # func_run_hooks FUNC_NAME [ARG]... # --------------------------------- # Run all hook functions registered to FUNC_NAME. -# It is assumed that the list of hook functions contains nothing more +# It's assumed that the list of hook functions contains nothing more # than a whitespace-delimited list of legal shell function names, and # no effort is wasted trying to catch shell meta-characters or preserve # whitespace. @@ -1532,22 +1669,19 @@ func_run_hooks () case " $hookable_fns " in *" $1 "*) ;; - *) func_fatal_error "'$1' does not support hook funcions.n" ;; + *) func_fatal_error "'$1' does not support hook functions." ;; esac eval _G_hook_fns=\$$1_hooks; shift for _G_hook in $_G_hook_fns; do - eval $_G_hook '"$@"' - - # store returned options list back into positional - # parameters for next 'cmd' execution. - eval _G_hook_result=\$${_G_hook}_result - eval set dummy "$_G_hook_result"; shift + func_unset "${_G_hook}_result" + eval $_G_hook '${1+"$@"}' + func_propagate_result $_G_hook func_run_hooks + if $func_propagate_result_result; then + eval set dummy "$func_run_hooks_result"; shift + fi done - - func_quote_for_eval ${1+"$@"} - func_run_hooks_result=$func_quote_for_eval_result } @@ -1557,10 +1691,18 @@ func_run_hooks () ## --------------- ## # In order to add your own option parsing hooks, you must accept the -# full positional parameter list in your hook function, remove any -# options that you action, and then pass back the remaining unprocessed -# options in '_result', escaped suitably for -# 'eval'. Like this: +# full positional parameter list from your hook function. You may remove +# or edit any options that you action, and then pass back the remaining +# unprocessed options in '_result', escaped +# suitably for 'eval'. +# +# The '_result' variable is automatically unset +# before your hook gets called; for best performance, only set the +# *_result variable when necessary (i.e. don't call the 'func_quote' +# function unnecessarily because it can be an expensive operation on some +# machines). +# +# Like this: # # my_options_prep () # { @@ -1570,9 +1712,8 @@ func_run_hooks () # usage_message=$usage_message' # -s, --silent don'\''t print informational messages # ' -# -# func_quote_for_eval ${1+"$@"} -# my_options_prep_result=$func_quote_for_eval_result +# # No change in '$@' (ignored completely by this hook). Leave +# # my_options_prep_result variable intact. # } # func_add_hook func_options_prep my_options_prep # @@ -1581,25 +1722,36 @@ func_run_hooks () # { # $debug_cmd # -# # Note that for efficiency, we parse as many options as we can +# args_changed=false +# +# # Note that, for efficiency, we parse as many options as we can # # recognise in a loop before passing the remainder back to the # # caller on the first unrecognised argument we encounter. # while test $# -gt 0; do # opt=$1; shift # case $opt in -# --silent|-s) opt_silent=: ;; +# --silent|-s) opt_silent=: +# args_changed=: +# ;; # # Separate non-argument short options: # -s*) func_split_short_opt "$_G_opt" # set dummy "$func_split_short_opt_name" \ # "-$func_split_short_opt_arg" ${1+"$@"} # shift +# args_changed=: # ;; -# *) set dummy "$_G_opt" "$*"; shift; break ;; +# *) # Make sure the first unrecognised option "$_G_opt" +# # is added back to "$@" in case we need it later, +# # if $args_changed was set to 'true'. +# set dummy "$_G_opt" ${1+"$@"}; shift; break ;; # esac # done # -# func_quote_for_eval ${1+"$@"} -# my_silent_option_result=$func_quote_for_eval_result +# # Only call 'func_quote' here if we processed at least one argument. +# if $args_changed; then +# func_quote eval ${1+"$@"} +# my_silent_option_result=$func_quote_result +# fi # } # func_add_hook func_parse_options my_silent_option # @@ -1610,17 +1762,26 @@ func_run_hooks () # # $opt_silent && $opt_verbose && func_fatal_help "\ # '--silent' and '--verbose' options are mutually exclusive." -# -# func_quote_for_eval ${1+"$@"} -# my_option_validation_result=$func_quote_for_eval_result # } # func_add_hook func_validate_options my_option_validation # -# You'll alse need to manually amend $usage_message to reflect the extra +# You'll also need to manually amend $usage_message to reflect the extra # options you parse. It's preferable to append if you can, so that # multiple option parsing hooks can be added safely. +# func_options_finish [ARG]... +# ---------------------------- +# Finishing the option parse loop (call 'func_options' hooks ATM). +func_options_finish () +{ + $debug_cmd + + func_run_hooks func_options ${1+"$@"} + func_propagate_result func_run_hooks func_options_finish +} + + # func_options [ARG]... # --------------------- # All the functions called inside func_options are hookable. See the @@ -1630,17 +1791,27 @@ func_options () { $debug_cmd - func_options_prep ${1+"$@"} - eval func_parse_options \ - ${func_options_prep_result+"$func_options_prep_result"} - eval func_validate_options \ - ${func_parse_options_result+"$func_parse_options_result"} + _G_options_quoted=false - eval func_run_hooks func_options \ - ${func_validate_options_result+"$func_validate_options_result"} + for my_func in options_prep parse_options validate_options options_finish + do + func_unset func_${my_func}_result + func_unset func_run_hooks_result + eval func_$my_func '${1+"$@"}' + func_propagate_result func_$my_func func_options + if $func_propagate_result_result; then + eval set dummy "$func_options_result"; shift + _G_options_quoted=: + fi + done - # save modified positional parameters for caller - func_options_result=$func_run_hooks_result + $_G_options_quoted || { + # As we (func_options) are top-level options-parser function and + # nobody quoted "$@" for us yet, we need to do it explicitly for + # caller. + func_quote eval ${1+"$@"} + func_options_result=$func_quote_result + } } @@ -1649,9 +1820,8 @@ func_options () # All initialisations required before starting the option parse loop. # Note that when calling hook functions, we pass through the list of # positional parameters. If a hook function modifies that list, and -# needs to propogate that back to rest of this script, then the complete -# modified list must be put in 'func_run_hooks_result' before -# returning. +# needs to propagate that back to rest of this script, then the complete +# modified list must be put in 'func_run_hooks_result' before returning. func_hookable func_options_prep func_options_prep () { @@ -1662,9 +1832,7 @@ func_options_prep () opt_warning_types= func_run_hooks func_options_prep ${1+"$@"} - - # save modified positional parameters for caller - func_options_prep_result=$func_run_hooks_result + func_propagate_result func_run_hooks func_options_prep } @@ -1676,25 +1844,32 @@ func_parse_options () { $debug_cmd - func_parse_options_result= - + _G_parse_options_requote=false # this just eases exit handling while test $# -gt 0; do # Defer to hook functions for initial option parsing, so they # get priority in the event of reusing an option name. func_run_hooks func_parse_options ${1+"$@"} - - # Adjust func_parse_options positional parameters to match - eval set dummy "$func_run_hooks_result"; shift + func_propagate_result func_run_hooks func_parse_options + if $func_propagate_result_result; then + eval set dummy "$func_parse_options_result"; shift + # Even though we may have changed "$@", we passed the "$@" array + # down into the hook and it quoted it for us (because we are in + # this if-branch). No need to quote it again. + _G_parse_options_requote=false + fi # Break out of the loop if we already parsed every option. test $# -gt 0 || break + # We expect that one of the options parsed in this function matches + # and thus we remove _G_opt from "$@" and need to re-quote. + _G_match_parse_options=: _G_opt=$1 shift case $_G_opt in --debug|-x) debug_cmd='set -x' - func_echo "enabling shell trace mode" + func_echo "enabling shell trace mode" >&2 $debug_cmd ;; @@ -1704,7 +1879,10 @@ func_parse_options () ;; --warnings|--warning|-W) - test $# = 0 && func_missing_arg $_G_opt && break + if test $# = 0 && func_missing_arg $_G_opt; then + _G_parse_options_requote=: + break + fi case " $warning_categories $1" in *" $1 "*) # trailing space prevents matching last $1 above @@ -1757,15 +1935,24 @@ func_parse_options () shift ;; - --) break ;; + --) _G_parse_options_requote=: ; break ;; -*) func_fatal_help "unrecognised option: '$_G_opt'" ;; - *) set dummy "$_G_opt" ${1+"$@"}; shift; break ;; + *) set dummy "$_G_opt" ${1+"$@"}; shift + _G_match_parse_options=false + break + ;; esac + + if $_G_match_parse_options; then + _G_parse_options_requote=: + fi done - # save modified positional parameters for caller - func_quote_for_eval ${1+"$@"} - func_parse_options_result=$func_quote_for_eval_result + if $_G_parse_options_requote; then + # save modified positional parameters for caller + func_quote eval ${1+"$@"} + func_parse_options_result=$func_quote_result + fi } @@ -1782,12 +1969,10 @@ func_validate_options () test -n "$opt_warning_types" || opt_warning_types=" $warning_categories" func_run_hooks func_validate_options ${1+"$@"} + func_propagate_result func_run_hooks func_validate_options # Bail if the options were screwed! $exit_cmd $EXIT_FAILURE - - # save modified positional parameters for caller - func_validate_options_result=$func_run_hooks_result } @@ -1843,8 +2028,8 @@ func_missing_arg () # func_split_equals STRING # ------------------------ -# Set func_split_equals_lhs and func_split_equals_rhs shell variables after -# splitting STRING at the '=' sign. +# Set func_split_equals_lhs and func_split_equals_rhs shell variables +# after splitting STRING at the '=' sign. test -z "$_G_HAVE_XSI_OPS" \ && (eval 'x=a/b/c; test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \ @@ -1859,8 +2044,9 @@ then func_split_equals_lhs=${1%%=*} func_split_equals_rhs=${1#*=} - test "x$func_split_equals_lhs" = "x$1" \ - && func_split_equals_rhs= + if test "x$func_split_equals_lhs" = "x$1"; then + func_split_equals_rhs= + fi }' else # ...otherwise fall back to using expr, which is often a shell builtin. @@ -1938,31 +2124,44 @@ func_usage_message () # func_version # ------------ # Echo version message to standard output and exit. +# The version message is extracted from the calling file's header +# comments, with leading '# ' stripped: +# 1. First display the progname and version +# 2. Followed by the header comment line matching /^# Written by / +# 3. Then a blank line followed by the first following line matching +# /^# Copyright / +# 4. Immediately followed by any lines between the previous matches, +# except lines preceding the intervening completely blank line. +# For example, see the header comments of this file. func_version () { $debug_cmd printf '%s\n' "$progname $scriptversion" $SED -n ' - /(C)/!b go - :more - /\./!{ - N - s|\n# | | - b more + /^# Written by /!b + s|^# ||; p; n + + :fwd2blnk + /./ { + n + b fwd2blnk } - :go - /^# Written by /,/# warranty; / { - s|^# || - s|^# *$|| - s|\((C)\)[ 0-9,-]*[ ,-]\([1-9][0-9]* \)|\1 \2| - p + p; n + + :holdwrnt + s|^# || + s|^# *$|| + /^Copyright /!{ + /./H + n + b holdwrnt } - /^# Written by / { - s|^# || - p - } - /^warranty; /q' < "$progpath" + + s|\((C)\)[ 0-9,-]*[ ,-]\([1-9][0-9]* \)|\1 \2| + G + s|\(\n\)\n*|\1|g + p; q' < "$progpath" exit $? } @@ -1972,12 +2171,12 @@ func_version () # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'before-save-hook 'time-stamp) -# time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC" +# time-stamp-pattern: "30/scriptversion=%:y-%02m-%02d.%02H; # UTC" # time-stamp-time-zone: "UTC" # End: # Set a version string. -scriptversion='(GNU libtool) 2.4.6' +scriptversion='(GNU libtool) 2.4.6.42-b88ce' # func_echo ARG... @@ -2068,12 +2267,12 @@ include the following information: compiler: $LTCC compiler flags: $LTCFLAGS linker: $LD (gnu? $with_gnu_ld) - version: $progname (GNU libtool) 2.4.6 + version: $progname (GNU libtool) 2.4.6.42-b88ce automake: `($AUTOMAKE --version) 2>/dev/null |$SED 1q` autoconf: `($AUTOCONF --version) 2>/dev/null |$SED 1q` Report bugs to . -GNU libtool home page: . +GNU libtool home page: . General help using GNU software: ." exit 0 } @@ -2124,7 +2323,7 @@ fi # a configuration failure hint, and exit. func_fatal_configuration () { - func__fatal_error ${1+"$@"} \ + func_fatal_error ${1+"$@"} \ "See the $PACKAGE documentation for more information." \ "Fatal configuration error." } @@ -2270,6 +2469,8 @@ libtool_options_prep () nonopt= preserve_args= + _G_rc_lt_options_prep=: + # Shorthand for --mode=foo, only valid as the first argument case $1 in clean|clea|cle|cl) @@ -2293,11 +2494,16 @@ libtool_options_prep () uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) shift; set dummy --mode uninstall ${1+"$@"}; shift ;; + *) + _G_rc_lt_options_prep=false + ;; esac - # Pass back the list of options. - func_quote_for_eval ${1+"$@"} - libtool_options_prep_result=$func_quote_for_eval_result + if $_G_rc_lt_options_prep; then + # Pass back the list of options. + func_quote eval ${1+"$@"} + libtool_options_prep_result=$func_quote_result + fi } func_add_hook func_options_prep libtool_options_prep @@ -2309,9 +2515,12 @@ libtool_parse_options () { $debug_cmd + _G_rc_lt_parse_options=false + # Perform our own loop to consume as many options as possible in # each iteration. while test $# -gt 0; do + _G_match_lt_parse_options=: _G_opt=$1 shift case $_G_opt in @@ -2386,15 +2595,20 @@ libtool_parse_options () func_append preserve_args " $_G_opt" ;; - # An option not handled by this hook function: - *) set dummy "$_G_opt" ${1+"$@"}; shift; break ;; + # An option not handled by this hook function: + *) set dummy "$_G_opt" ${1+"$@"} ; shift + _G_match_lt_parse_options=false + break + ;; esac + $_G_match_lt_parse_options && _G_rc_lt_parse_options=: done - - # save modified positional parameters for caller - func_quote_for_eval ${1+"$@"} - libtool_parse_options_result=$func_quote_for_eval_result + if $_G_rc_lt_parse_options; then + # save modified positional parameters for caller + func_quote eval ${1+"$@"} + libtool_parse_options_result=$func_quote_result + fi } func_add_hook func_parse_options libtool_parse_options @@ -2451,8 +2665,8 @@ libtool_validate_options () } # Pass back the unparsed argument list - func_quote_for_eval ${1+"$@"} - libtool_validate_options_result=$func_quote_for_eval_result + func_quote eval ${1+"$@"} + libtool_validate_options_result=$func_quote_result } func_add_hook func_validate_options libtool_validate_options @@ -3418,8 +3632,8 @@ func_mode_compile () esac done - func_quote_for_eval "$libobj" - test "X$libobj" != "X$func_quote_for_eval_result" \ + func_quote_arg pretty "$libobj" + test "X$libobj" != "X$func_quote_arg_result" \ && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \ && func_warning "libobj name '$libobj' may not contain shell special characters." func_dirname_and_basename "$obj" "/" "" @@ -3492,8 +3706,8 @@ compiler." func_to_tool_file "$srcfile" func_convert_file_msys_to_w32 srcfile=$func_to_tool_file_result - func_quote_for_eval "$srcfile" - qsrcfile=$func_quote_for_eval_result + func_quote_arg pretty "$srcfile" + qsrcfile=$func_quote_arg_result # Only build a PIC object if we are building libtool libraries. if test yes = "$build_libtool_libs"; then @@ -4096,8 +4310,8 @@ func_mode_install () case $nonopt in *shtool*) :;; *) false;; esac then # Aesthetically quote it. - func_quote_for_eval "$nonopt" - install_prog="$func_quote_for_eval_result " + func_quote_arg pretty "$nonopt" + install_prog="$func_quote_arg_result " arg=$1 shift else @@ -4107,8 +4321,8 @@ func_mode_install () # The real first argument should be the name of the installation program. # Aesthetically quote it. - func_quote_for_eval "$arg" - func_append install_prog "$func_quote_for_eval_result" + func_quote_arg pretty "$arg" + func_append install_prog "$func_quote_arg_result" install_shared_prog=$install_prog case " $install_prog " in *[\\\ /]cp\ *) install_cp=: ;; @@ -4165,12 +4379,12 @@ func_mode_install () esac # Aesthetically quote the argument. - func_quote_for_eval "$arg" - func_append install_prog " $func_quote_for_eval_result" + func_quote_arg pretty "$arg" + func_append install_prog " $func_quote_arg_result" if test -n "$arg2"; then - func_quote_for_eval "$arg2" + func_quote_arg pretty "$arg2" fi - func_append install_shared_prog " $func_quote_for_eval_result" + func_append install_shared_prog " $func_quote_arg_result" done test -z "$install_prog" && \ @@ -4181,8 +4395,8 @@ func_mode_install () if test -n "$install_override_mode" && $no_mode; then if $install_cp; then :; else - func_quote_for_eval "$install_override_mode" - func_append install_shared_prog " -m $func_quote_for_eval_result" + func_quote_arg pretty "$install_override_mode" + func_append install_shared_prog " -m $func_quote_arg_result" fi fi @@ -4478,8 +4692,8 @@ func_mode_install () relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'` $opt_quiet || { - func_quote_for_expand "$relink_command" - eval "func_echo $func_quote_for_expand_result" + func_quote_arg expand,pretty "$relink_command" + eval "func_echo $func_quote_arg_result" } if eval "$relink_command"; then : else @@ -5258,7 +5472,8 @@ else if test \"\$libtool_execute_magic\" != \"$magic\"; then file=\"\$0\"" - qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"` + func_quote_arg pretty "$ECHO" + qECHO=$func_quote_arg_result $ECHO "\ # A function that is used when there is no print builtin or printf. @@ -5268,7 +5483,7 @@ func_fallback_echo () \$1 _LTECHO_EOF' } - ECHO=\"$qECHO\" + ECHO=$qECHO fi # Very basic option parsing. These options are (a) specific to @@ -6611,9 +6826,9 @@ func_mode_link () while test "$#" -gt 0; do arg=$1 shift - func_quote_for_eval "$arg" - qarg=$func_quote_for_eval_unquoted_result - func_append libtool_args " $func_quote_for_eval_result" + func_quote_arg pretty,unquoted "$arg" + qarg=$func_quote_arg_unquoted_result + func_append libtool_args " $func_quote_arg_result" # If the previous option needs an argument, assign it. if test -n "$prev"; then @@ -7211,9 +7426,9 @@ func_mode_link () save_ifs=$IFS; IFS=, for flag in $args; do IFS=$save_ifs - func_quote_for_eval "$flag" - func_append arg " $func_quote_for_eval_result" - func_append compiler_flags " $func_quote_for_eval_result" + func_quote_arg pretty "$flag" + func_append arg " $func_quote_arg_result" + func_append compiler_flags " $func_quote_arg_result" done IFS=$save_ifs func_stripname ' ' '' "$arg" @@ -7227,10 +7442,10 @@ func_mode_link () save_ifs=$IFS; IFS=, for flag in $args; do IFS=$save_ifs - func_quote_for_eval "$flag" - func_append arg " $wl$func_quote_for_eval_result" - func_append compiler_flags " $wl$func_quote_for_eval_result" - func_append linker_flags " $func_quote_for_eval_result" + func_quote_arg pretty "$flag" + func_append arg " $wl$func_quote_arg_result" + func_append compiler_flags " $wl$func_quote_arg_result" + func_append linker_flags " $func_quote_arg_result" done IFS=$save_ifs func_stripname ' ' '' "$arg" @@ -7254,8 +7469,8 @@ func_mode_link () # -msg_* for osf cc -msg_*) - func_quote_for_eval "$arg" - arg=$func_quote_for_eval_result + func_quote_arg pretty "$arg" + arg=$func_quote_arg_result ;; # Flags to be passed through unchanged, with rationale: @@ -7272,12 +7487,16 @@ func_mode_link () # -tp=* Portland pgcc target processor selection # --sysroot=* for sysroot support # -O*, -g*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization + # -specs=* GCC specs files # -stdlib=* select c++ std lib with clang + # -fsanitize=* Clang/GCC memory and address sanitizer + # -fuse-ld=* Linker select flags for GCC -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \ - -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*) - func_quote_for_eval "$arg" - arg=$func_quote_for_eval_result + -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*| \ + -specs=*|-fsanitize=*|-fuse-ld=*) + func_quote_arg pretty "$arg" + arg=$func_quote_arg_result func_append compile_command " $arg" func_append finalize_command " $arg" func_append compiler_flags " $arg" @@ -7298,15 +7517,15 @@ func_mode_link () continue else # Otherwise treat like 'Some other compiler flag' below - func_quote_for_eval "$arg" - arg=$func_quote_for_eval_result + func_quote_arg pretty "$arg" + arg=$func_quote_arg_result fi ;; # Some other compiler flag. -* | +*) - func_quote_for_eval "$arg" - arg=$func_quote_for_eval_result + func_quote_arg pretty "$arg" + arg=$func_quote_arg_result ;; *.$objext) @@ -7426,8 +7645,8 @@ func_mode_link () *) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. - func_quote_for_eval "$arg" - arg=$func_quote_for_eval_result + func_quote_arg pretty "$arg" + arg=$func_quote_arg_result ;; esac # arg @@ -9933,8 +10152,8 @@ EOF for cmd in $concat_cmds; do IFS=$save_ifs $opt_quiet || { - func_quote_for_expand "$cmd" - eval "func_echo $func_quote_for_expand_result" + func_quote_arg expand,pretty "$cmd" + eval "func_echo $func_quote_arg_result" } $opt_dry_run || eval "$cmd" || { lt_exit=$? @@ -10027,8 +10246,8 @@ EOF eval cmd=\"$cmd\" IFS=$save_ifs $opt_quiet || { - func_quote_for_expand "$cmd" - eval "func_echo $func_quote_for_expand_result" + func_quote_arg expand,pretty "$cmd" + eval "func_echo $func_quote_arg_result" } $opt_dry_run || eval "$cmd" || { lt_exit=$? @@ -10502,12 +10721,13 @@ EOF elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else - func_quote_for_eval "$var_value" - relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" + func_quote_arg pretty "$var_value" + relink_command="$var=$func_quote_arg_result; export $var; $relink_command" fi done - relink_command="(cd `pwd`; $relink_command)" - relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` + func_quote eval cd "`pwd`" + func_quote_arg pretty,unquoted "($func_quote_result; $relink_command)" + relink_command=$func_quote_arg_unquoted_result fi # Only actually do things if not in dry run mode. @@ -10747,13 +10967,15 @@ EOF elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else - func_quote_for_eval "$var_value" - relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" + func_quote_arg pretty,unquoted "$var_value" + relink_command="$var=$func_quote_arg_unquoted_result; export $var; $relink_command" fi done # Quote the link command for shipping. - relink_command="(cd `pwd`; $SHELL \"$progpath\" $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" - relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` + func_quote eval cd "`pwd`" + relink_command="($func_quote_result; $SHELL \"$progpath\" $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" + func_quote_arg pretty,unquoted "$relink_command" + relink_command=$func_quote_arg_unquoted_result if test yes = "$hardcode_automatic"; then relink_command= fi diff --git a/os/posix/NetworkSocketPosix.cpp b/os/posix/NetworkSocketPosix.cpp index 9eff048..52eef76 100644 --- a/os/posix/NetworkSocketPosix.cpp +++ b/os/posix/NetworkSocketPosix.cpp @@ -48,6 +48,9 @@ NetworkSocketPosix::NetworkSocketPosix(NetworkProtocol protocol) : NetworkSocket } NetworkSocketPosix::~NetworkSocketPosix(){ + if(fd>=0){ + Close(); + } if(tcpConnectedAddress) delete tcpConnectedAddress; if(pendingOutgoingPacket) @@ -139,9 +142,9 @@ void NetworkSocketPosix::Send(NetworkPacket *packet){ addr.sin6_family=AF_INET6; } addr.sin6_port=htons(packet->port); - res=sendto(fd, packet->data, packet->length, 0, (const sockaddr *) &addr, sizeof(addr)); + res=(int)sendto(fd, packet->data, packet->length, 0, (const sockaddr *) &addr, sizeof(addr)); }else{ - res=send(fd, packet->data, packet->length, 0); + res=(int)send(fd, packet->data, packet->length, 0); } if(res<=0){ if(errno==EAGAIN || errno==EWOULDBLOCK){ @@ -220,7 +223,7 @@ void NetworkSocketPosix::Receive(NetworkPacket *packet){ packet->protocol=PROTO_UDP; packet->port=ntohs(srcAddr.sin6_port); }else if(protocol==PROTO_TCP){ - int res=recv(fd, packet->data, packet->length, 0); + int res=(int)recv(fd, packet->data, packet->length, 0); if(res<=0){ LOGE("Error receiving from TCP socket: %d / %s", errno, strerror(errno)); failed=true; @@ -341,7 +344,7 @@ void NetworkSocketPosix::Connect(const NetworkAddress *address, uint16_t port){ timeout.tv_sec=60; setsockopt(fd, SOL_SOCKET, SO_RCVTIMEO, &timeout, sizeof(timeout)); fcntl(fd, F_SETFL, O_NONBLOCK); - int res=connect(fd, (const sockaddr*) addr, addrLen); + int res=(int)connect(fd, (const sockaddr*) addr, (socklen_t)addrLen); if(res!=0 && errno!=EINVAL && errno!=EINPROGRESS){ LOGW("error connecting TCP socket to %s:%u: %d / %s; %d / %s", address->ToString().c_str(), port, res, strerror(res), errno, strerror(errno)); close(fd);