From 07d270c87e6f9184aea4ca17eb26e466712e8db2 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Sat, 22 Jun 2013 01:10:38 +0900 Subject: [PATCH] Require -std=c++11 and use std::shared_ptr instead of SharedHandle --- configure.ac | 2 + src/AbstractAuthResolver.cc | 4 +- src/AbstractAuthResolver.h | 12 +- src/AbstractBtMessage.cc | 6 +- src/AbstractBtMessage.h | 16 +- src/AbstractCommand.cc | 56 +-- src/AbstractCommand.h | 76 ++-- src/AbstractHttpServerResponseCommand.cc | 13 +- src/AbstractHttpServerResponseCommand.h | 14 +- src/AbstractProxyRequestCommand.cc | 12 +- src/AbstractProxyRequestCommand.h | 16 +- src/AbstractProxyResponseCommand.cc | 10 +- src/AbstractProxyResponseCommand.h | 12 +- src/AbstractSingleDiskAdaptor.cc | 16 +- src/AbstractSingleDiskAdaptor.h | 8 +- src/ActivePeerConnectionCommand.cc | 10 +- src/ActivePeerConnectionCommand.h | 20 +- src/AdaptiveFileAllocationIterator.cc | 4 +- src/AdaptiveFileAllocationIterator.h | 4 +- src/AdaptiveURISelector.cc | 18 +- src/AdaptiveURISelector.h | 9 +- src/AnnounceList.cc | 18 +- src/AnnounceList.h | 12 +- src/AnnounceTier.h | 2 - src/AnonDiskWriterFactory.h | 4 +- src/AppleMessageDigestImpl.cc | 22 +- src/AppleMessageDigestImpl.h | 7 +- src/AsyncNameResolver.h | 1 - src/AsyncNameResolverMan.cc | 3 + src/AsyncNameResolverMan.h | 5 +- src/AuthConfig.cc | 2 +- src/AuthConfig.h | 5 +- src/AuthConfigFactory.cc | 36 +- src/AuthConfigFactory.h | 22 +- src/AuthResolver.h | 5 +- src/BackupIPv4ConnectCommand.cc | 15 +- src/BackupIPv4ConnectCommand.h | 10 +- src/BencodeParser.cc | 3 + src/BitfieldMan.h | 2 - src/BtAbortOutstandingRequestEvent.cc | 2 +- src/BtAbortOutstandingRequestEvent.h | 9 +- src/BtAllowedFastMessage.cc | 4 +- src/BtAnnounce.h | 6 +- src/BtCheckIntegrityEntry.cc | 8 +- src/BtChokeMessage.cc | 4 +- src/BtDependency.cc | 30 +- src/BtDependency.h | 7 +- src/BtExtendedMessage.cc | 8 +- src/BtExtendedMessage.h | 12 +- src/BtFileAllocationEntry.cc | 4 +- src/BtHandshakeMessage.cc | 4 +- src/BtHandshakeMessage.h | 2 +- src/BtInteractive.h | 7 +- src/BtInterestedMessage.cc | 6 +- src/BtInterestedMessage.h | 4 +- src/BtLeecherStateChoke.cc | 4 +- src/BtLeecherStateChoke.h | 8 +- src/BtMessageDispatcher.h | 10 +- src/BtMessageFactory.h | 45 +- src/BtMessageReceiver.h | 9 +- src/BtNotInterestedMessage.cc | 6 +- src/BtNotInterestedMessage.h | 4 +- src/BtPieceMessage.cc | 20 +- src/BtPieceMessage.h | 14 +- src/BtPortMessage.cc | 4 +- src/BtPostDownloadHandler.cc | 18 +- src/BtPostDownloadHandler.h | 2 +- src/BtRegistry.cc | 30 +- src/BtRegistry.h | 50 +-- src/BtRequestFactory.h | 11 +- src/BtRequestMessage.cc | 4 +- src/BtSeederStateChoke.cc | 2 +- src/BtSeederStateChoke.h | 8 +- src/BtSetup.cc | 24 +- src/BtStopDownloadCommand.h | 11 +- src/BtUnchokeMessage.cc | 4 +- src/CheckIntegrityCommand.cc | 2 +- src/CheckIntegrityCommand.h | 7 +- src/CheckIntegrityDispatcherCommand.cc | 4 +- src/CheckIntegrityDispatcherCommand.h | 4 +- src/CheckIntegrityEntry.cc | 4 +- src/CheckIntegrityEntry.h | 8 +- src/ChecksumCheckIntegrityEntry.cc | 6 +- src/ChunkChecksum.h | 2 - src/ChunkedDecodingStreamFilter.cc | 6 +- src/ChunkedDecodingStreamFilter.h | 6 +- src/ConnectCommand.cc | 16 +- src/ConnectCommand.h | 20 +- src/ConsoleStatCalc.cc | 16 +- src/ConsoleStatCalc.h | 3 +- src/Context.cc | 31 +- src/Context.h | 6 +- src/CookieStorage.cc | 8 +- src/CookieStorage.h | 4 +- src/CreateRequestCommand.cc | 6 +- src/DHTAbstractMessage.cc | 4 +- src/DHTAbstractMessage.h | 4 +- src/DHTAbstractNodeLookupTask.h | 40 +- src/DHTAbstractTask.cc | 2 +- src/DHTAbstractTask.h | 10 +- src/DHTAnnouncePeerMessage.cc | 10 +- src/DHTAnnouncePeerMessage.h | 6 +- src/DHTAnnouncePeerReplyMessage.cc | 8 +- src/DHTAnnouncePeerReplyMessage.h | 6 +- src/DHTAutoSaveCommand.cc | 14 +- src/DHTAutoSaveCommand.h | 11 +- src/DHTBucket.cc | 52 +-- src/DHTBucket.h | 38 +- src/DHTBucketRefreshCommand.cc | 6 +- src/DHTBucketRefreshCommand.h | 15 +- src/DHTBucketRefreshTask.cc | 6 +- src/DHTBucketTree.cc | 22 +- src/DHTBucketTree.h | 16 +- src/DHTConnectionImpl.h | 8 +- src/DHTEntryPointNameResolveCommand.cc | 10 +- src/DHTEntryPointNameResolveCommand.h | 21 +- src/DHTFindNodeMessage.cc | 12 +- src/DHTFindNodeMessage.h | 6 +- src/DHTFindNodeReplyMessage.cc | 16 +- src/DHTFindNodeReplyMessage.h | 12 +- src/DHTGetPeersCommand.cc | 8 +- src/DHTGetPeersCommand.h | 22 +- src/DHTGetPeersMessage.cc | 14 +- src/DHTGetPeersMessage.h | 6 +- src/DHTGetPeersReplyMessage.cc | 18 +- src/DHTGetPeersReplyMessage.h | 18 +- src/DHTIDCloser.h | 4 +- src/DHTInteractionCommand.cc | 14 +- src/DHTInteractionCommand.h | 29 +- src/DHTMessage.cc | 4 +- src/DHTMessage.h | 14 +- src/DHTMessageCallback.h | 8 +- src/DHTMessageDispatcher.h | 16 +- src/DHTMessageDispatcherImpl.cc | 16 +- src/DHTMessageDispatcherImpl.h | 20 +- src/DHTMessageEntry.cc | 4 +- src/DHTMessageEntry.h | 12 +- src/DHTMessageFactory.h | 46 +- src/DHTMessageFactoryImpl.cc | 98 ++--- src/DHTMessageFactoryImpl.h | 60 +-- src/DHTMessageReceiver.cc | 24 +- src/DHTMessageReceiver.h | 29 +- src/DHTMessageTracker.cc | 40 +- src/DHTMessageTracker.h | 26 +- src/DHTMessageTrackerEntry.cc | 4 +- src/DHTMessageTrackerEntry.h | 16 +- src/DHTNode.h | 1 - src/DHTNodeLookupEntry.cc | 2 +- src/DHTNodeLookupEntry.h | 7 +- src/DHTNodeLookupTask.cc | 12 +- src/DHTNodeLookupTask.h | 8 +- src/DHTNodeLookupTaskCallback.cc | 2 +- src/DHTNodeLookupTaskCallback.h | 2 +- src/DHTPeerAnnounceCommand.cc | 2 +- src/DHTPeerAnnounceCommand.h | 7 +- src/DHTPeerAnnounceEntry.cc | 4 +- src/DHTPeerAnnounceEntry.h | 4 +- src/DHTPeerAnnounceStorage.cc | 22 +- src/DHTPeerAnnounceStorage.h | 21 +- src/DHTPeerLookupTask.cc | 24 +- src/DHTPeerLookupTask.h | 14 +- src/DHTPeerLookupTaskCallback.cc | 2 +- src/DHTPeerLookupTaskCallback.h | 2 +- src/DHTPingMessage.cc | 10 +- src/DHTPingMessage.h | 6 +- src/DHTPingReplyMessage.cc | 8 +- src/DHTPingReplyMessage.h | 6 +- src/DHTPingReplyMessageCallback.h | 2 +- src/DHTPingTask.cc | 8 +- src/DHTPingTask.h | 6 +- src/DHTQueryMessage.cc | 4 +- src/DHTQueryMessage.h | 6 +- src/DHTRegistry.h | 21 +- src/DHTReplaceNodeTask.cc | 10 +- src/DHTReplaceNodeTask.h | 10 +- src/DHTResponseMessage.cc | 4 +- src/DHTResponseMessage.h | 6 +- src/DHTRoutingTable.cc | 36 +- src/DHTRoutingTable.h | 37 +- src/DHTRoutingTableDeserializer.cc | 6 +- src/DHTRoutingTableDeserializer.h | 10 +- src/DHTRoutingTableSerializer.cc | 8 +- src/DHTRoutingTableSerializer.h | 11 +- src/DHTSetup.cc | 35 +- src/DHTTaskExecutor.cc | 2 +- src/DHTTaskExecutor.h | 9 +- src/DHTTaskFactory.h | 25 +- src/DHTTaskFactoryImpl.cc | 38 +- src/DHTTaskFactoryImpl.h | 28 +- src/DHTTaskQueue.h | 9 +- src/DHTTaskQueueImpl.cc | 6 +- src/DHTTaskQueueImpl.h | 6 +- src/DHTTokenUpdateCommand.cc | 2 +- src/DHTTokenUpdateCommand.h | 7 +- src/DHTUnknownMessage.cc | 4 +- src/DHTUnknownMessage.h | 2 +- src/DNSCache.cc | 8 +- src/DNSCache.h | 6 +- src/DefaultAuthResolver.cc | 2 +- src/DefaultAuthResolver.h | 2 +- src/DefaultBtAnnounce.cc | 32 +- src/DefaultBtAnnounce.h | 30 +- src/DefaultBtInteractive.cc | 58 +-- src/DefaultBtInteractive.h | 62 +-- src/DefaultBtMessageDispatcher.cc | 56 +-- src/DefaultBtMessageDispatcher.h | 32 +- src/DefaultBtMessageFactory.cc | 108 ++--- src/DefaultBtMessageFactory.h | 62 +-- src/DefaultBtMessageReceiver.cc | 19 +- src/DefaultBtMessageReceiver.h | 10 +- src/DefaultBtProgressInfoFile.cc | 20 +- src/DefaultBtProgressInfoFile.h | 19 +- src/DefaultBtRequestFactory.cc | 42 +- src/DefaultBtRequestFactory.h | 20 +- src/DefaultDiskWriterFactory.cc | 4 +- src/DefaultDiskWriterFactory.h | 2 +- src/DefaultExtensionMessageFactory.cc | 22 +- src/DefaultExtensionMessageFactory.h | 22 +- src/DefaultPeerStorage.cc | 40 +- src/DefaultPeerStorage.h | 36 +- src/DefaultPieceStorage.cc | 108 ++--- src/DefaultPieceStorage.h | 88 ++-- src/DiskAdaptor.h | 8 +- src/DiskWriterFactory.h | 5 +- src/DlAbortEx.cc | 4 +- src/DlAbortEx.h | 2 +- src/DlRetryEx.cc | 4 +- src/DlRetryEx.h | 2 +- src/DownloadCommand.cc | 28 +- src/DownloadCommand.h | 22 +- src/DownloadContext.cc | 32 +- src/DownloadContext.h | 28 +- src/DownloadEngine.cc | 64 +-- src/DownloadEngine.h | 94 ++--- src/DownloadEngineFactory.cc | 22 +- src/DownloadEngineFactory.h | 7 +- src/DownloadFailureException.cc | 4 +- src/DownloadFailureException.h | 2 +- src/DownloadHandler.cc | 2 +- src/DownloadHandler.h | 7 +- src/DownloadHandlerFactory.cc | 24 +- src/DownloadHandlerFactory.h | 24 +- src/DownloadResult.h | 10 +- src/EpollEventPoll.cc | 16 +- src/EpollEventPoll.h | 16 +- src/Event.h | 22 +- src/EventPoll.h | 8 +- src/Exception.cc | 2 +- src/Exception.h | 6 +- src/ExtensionMessageFactory.h | 5 +- src/FatalException.cc | 4 +- src/FatalException.h | 2 +- src/FeatureConfig.cc | 12 +- src/FeedbackURISelector.cc | 8 +- src/FeedbackURISelector.h | 7 +- src/FileAllocationCommand.cc | 2 +- src/FileAllocationCommand.h | 8 +- src/FileAllocationDispatcherCommand.cc | 4 +- src/FileAllocationDispatcherCommand.h | 4 +- src/FileAllocationEntry.h | 4 +- src/FileAllocationIterator.h | 2 +- src/FileEntry.cc | 56 +-- src/FileEntry.h | 38 +- src/FillRequestGroupCommand.cc | 2 +- src/FillRequestGroupCommand.h | 1 - src/FtpConnection.cc | 16 +- src/FtpConnection.h | 22 +- src/FtpDownloadCommand.cc | 12 +- src/FtpDownloadCommand.h | 14 +- src/FtpFinishDownloadCommand.cc | 8 +- src/FtpFinishDownloadCommand.h | 10 +- src/FtpInitiateConnectionCommand.cc | 20 +- src/FtpInitiateConnectionCommand.h | 6 +- src/FtpNegotiationCommand.cc | 36 +- src/FtpNegotiationCommand.h | 22 +- src/FtpTunnelRequestCommand.cc | 8 +- src/FtpTunnelRequestCommand.h | 8 +- src/FtpTunnelResponseCommand.cc | 8 +- src/FtpTunnelResponseCommand.h | 8 +- src/GZipDecodingStreamFilter.cc | 6 +- src/GZipDecodingStreamFilter.h | 6 +- src/GenericParser.h | 1 - src/GroupId.cc | 11 +- src/GroupId.h | 7 +- src/GrowSegment.cc | 4 +- src/GrowSegment.h | 6 +- src/HandshakeExtensionMessage.cc | 10 +- src/HandshakeExtensionMessage.h | 11 +- src/HaveEraseCommand.cc | 2 +- src/HttpConnection.cc | 32 +- src/HttpConnection.h | 34 +- src/HttpDownloadCommand.cc | 12 +- src/HttpDownloadCommand.h | 14 +- src/HttpHeader.h | 2 - src/HttpHeaderProcessor.cc | 2 +- src/HttpHeaderProcessor.h | 7 +- src/HttpInitiateConnectionCommand.cc | 24 +- src/HttpInitiateConnectionCommand.h | 6 +- src/HttpListenCommand.cc | 2 +- src/HttpListenCommand.h | 5 +- src/HttpProxyRequestCommand.cc | 8 +- src/HttpProxyRequestCommand.h | 8 +- src/HttpProxyResponseCommand.cc | 8 +- src/HttpProxyResponseCommand.h | 8 +- src/HttpRequest.cc | 18 +- src/HttpRequest.h | 38 +- src/HttpRequestCommand.cc | 38 +- src/HttpRequestCommand.h | 14 +- src/HttpRequestConnectChain.h | 4 +- src/HttpResponse.cc | 14 +- src/HttpResponse.h | 20 +- src/HttpResponseCommand.cc | 68 +-- src/HttpResponseCommand.h | 24 +- src/HttpServer.cc | 6 +- src/HttpServer.h | 24 +- src/HttpServerBodyCommand.cc | 18 +- src/HttpServerBodyCommand.h | 14 +- src/HttpServerCommand.cc | 10 +- src/HttpServerCommand.h | 14 +- src/HttpServerResponseCommand.cc | 6 +- src/HttpServerResponseCommand.h | 6 +- src/HttpSkipResponseCommand.cc | 16 +- src/HttpSkipResponseCommand.h | 18 +- src/InitiateConnectionCommand.cc | 18 +- src/InitiateConnectionCommand.h | 12 +- src/InitiateConnectionCommandFactory.cc | 4 +- src/InitiateConnectionCommandFactory.h | 8 +- src/InitiatorMSEHandshakeCommand.cc | 16 +- src/InitiatorMSEHandshakeCommand.h | 18 +- src/IteratableChecksumValidator.cc | 4 +- src/IteratableChecksumValidator.h | 13 +- src/IteratableChunkChecksumValidator.cc | 4 +- src/IteratableChunkChecksumValidator.h | 15 +- src/JsonParser.cc | 4 +- src/KqueueEventPoll.cc | 16 +- src/KqueueEventPoll.h | 16 +- src/LibgcryptMessageDigestImpl.cc | 8 +- src/LibgcryptMessageDigestImpl.h | 7 +- src/LibnettleMessageDigestImpl.cc | 8 +- src/LibnettleMessageDigestImpl.h | 7 +- src/LibsslMessageDigestImpl.cc | 8 +- src/LibsslMessageDigestImpl.h | 7 +- src/LibuvEventPoll.cc | 16 +- src/LibuvEventPoll.h | 16 +- src/LogFactory.cc | 8 +- src/LogFactory.h | 12 +- src/Logger.cc | 1 + src/Logger.h | 5 +- src/LpdDispatchMessageCommand.cc | 2 +- src/LpdDispatchMessageCommand.h | 11 +- src/LpdMessage.cc | 2 +- src/LpdMessage.h | 7 +- src/LpdMessageDispatcher.h | 4 +- src/LpdMessageReceiver.cc | 8 +- src/LpdMessageReceiver.h | 13 +- src/LpdReceiveMessageCommand.cc | 14 +- src/LpdReceiveMessageCommand.h | 9 +- src/MSEHandshake.cc | 8 +- src/MSEHandshake.h | 18 +- src/Makefile.am | 1 - src/MemoryPreDownloadHandler.h | 2 +- src/MessageDigest.cc | 8 +- src/MessageDigest.h | 9 +- src/MetadataInfo.cc | 10 +- src/MetadataInfo.h | 12 +- src/Metalink2RequestGroup.cc | 70 +-- src/Metalink2RequestGroup.h | 18 +- src/MetalinkEntry.cc | 18 +- src/MetalinkEntry.h | 25 +- src/MetalinkParserController.cc | 2 +- src/MetalinkParserController.h | 21 +- src/MetalinkParserStateImpl.cc | 1 + src/MetalinkParserStateMachine.h | 6 +- src/MetalinkPostDownloadHandler.cc | 14 +- src/MetalinkPostDownloadHandler.h | 2 +- src/Metalinker.cc | 8 +- src/Metalinker.h | 11 +- src/MultiDiskAdaptor.cc | 60 +-- src/MultiDiskAdaptor.h | 22 +- src/MultiFileAllocationIterator.cc | 6 +- src/MultiFileAllocationIterator.h | 8 +- src/MultiUrlRequestInfo.cc | 24 +- src/MultiUrlRequestInfo.h | 26 +- src/NameResolveCommand.cc | 2 +- src/NameResolveCommand.h | 9 +- src/Netrc.cc | 14 +- src/Netrc.h | 13 +- src/NetrcAuthResolver.cc | 10 +- src/NetrcAuthResolver.h | 10 +- src/Notifier.cc | 4 +- src/Notifier.h | 8 +- src/NullHandle.h | 10 +- src/NullSinkStreamFilter.h | 6 +- src/NullWebSocketSessionMan.h | 7 +- src/Option.cc | 4 +- src/Option.h | 9 +- src/OptionHandler.h | 1 - src/OptionHandlerException.cc | 4 +- src/OptionHandlerException.h | 2 +- src/OptionHandlerFactory.cc | 2 +- src/OptionHandlerImpl.cc | 2 +- src/OptionParser.cc | 5 +- src/OptionParser.h | 6 +- src/Peer.h | 1 - src/PeerAbstractCommand.cc | 8 +- src/PeerAbstractCommand.h | 26 +- src/PeerChokeCommand.cc | 4 +- src/PeerChokeCommand.h | 11 +- src/PeerConnection.cc | 6 +- src/PeerConnection.h | 18 +- src/PeerInitiateConnectionCommand.cc | 10 +- src/PeerInitiateConnectionCommand.h | 14 +- src/PeerInteractionCommand.cc | 42 +- src/PeerInteractionCommand.h | 24 +- src/PeerListenCommand.cc | 4 +- src/PeerListenCommand.h | 6 +- src/PeerReceiveHandshakeCommand.cc | 16 +- src/PeerReceiveHandshakeCommand.h | 10 +- src/PeerStorage.h | 16 +- src/Piece.cc | 13 +- src/Piece.h | 8 +- src/PieceHashCheckIntegrityEntry.cc | 4 +- src/PieceStatMan.h | 2 - src/PieceStorage.h | 46 +- src/PiecedSegment.cc | 4 +- src/PiecedSegment.h | 6 +- src/PollEventPoll.cc | 18 +- src/PollEventPoll.h | 16 +- src/PortEventPoll.cc | 16 +- src/PortEventPoll.h | 16 +- src/PostDownloadHandler.h | 2 +- src/PriorityPieceSelector.cc | 2 +- src/PriorityPieceSelector.h | 7 +- src/RarestPieceSelector.cc | 2 +- src/RarestPieceSelector.h | 7 +- src/ReceiverMSEHandshakeCommand.cc | 10 +- src/ReceiverMSEHandshakeCommand.h | 4 +- src/RecoverableException.cc | 4 +- src/RecoverableException.h | 2 +- src/Request.cc | 2 +- src/Request.h | 8 +- src/RequestGroup.cc | 88 ++-- src/RequestGroup.h | 78 ++-- src/RequestGroupCriteria.h | 1 - src/RequestGroupMan.cc | 100 ++--- src/RequestGroupMan.h | 48 +-- src/RequestSlot.h | 6 +- src/RpcMethod.cc | 6 +- src/RpcMethod.h | 10 +- src/RpcMethodFactory.cc | 82 ++-- src/RpcMethodFactory.h | 7 +- src/RpcMethodImpl.cc | 316 +++++++------- src/RpcMethodImpl.h | 96 ++--- src/RpcRequest.cc | 6 +- src/RpcRequest.h | 10 +- src/RpcResponse.cc | 14 +- src/RpcResponse.h | 8 +- src/SeedCheckCommand.cc | 8 +- src/SeedCheckCommand.h | 17 +- src/SeedCriteria.h | 1 - src/Segment.h | 5 +- src/SegmentMan.cc | 96 ++--- src/SegmentMan.h | 60 +-- src/SelectEventPoll.cc | 16 +- src/SelectEventPoll.h | 16 +- src/SequentialDispatcherCommand.h | 10 +- src/SequentialPicker.h | 17 +- src/ServerStat.h | 6 +- src/ServerStatMan.cc | 12 +- src/ServerStatMan.h | 10 +- src/SessionSerializer.cc | 24 +- src/SessionSerializer.h | 7 +- src/ShareRatioSeedCriteria.cc | 6 +- src/ShareRatioSeedCriteria.h | 14 +- src/SharedHandle.cc | 121 ------ src/SharedHandle.h | 398 ------------------ src/Signature.h | 2 - src/SimpleRandomizer.cc | 4 +- src/SimpleRandomizer.h | 8 +- src/SingletonHolder.h | 12 +- src/SinkStreamFilter.cc | 7 +- src/SinkStreamFilter.h | 6 +- src/SocketBuffer.cc | 14 +- src/SocketBuffer.h | 15 +- src/SocketCore.cc | 12 +- src/SocketCore.h | 14 +- src/SocketRecvBuffer.cc | 3 +- src/SocketRecvBuffer.h | 9 +- src/StatCalc.h | 1 - src/StreamCheckIntegrityEntry.cc | 4 +- src/StreamFileAllocationEntry.cc | 8 +- src/StreamFilter.cc | 4 +- src/StreamFilter.h | 15 +- src/TrackerWatcherCommand.cc | 46 +- src/TrackerWatcherCommand.h | 45 +- src/UDPTrackerClient.cc | 58 +-- src/UDPTrackerClient.h | 22 +- src/UDPTrackerRequest.h | 4 +- src/UTMetadataDataExtensionMessage.cc | 4 +- src/UTMetadataDataExtensionMessage.h | 11 +- src/UTMetadataPostDownloadHandler.cc | 14 +- src/UTMetadataPostDownloadHandler.h | 2 +- src/UTMetadataRequestExtensionMessage.cc | 14 +- src/UTMetadataRequestExtensionMessage.h | 11 +- src/UTMetadataRequestFactory.cc | 10 +- src/UTMetadataRequestFactory.h | 14 +- src/UTPexExtensionMessage.cc | 12 +- src/UTPexExtensionMessage.h | 20 +- src/UnionSeedCriteria.cc | 8 +- src/UnionSeedCriteria.h | 7 +- src/UnknownLengthPieceStorage.cc | 56 +-- src/UnknownLengthPieceStorage.h | 54 +-- src/UnknownOptionException.cc | 4 +- src/UnknownOptionException.h | 2 +- src/UriListParser.cc | 2 +- src/UriListParser.h | 4 +- src/ValueBase.cc | 54 +-- src/ValueBase.h | 55 ++- src/ValueBaseDiskWriter.h | 2 +- src/ValueBaseStructParserStateImpl.cc | 3 + src/ValueBaseStructParserStateMachine.cc | 8 +- src/ValueBaseStructParserStateMachine.h | 13 +- src/WebSocketInteractionCommand.cc | 8 +- src/WebSocketInteractionCommand.h | 11 +- src/WebSocketResponseCommand.cc | 8 +- src/WebSocketResponseCommand.h | 6 +- src/WebSocketSession.cc | 13 +- src/WebSocketSession.h | 11 +- src/WebSocketSessionMan.cc | 13 +- src/WebSocketSessionMan.h | 8 +- src/WrDiskCache.cc | 13 +- src/WrDiskCacheEntry.cc | 4 +- src/WrDiskCacheEntry.h | 6 +- src/XmlRpcDiskWriter.cc | 4 +- src/XmlRpcRequestParserController.cc | 4 +- src/XmlRpcRequestParserController.h | 6 +- src/XmlRpcRequestParserStateMachine.cc | 4 +- src/XmlRpcRequestParserStateMachine.h | 7 +- src/a2functional.h | 20 +- src/aria2api.cc | 120 +++--- src/aria2api.h | 5 +- src/bencode2.cc | 10 +- src/bencode2.h | 10 +- src/bittorrent_helper.cc | 99 ++--- src/bittorrent_helper.h | 68 +-- src/console.h | 6 +- src/download_helper.cc | 124 +++--- src/download_helper.h | 41 +- src/json.cc | 2 +- src/json.h | 4 +- src/magnet.cc | 6 +- src/magnet.h | 8 +- src/main.cc | 1 - src/message_digest_helper.cc | 6 +- src/message_digest_helper.h | 9 +- src/metalink_helper.cc | 28 +- src/metalink_helper.h | 14 +- src/option_processing.cc | 10 +- src/rpc_helper.cc | 18 +- src/rpc_helper.h | 5 +- src/util.cc | 20 +- src/util.h | 12 +- src/version_usage.cc | 3 +- test/AnnounceListTest.cc | 32 +- test/Aria2ApiTest.cc | 6 +- test/AuthConfigFactoryTest.cc | 30 +- test/Bencode2Test.cc | 4 +- test/BittorrentHelperTest.cc | 176 ++++---- test/BtAllowedFastMessageTest.cc | 8 +- test/BtBitfieldMessageTest.cc | 10 +- test/BtCancelMessageTest.cc | 6 +- test/BtChokeMessageTest.cc | 12 +- test/BtDependencyTest.cc | 66 +-- test/BtExtendedMessageTest.cc | 12 +- test/BtHandshakeMessageTest.cc | 4 +- test/BtHaveAllMessageTest.cc | 10 +- test/BtHaveMessageTest.cc | 10 +- test/BtHaveNoneMessageTest.cc | 4 +- test/BtInterestedMessageTest.cc | 10 +- test/BtNotInterestedMessageTest.cc | 10 +- test/BtPieceMessageTest.cc | 22 +- test/BtPortMessageTest.cc | 38 +- test/BtPostDownloadHandlerTest.cc | 10 +- test/BtRegistryTest.cc | 18 +- test/BtRejectMessageTest.cc | 10 +- test/BtRequestMessageTest.cc | 46 +- test/BtSuggestPieceMessageTest.cc | 2 +- test/BtUnchokeMessageTest.cc | 8 +- test/ChunkedDecodingStreamFilterTest.cc | 8 +- test/DHTAnnouncePeerMessageTest.cc | 25 +- test/DHTAnnouncePeerReplyMessageTest.cc | 6 +- test/DHTBucketTest.cc | 78 ++-- test/DHTBucketTreeTest.cc | 66 +-- test/DHTFindNodeMessageTest.cc | 27 +- test/DHTFindNodeReplyMessageTest.cc | 20 +- test/DHTGetPeersMessageTest.cc | 36 +- test/DHTGetPeersReplyMessageTest.cc | 32 +- test/DHTIDCloserTest.cc | 22 +- test/DHTMessageFactoryImplTest.cc | 144 +++---- test/DHTMessageTrackerEntryTest.cc | 10 +- test/DHTMessageTrackerTest.cc | 30 +- test/DHTPeerAnnounceEntryTest.cc | 4 +- test/DHTPeerAnnounceStorageTest.cc | 2 +- test/DHTPingMessageTest.cc | 21 +- test/DHTPingReplyMessageTest.cc | 6 +- test/DHTRoutingTableDeserializerTest.cc | 16 +- test/DHTRoutingTableSerializerTest.cc | 16 +- test/DHTRoutingTableTest.cc | 26 +- test/DHTTaskExecutorTest.cc | 12 +- test/DHTUnknownMessageTest.cc | 2 +- test/DefaultAuthResolverTest.cc | 12 +- test/DefaultBtAnnounceTest.cc | 62 +-- test/DefaultBtMessageDispatcherTest.cc | 64 +-- test/DefaultBtMessageFactoryTest.cc | 22 +- test/DefaultBtProgressInfoFileTest.cc | 66 +-- test/DefaultBtRequestFactoryTest.cc | 73 ++-- test/DefaultExtensionMessageFactoryTest.cc | 32 +- test/DefaultPeerStorageTest.cc | 38 +- test/DefaultPieceStorageTest.cc | 70 +-- test/DirectDiskAdaptorTest.cc | 10 +- test/DownloadContextTest.cc | 20 +- test/DownloadHandlerFactoryTest.cc | 18 +- test/DownloadHelperTest.cc | 76 ++-- test/FeedbackURISelectorTest.cc | 14 +- test/FileEntryTest.cc | 68 +-- test/FtpConnectionTest.cc | 16 +- test/GZipDecodingStreamFilterTest.cc | 10 +- test/GroupIdTest.cc | 6 +- test/GrowSegmentTest.cc | 4 +- test/HandshakeExtensionMessageTest.cc | 12 +- test/HttpHeaderProcessorTest.cc | 8 +- test/HttpRequestTest.cc | 94 ++--- test/HttpResponseTest.cc | 118 +++--- test/IndexedListTest.cc | 16 +- test/InorderURISelectorTest.cc | 2 +- test/IteratableChecksumValidatorTest.cc | 8 +- test/IteratableChunkChecksumValidatorTest.cc | 8 +- test/JsonTest.cc | 12 +- test/LpdMessageDispatcherTest.cc | 2 +- test/LpdMessageReceiverTest.cc | 4 +- test/MSEHandshakeTest.cc | 40 +- test/MagnetTest.cc | 4 +- test/Makefile.am | 1 - test/MessageDigestHelperTest.cc | 2 +- test/MessageDigestTest.cc | 2 +- test/Metalink2RequestGroupTest.cc | 50 +-- test/MetalinkEntryTest.cc | 24 +- test/MetalinkHelperTest.cc | 32 +- test/MetalinkParserControllerTest.cc | 40 +- test/MetalinkPostDownloadHandlerTest.cc | 14 +- test/MetalinkProcessorTest.cc | 116 ++--- test/MetalinkerTest.cc | 12 +- test/MockBtAnnounce.h | 6 +- test/MockBtMessage.h | 4 +- test/MockBtMessageDispatcher.h | 10 +- test/MockBtMessageFactory.h | 80 ++-- test/MockBtRequestFactory.h | 8 +- test/MockDHTMessage.h | 28 +- test/MockDHTMessageCallback.h | 2 +- test/MockDHTMessageDispatcher.h | 20 +- test/MockDHTMessageFactory.h | 72 ++-- test/MockDHTTask.h | 4 +- test/MockDHTTaskFactory.h | 34 +- test/MockDHTTaskQueue.h | 12 +- test/MockExtensionMessageFactory.h | 4 +- test/MockPeerStorage.h | 26 +- test/MockPieceStorage.h | 58 +-- test/MockSegment.h | 4 +- test/MultiDiskAdaptorTest.cc | 114 ++--- test/MultiFileAllocationIteratorTest.cc | 56 ++- test/NetrcAuthResolverTest.cc | 26 +- test/NetrcTest.cc | 24 +- test/OptionParserTest.cc | 2 +- test/OptionTest.cc | 2 +- test/PeerConnectionTest.cc | 2 +- test/PeerSessionResourceTest.cc | 2 +- test/PeerTest.cc | 6 +- test/PieceTest.cc | 4 +- test/PriorityPieceSelectorTest.cc | 2 +- test/RarestPieceSelectorTest.cc | 2 +- test/RequestGroupManTest.cc | 66 +-- test/RequestGroupTest.cc | 12 +- test/RpcMethodTest.cc | 146 +++---- test/RpcResponseTest.cc | 8 +- test/SegmentManTest.cc | 60 +-- test/SegmentTest.cc | 8 +- test/SequentialPickerTest.cc | 2 +- test/ServerStatManTest.cc | 26 +- test/SessionSerializerTest.cc | 18 +- test/ShareRatioSeedCriteriaTest.cc | 6 +- test/SharedHandleTest.cc | 81 ---- test/SingletonHolderTest.cc | 4 +- test/SinkStreamFilterTest.cc | 6 +- test/TestUtil.cc | 32 +- test/TestUtil.h | 18 +- test/UDPTrackerClientTest.cc | 32 +- test/UTMetadataDataExtensionMessageTest.cc | 12 +- test/UTMetadataPostDownloadHandlerTest.cc | 20 +- test/UTMetadataRequestExtensionMessageTest.cc | 24 +- test/UTMetadataRequestFactoryTest.cc | 20 +- test/UTPexExtensionMessageTest.cc | 64 +-- test/UtilTest.cc | 10 +- test/ValueBaseBencodeParserTest.cc | 32 +- test/ValueBaseJsonParserTest.cc | 40 +- test/ValueBaseTest.cc | 2 +- test/WrDiskCacheEntryTest.cc | 4 +- test/WrDiskCacheTest.cc | 4 +- test/a2functionalTest.cc | 2 +- test/extension_message_test_helper.h | 6 +- 709 files changed, 6305 insertions(+), 6878 deletions(-) delete mode 100644 src/SharedHandle.cc delete mode 100644 src/SharedHandle.h delete mode 100644 test/SharedHandleTest.cc diff --git a/configure.ac b/configure.ac index 977543b9..5e927486 100644 --- a/configure.ac +++ b/configure.ac @@ -93,6 +93,8 @@ AC_LANG([C++]) # Check pkg-config is available PKG_PROG_PKG_CONFIG([0.20]) +CXXFLAGS="-std=c++11 $CXXFLAGS" + # Check static build is requested if test "x$ARIA2_STATIC" = "xyes"; then case "$host" in diff --git a/src/AbstractAuthResolver.cc b/src/AbstractAuthResolver.cc index 2b273cb9..a9730f3d 100644 --- a/src/AbstractAuthResolver.cc +++ b/src/AbstractAuthResolver.cc @@ -42,13 +42,13 @@ AbstractAuthResolver::AbstractAuthResolver() {} AbstractAuthResolver::~AbstractAuthResolver() {} void AbstractAuthResolver::setUserDefinedAuthConfig -(const SharedHandle& authConfig) +(const std::shared_ptr& authConfig) { userDefinedAuthConfig_ = authConfig; } void AbstractAuthResolver::setDefaultAuthConfig -(const SharedHandle& authConfig) +(const std::shared_ptr& authConfig) { defaultAuthConfig_ = authConfig; } diff --git a/src/AbstractAuthResolver.h b/src/AbstractAuthResolver.h index 93e73b87..4801490f 100644 --- a/src/AbstractAuthResolver.h +++ b/src/AbstractAuthResolver.h @@ -41,24 +41,24 @@ namespace aria2 { class AbstractAuthResolver : public AuthResolver { private: - SharedHandle userDefinedAuthConfig_; + std::shared_ptr userDefinedAuthConfig_; - SharedHandle defaultAuthConfig_; + std::shared_ptr defaultAuthConfig_; public: AbstractAuthResolver(); virtual ~AbstractAuthResolver(); - void setUserDefinedAuthConfig(const SharedHandle& authConfig); + void setUserDefinedAuthConfig(const std::shared_ptr& authConfig); - const SharedHandle& getUserDefinedAuthConfig() const + const std::shared_ptr& getUserDefinedAuthConfig() const { return userDefinedAuthConfig_; } - void setDefaultAuthConfig(const SharedHandle& authConfig); + void setDefaultAuthConfig(const std::shared_ptr& authConfig); - const SharedHandle& getDefaultAuthConfig() const + const std::shared_ptr& getDefaultAuthConfig() const { return defaultAuthConfig_; } diff --git a/src/AbstractBtMessage.cc b/src/AbstractBtMessage.cc index 55177370..f4fef342 100644 --- a/src/AbstractBtMessage.cc +++ b/src/AbstractBtMessage.cc @@ -54,7 +54,7 @@ AbstractBtMessage::AbstractBtMessage(uint8_t id, const char* name) AbstractBtMessage::~AbstractBtMessage() {} -void AbstractBtMessage::setPeer(const SharedHandle& peer) +void AbstractBtMessage::setPeer(const std::shared_ptr& peer) { peer_ = peer; } @@ -67,12 +67,12 @@ void AbstractBtMessage::validate() } void -AbstractBtMessage::setBtMessageValidator(const SharedHandle& validator) { +AbstractBtMessage::setBtMessageValidator(const std::shared_ptr& validator) { validator_ = validator; } void AbstractBtMessage::setPieceStorage -(const SharedHandle& pieceStorage) +(const std::shared_ptr& pieceStorage) { pieceStorage_ = pieceStorage; } diff --git a/src/AbstractBtMessage.h b/src/AbstractBtMessage.h index c34269e7..49a1b2ed 100644 --- a/src/AbstractBtMessage.h +++ b/src/AbstractBtMessage.h @@ -56,9 +56,9 @@ private: const char* name_; - SharedHandle pieceStorage_; + std::shared_ptr pieceStorage_; - SharedHandle peer_; + std::shared_ptr peer_; BtMessageDispatcher* dispatcher_; @@ -68,11 +68,11 @@ private: PeerConnection* peerConnection_; - SharedHandle validator_; + std::shared_ptr validator_; bool metadataGetMode_; protected: - const SharedHandle& getPieceStorage() const + const std::shared_ptr& getPieceStorage() const { return pieceStorage_; } @@ -130,12 +130,12 @@ public: cuid_ = cuid; } - const SharedHandle& getPeer() const + const std::shared_ptr& getPeer() const { return peer_; } - void setPeer(const SharedHandle& peer); + void setPeer(const std::shared_ptr& peer); virtual void doReceivedAction() {} @@ -151,9 +151,9 @@ public: virtual void onChokingEvent(const BtChokingEvent& event) {} - void setBtMessageValidator(const SharedHandle& validator); + void setBtMessageValidator(const std::shared_ptr& validator); - void setPieceStorage(const SharedHandle& pieceStorage); + void setPieceStorage(const std::shared_ptr& pieceStorage); void setBtMessageDispatcher(BtMessageDispatcher* dispatcher); diff --git a/src/AbstractCommand.cc b/src/AbstractCommand.cc index 9e253025..bb078495 100644 --- a/src/AbstractCommand.cc +++ b/src/AbstractCommand.cc @@ -79,12 +79,12 @@ namespace aria2 { AbstractCommand::AbstractCommand (cuid_t cuid, - const SharedHandle& req, - const SharedHandle& fileEntry, + const std::shared_ptr& req, + const std::shared_ptr& fileEntry, RequestGroup* requestGroup, DownloadEngine* e, - const SharedHandle& s, - const SharedHandle& socketRecvBuffer, + const std::shared_ptr& s, + const std::shared_ptr& socketRecvBuffer, bool incNumConnection) : Command(cuid), checkPoint_(global::wallclock()), timeout_(requestGroup->getTimeout()), @@ -125,7 +125,7 @@ AbstractCommand::~AbstractCommand() { } void AbstractCommand::useFasterRequest -(const SharedHandle& fasterRequest) +(const std::shared_ptr& fasterRequest) { A2_LOG_INFO(fmt("CUID#%" PRId64 " - Use faster Request hostname=%s, port=%u", getCuid(), @@ -180,7 +180,7 @@ bool AbstractCommand::execute() { if(req_ && fileEntry_->countPooledRequest() > 0 && requestGroup_->getTotalLength()-requestGroup_->getCompletedLength() < calculateMinSplitSize()*2) { - SharedHandle fasterRequest = fileEntry_->findFasterRequest(req_); + std::shared_ptr fasterRequest = fileEntry_->findFasterRequest(req_); if(fasterRequest) { useFasterRequest(fasterRequest); return true; @@ -197,7 +197,7 @@ bool AbstractCommand::execute() { if(getOption()->getAsBool(PREF_SELECT_LEAST_USED_HOST)) { getDownloadEngine()->getRequestGroupMan()->getUsedHosts(usedHosts); } - SharedHandle fasterRequest = + std::shared_ptr fasterRequest = fileEntry_->findFasterRequest (req_, usedHosts, e_->getRequestGroupMan()->getServerStatMan()); if(fasterRequest) { @@ -230,7 +230,7 @@ bool AbstractCommand::execute() { size_t maxSegments = req_?req_->getMaxPipelinedRequest():1; size_t minSplitSize = calculateMinSplitSize(); while(segments_.size() < maxSegments) { - SharedHandle segment = + std::shared_ptr segment = getSegmentMan()->getSegment(getCuid(), minSplitSize); if(!segment) { break; @@ -276,7 +276,7 @@ bool AbstractCommand::execute() { } else { if(checkPoint_.difference(global::wallclock()) >= timeout_) { // timeout triggers ServerStat error state. - SharedHandle ss = + std::shared_ptr ss = e_->getRequestGroupMan()->getOrCreateServerStat(req_->getHost(), req_->getProtocol()); ss->setError(); @@ -375,7 +375,7 @@ bool AbstractCommand::execute() { void AbstractCommand::tryReserved() { if(getDownloadContext()->getFileEntries().size() == 1) { - const SharedHandle& entry = + const std::shared_ptr& entry = getDownloadContext()->getFirstFileEntry(); // Don't create new command if currently file length is unknown // and there are no URI left. Because file length is unknown, we @@ -490,7 +490,7 @@ void AbstractCommand::disableReadCheckSocket() { } void AbstractCommand::setReadCheckSocket -(const SharedHandle& socket) { +(const std::shared_ptr& socket) { if(!socket->isOpen()) { disableReadCheckSocket(); } else { @@ -509,7 +509,7 @@ void AbstractCommand::setReadCheckSocket } void AbstractCommand::setReadCheckSocketIf -(const SharedHandle& socket, bool pred) +(const std::shared_ptr& socket, bool pred) { if(pred) { setReadCheckSocket(socket); @@ -527,7 +527,7 @@ void AbstractCommand::disableWriteCheckSocket() { } void AbstractCommand::setWriteCheckSocket -(const SharedHandle& socket) { +(const std::shared_ptr& socket) { if(!socket->isOpen()) { disableWriteCheckSocket(); } else { @@ -546,7 +546,7 @@ void AbstractCommand::setWriteCheckSocket } void AbstractCommand::setWriteCheckSocketIf -(const SharedHandle& socket, bool pred) +(const std::shared_ptr& socket, bool pred) { if(pred) { setWriteCheckSocket(socket); @@ -555,7 +555,7 @@ void AbstractCommand::setWriteCheckSocketIf } } -void AbstractCommand::swapSocket(SharedHandle& socket) +void AbstractCommand::swapSocket(std::shared_ptr& socket) { disableReadCheckSocket(); disableWriteCheckSocket(); @@ -634,7 +634,7 @@ namespace { // Returns true if proxy is defined for the given protocol. Otherwise // returns false. bool isProxyRequest -(const std::string& protocol, const SharedHandle