diff --git a/CMakeLists.txt b/CMakeLists.txt index 386aed331..888715414 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -297,6 +297,7 @@ set(THIRD_PARTY_DIR ${CMAKE_SOURCE_DIR}/third-party) if(WIN32) tr_add_external_auto_library(EVENT2 libevent event CMAKE_ARGS + "-DEVENT__DISABLE_OPENSSL:BOOL=ON" "-DEVENT__DISABLE_SAMPLES:BOOL=ON" "-DEVENT__LIBRARY_TYPE:STRING=STATIC") else() @@ -440,7 +441,6 @@ else() -Wint-in-bool-context -Wlogical-op -Wmissing-format-attribute - -Wnested-externs -Wnull-dereference -Wpointer-arith -Wredundant-decls @@ -455,7 +455,6 @@ else() -Wshadow -Wsign-compare -Wsometimes-uninitialized - -Wstrict-prototypes -Wstring-conversion -Wsuggest-destructor-override -Wsuggest-override diff --git a/Transmission.xcodeproj/project.pbxproj b/Transmission.xcodeproj/project.pbxproj index 08f7e8bb4..0526d458b 100644 --- a/Transmission.xcodeproj/project.pbxproj +++ b/Transmission.xcodeproj/project.pbxproj @@ -7,34 +7,34 @@ objects = { /* Begin PBXBuildFile section */ - 0A6169A70FE5C9A200C66CE6 /* bitfield.c in Sources */ = {isa = PBXBuildFile; fileRef = 0A6169A50FE5C9A200C66CE6 /* bitfield.c */; }; + 0A6169A70FE5C9A200C66CE6 /* bitfield.cc in Sources */ = {isa = PBXBuildFile; fileRef = 0A6169A50FE5C9A200C66CE6 /* bitfield.cc */; }; 0A6169A80FE5C9A200C66CE6 /* bitfield.h in Headers */ = {isa = PBXBuildFile; fileRef = 0A6169A60FE5C9A200C66CE6 /* bitfield.h */; }; 35F373030C2DA89000DAA8F2 /* FilePriorityCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 35F373010C2DA88F00DAA8F2 /* FilePriorityCell.m */; }; 3C7A11970D0B2EE300B5701F /* getgateway.c in Sources */ = {isa = PBXBuildFile; fileRef = 3C7A11910D0B2EE300B5701F /* getgateway.c */; }; 3C7A11980D0B2EE300B5701F /* getgateway.h in Headers */ = {isa = PBXBuildFile; fileRef = 3C7A11920D0B2EE300B5701F /* getgateway.h */; }; 3C7A11990D0B2EE300B5701F /* natpmp.c in Sources */ = {isa = PBXBuildFile; fileRef = 3C7A11930D0B2EE300B5701F /* natpmp.c */; }; 3C7A119A0D0B2EE300B5701F /* natpmp.h in Headers */ = {isa = PBXBuildFile; fileRef = 3C7A11940D0B2EE300B5701F /* natpmp.h */; }; - 4394AC670C74FB6000F367E8 /* ptrarray.c in Sources */ = {isa = PBXBuildFile; fileRef = 4394AC640C74FB6000F367E8 /* ptrarray.c */; }; + 4394AC670C74FB6000F367E8 /* ptrarray.cc in Sources */ = {isa = PBXBuildFile; fileRef = 4394AC640C74FB6000F367E8 /* ptrarray.cc */; }; 4D043A7F090AE979009FEDA8 /* TransmissionDocument.icns in Resources */ = {isa = PBXBuildFile; fileRef = 4D043A7E090AE979009FEDA8 /* TransmissionDocument.icns */; }; 4D118E1A08CB46B20033958F /* PrefsController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4D118E1908CB46B20033958F /* PrefsController.m */; }; 4D1838DD09DEC0E80047D688 /* libtransmission.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4D18389709DEC0030047D688 /* libtransmission.a */; }; 4D364DA0091FBB2C00377D12 /* TorrentTableView.m in Sources */ = {isa = PBXBuildFile; fileRef = 4D364D9F091FBB2C00377D12 /* TorrentTableView.m */; }; - 4D36BA6F0CA2F00800A63CA5 /* crypto.c in Sources */ = {isa = PBXBuildFile; fileRef = 4D36BA600CA2F00800A63CA5 /* crypto.c */; }; + 4D36BA6F0CA2F00800A63CA5 /* crypto.cc in Sources */ = {isa = PBXBuildFile; fileRef = 4D36BA600CA2F00800A63CA5 /* crypto.cc */; }; 4D36BA700CA2F00800A63CA5 /* crypto.h in Headers */ = {isa = PBXBuildFile; fileRef = 4D36BA610CA2F00800A63CA5 /* crypto.h */; }; - 4D36BA720CA2F00800A63CA5 /* handshake.c in Sources */ = {isa = PBXBuildFile; fileRef = 4D36BA630CA2F00800A63CA5 /* handshake.c */; }; + 4D36BA720CA2F00800A63CA5 /* handshake.cc in Sources */ = {isa = PBXBuildFile; fileRef = 4D36BA630CA2F00800A63CA5 /* handshake.cc */; }; 4D36BA730CA2F00800A63CA5 /* handshake.h in Headers */ = {isa = PBXBuildFile; fileRef = 4D36BA640CA2F00800A63CA5 /* handshake.h */; }; - 4D36BA740CA2F00800A63CA5 /* peer-io.c in Sources */ = {isa = PBXBuildFile; fileRef = 4D36BA650CA2F00800A63CA5 /* peer-io.c */; }; + 4D36BA740CA2F00800A63CA5 /* peer-io.cc in Sources */ = {isa = PBXBuildFile; fileRef = 4D36BA650CA2F00800A63CA5 /* peer-io.cc */; }; 4D36BA750CA2F00800A63CA5 /* peer-io.h in Headers */ = {isa = PBXBuildFile; fileRef = 4D36BA660CA2F00800A63CA5 /* peer-io.h */; }; - 4D36BA770CA2F00800A63CA5 /* peer-mgr.c in Sources */ = {isa = PBXBuildFile; fileRef = 4D36BA680CA2F00800A63CA5 /* peer-mgr.c */; }; + 4D36BA770CA2F00800A63CA5 /* peer-mgr.cc in Sources */ = {isa = PBXBuildFile; fileRef = 4D36BA680CA2F00800A63CA5 /* peer-mgr.cc */; }; 4D36BA780CA2F00800A63CA5 /* peer-mgr.h in Headers */ = {isa = PBXBuildFile; fileRef = 4D36BA690CA2F00800A63CA5 /* peer-mgr.h */; }; - 4D36BA790CA2F00800A63CA5 /* peer-msgs.c in Sources */ = {isa = PBXBuildFile; fileRef = 4D36BA6A0CA2F00800A63CA5 /* peer-msgs.c */; }; + 4D36BA790CA2F00800A63CA5 /* peer-msgs.cc in Sources */ = {isa = PBXBuildFile; fileRef = 4D36BA6A0CA2F00800A63CA5 /* peer-msgs.cc */; }; 4D36BA7A0CA2F00800A63CA5 /* peer-msgs.h in Headers */ = {isa = PBXBuildFile; fileRef = 4D36BA6B0CA2F00800A63CA5 /* peer-msgs.h */; }; 4D36BA7B0CA2F00800A63CA5 /* ptrarray.h in Headers */ = {isa = PBXBuildFile; fileRef = 4D36BA6C0CA2F00800A63CA5 /* ptrarray.h */; }; 4D3EA0AA08AE13C600EA10C2 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4D3EA0A908AE13C600EA10C2 /* IOKit.framework */; }; - 4D4ADFC70DA1631500A68297 /* blocklist.c in Sources */ = {isa = PBXBuildFile; fileRef = A2D3078E0D9EC45F0051FD27 /* blocklist.c */; }; - 4D8017EA10BBC073008A4AF2 /* torrent-magnet.c in Sources */ = {isa = PBXBuildFile; fileRef = 4D8017E810BBC073008A4AF2 /* torrent-magnet.c */; }; + 4D4ADFC70DA1631500A68297 /* blocklist.cc in Sources */ = {isa = PBXBuildFile; fileRef = A2D3078E0D9EC45F0051FD27 /* blocklist.cc */; }; + 4D8017EA10BBC073008A4AF2 /* torrent-magnet.cc in Sources */ = {isa = PBXBuildFile; fileRef = 4D8017E810BBC073008A4AF2 /* torrent-magnet.cc */; }; 4D8017EB10BBC073008A4AF2 /* torrent-magnet.h in Headers */ = {isa = PBXBuildFile; fileRef = 4D8017E910BBC073008A4AF2 /* torrent-magnet.h */; }; - 4D80185910BBC0B0008A4AF2 /* magnet.c in Sources */ = {isa = PBXBuildFile; fileRef = 4D80185710BBC0B0008A4AF2 /* magnet.c */; }; + 4D80185910BBC0B0008A4AF2 /* magnet.cc in Sources */ = {isa = PBXBuildFile; fileRef = 4D80185710BBC0B0008A4AF2 /* magnet.cc */; }; 4D80185A10BBC0B0008A4AF2 /* magnet.h in Headers */ = {isa = PBXBuildFile; fileRef = 4D80185810BBC0B0008A4AF2 /* magnet.h */; }; 4D9A2BF009E16D21002D0FF9 /* libtransmission.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4D18389709DEC0030047D688 /* libtransmission.a */; }; 4DB74F080E8CD75100AEB1A8 /* wildmat.c in Sources */ = {isa = PBXBuildFile; fileRef = 4DB74F070E8CD75100AEB1A8 /* wildmat.c */; }; @@ -48,7 +48,7 @@ 8D11072D0486CEB800E47090 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; settings = {ATTRIBUTES = (); }; }; 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; }; A200B9200A22798F007BBB1E /* InfoWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = A200B83A0A2263BA007BBB1E /* InfoWindowController.m */; }; - A201527E0D1C270F0081714F /* torrent-ctor.c in Sources */ = {isa = PBXBuildFile; fileRef = A20152790D1C26EB0081714F /* torrent-ctor.c */; }; + A201527E0D1C270F0081714F /* torrent-ctor.cc in Sources */ = {isa = PBXBuildFile; fileRef = A20152790D1C26EB0081714F /* torrent-ctor.cc */; }; A20162C913DE48BF00E15488 /* receivedata.c in Sources */ = {isa = PBXBuildFile; fileRef = A20162C713DE48BF00E15488 /* receivedata.c */; }; A20162CA13DE48BF00E15488 /* receivedata.h in Headers */ = {isa = PBXBuildFile; fileRef = A20162C813DE48BF00E15488 /* receivedata.h */; }; A20162CD13DE497000E15488 /* portlistingparse.c in Sources */ = {isa = PBXBuildFile; fileRef = A20162CB13DE497000E15488 /* portlistingparse.c */; }; @@ -86,7 +86,7 @@ A209EBF91142FEEE002B02D1 /* InfoOptionsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = A209EBF81142FEEE002B02D1 /* InfoOptionsViewController.m */; }; A209EC12114301C6002B02D1 /* InfoOptionsView.xib in Resources */ = {isa = PBXBuildFile; fileRef = A209EC11114301C6002B02D1 /* InfoOptionsView.xib */; }; A209ECA2114319C3002B02D1 /* InfoWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = A209ECA1114319C3002B02D1 /* InfoWindow.xib */; }; - A209EE5C1144B51E002B02D1 /* history.c in Sources */ = {isa = PBXBuildFile; fileRef = A209EE5A1144B51E002B02D1 /* history.c */; }; + A209EE5C1144B51E002B02D1 /* history.cc in Sources */ = {isa = PBXBuildFile; fileRef = A209EE5A1144B51E002B02D1 /* history.cc */; }; A209EE5D1144B51E002B02D1 /* history.h in Headers */ = {isa = PBXBuildFile; fileRef = A209EE5B1144B51E002B02D1 /* history.h */; }; A20BFFB70D091CC700CE5D2B /* ToolbarSegmentedCell.m in Sources */ = {isa = PBXBuildFile; fileRef = A20BFFB60D091CC700CE5D2B /* ToolbarSegmentedCell.m */; }; A21282A80CA6C66800EAEE0F /* StatusBarView.m in Sources */ = {isa = PBXBuildFile; fileRef = A21282A60CA6C66800EAEE0F /* StatusBarView.m */; }; @@ -97,9 +97,9 @@ A21F15AC11729A8B00CF5A9C /* AddMagnetWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = A21F15AA11729A8B00CF5A9C /* AddMagnetWindowController.m */; }; A21F15AD11729A9F00CF5A9C /* AddMagnetWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = A21F1538117299F100CF5A9C /* AddMagnetWindow.xib */; }; A21FBBAB0EDA78C300BC3C51 /* bandwidth.h in Headers */ = {isa = PBXBuildFile; fileRef = A21FBBA90EDA78C300BC3C51 /* bandwidth.h */; }; - A21FBBAC0EDA78C300BC3C51 /* bandwidth.c in Sources */ = {isa = PBXBuildFile; fileRef = A21FBBAA0EDA78C300BC3C51 /* bandwidth.c */; }; + A21FBBAC0EDA78C300BC3C51 /* bandwidth.cc in Sources */ = {isa = PBXBuildFile; fileRef = A21FBBAA0EDA78C300BC3C51 /* bandwidth.cc */; }; A220AF7B13D7CC460035C512 /* GlobalOptionsPopover.xib in Resources */ = {isa = PBXBuildFile; fileRef = A220AF7913D7CC460035C512 /* GlobalOptionsPopover.xib */; }; - A220EC5B118C8A060022B4BE /* tr-lpd.c in Sources */ = {isa = PBXBuildFile; fileRef = A220EC59118C8A060022B4BE /* tr-lpd.c */; }; + A220EC5B118C8A060022B4BE /* tr-lpd.cc in Sources */ = {isa = PBXBuildFile; fileRef = A220EC59118C8A060022B4BE /* tr-lpd.cc */; }; A220EC5C118C8A060022B4BE /* tr-lpd.h in Headers */ = {isa = PBXBuildFile; fileRef = A220EC5A118C8A060022B4BE /* tr-lpd.h */; }; A22180980D148A71007D09ED /* GroupsPrefsController.m in Sources */ = {isa = PBXBuildFile; fileRef = A22180970D148A71007D09ED /* GroupsPrefsController.m */; }; A221DCC8104B3660008A642D /* Quartz.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A221DCC7104B3660008A642D /* Quartz.framework */; }; @@ -121,7 +121,7 @@ A22B00B3116A9EA4003315FC /* connecthostport.c in Sources */ = {isa = PBXBuildFile; fileRef = A22B00AE116A9E90003315FC /* connecthostport.c */; }; A22BAE281388040500FB022F /* NSMutableArrayAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = A22BAE271388040500FB022F /* NSMutableArrayAdditions.m */; }; A22CFB820FB66EF30009BD3E /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A22CFB810FB66EF30009BD3E /* Carbon.framework */; }; - A22CFCA80FC24ED80009BD3E /* tr-dht.c in Sources */ = {isa = PBXBuildFile; fileRef = A22CFCA60FC24ED80009BD3E /* tr-dht.c */; }; + A22CFCA80FC24ED80009BD3E /* tr-dht.cc in Sources */ = {isa = PBXBuildFile; fileRef = A22CFCA60FC24ED80009BD3E /* tr-dht.cc */; }; A22CFCA90FC24ED80009BD3E /* tr-dht.h in Headers */ = {isa = PBXBuildFile; fileRef = A22CFCA70FC24ED80009BD3E /* tr-dht.h */; }; A22CFCC20FC24F890009BD3E /* dht.h in Headers */ = {isa = PBXBuildFile; fileRef = A22CFCC00FC24F890009BD3E /* dht.h */; }; A22CFCC30FC24F890009BD3E /* dht.c in Sources */ = {isa = PBXBuildFile; fileRef = A22CFCC10FC24F890009BD3E /* dht.c */; }; @@ -133,22 +133,22 @@ A233BD330D8C6585007EE7B4 /* MessageWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = A233BD320D8C6585007EE7B4 /* MessageWindow.xib */; }; A233BD690D8CF2C7007EE7B4 /* StatsWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = A233BD680D8CF2C7007EE7B4 /* StatsWindow.xib */; }; A234EA541453563B000F3E97 /* NSImageAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = A234EA531453563B000F3E97 /* NSImageAdditions.m */; }; - A23547E211CD0B090046EAE6 /* cache.c in Sources */ = {isa = PBXBuildFile; fileRef = A23547E011CD0B090046EAE6 /* cache.c */; }; + A23547E211CD0B090046EAE6 /* cache.cc in Sources */ = {isa = PBXBuildFile; fileRef = A23547E011CD0B090046EAE6 /* cache.cc */; }; A23547E311CD0B090046EAE6 /* cache.h in Headers */ = {isa = PBXBuildFile; fileRef = A23547E111CD0B090046EAE6 /* cache.h */; }; A2385DD40BFE06C800B24EF6 /* DragOverlayWindow.m in Sources */ = {isa = PBXBuildFile; fileRef = A2385DD20BFE06C800B24EF6 /* DragOverlayWindow.m */; }; A238D49F21CDA1A5006B03EA /* InfoTabMatrix.m in Sources */ = {isa = PBXBuildFile; fileRef = A238D49E21CDA1A5006B03EA /* InfoTabMatrix.m */; }; A23F29A1132A447400E9A83B /* announcer-common.h in Headers */ = {isa = PBXBuildFile; fileRef = A23F299F132A447400E9A83B /* announcer-common.h */; }; - A23F29A2132A447400E9A83B /* announcer-http.c in Sources */ = {isa = PBXBuildFile; fileRef = A23F29A0132A447400E9A83B /* announcer-http.c */; }; + A23F29A2132A447400E9A83B /* announcer-http.cc in Sources */ = {isa = PBXBuildFile; fileRef = A23F29A0132A447400E9A83B /* announcer-http.cc */; }; A23F4FF20D1D98AD002FCB97 /* PrefsWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = A23F4FF00D1D98AD002FCB97 /* PrefsWindow.xib */; }; A23F50020D1D99D7002FCB97 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = A23F50000D1D99D7002FCB97 /* MainMenu.xib */; }; A23F526F0F14395900AA02E3 /* PredicateEditorRowTemplateAny.m in Sources */ = {isa = PBXBuildFile; fileRef = A23F526E0F14395900AA02E3 /* PredicateEditorRowTemplateAny.m */; }; - A23FAE54178BC2950053DC5B /* platform-quota.c in Sources */ = {isa = PBXBuildFile; fileRef = A23FAE52178BC2950053DC5B /* platform-quota.c */; }; + A23FAE54178BC2950053DC5B /* platform-quota.cc in Sources */ = {isa = PBXBuildFile; fileRef = A23FAE52178BC2950053DC5B /* platform-quota.cc */; }; A23FAE55178BC2950053DC5B /* platform-quota.h in Headers */ = {isa = PBXBuildFile; fileRef = A23FAE53178BC2950053DC5B /* platform-quota.h */; }; A242AD9315F05D23002B3A6C /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = A242AD9115F05D23002B3A6C /* Localizable.strings */; }; A2451E6916ACE4EB00586E0E /* FileRenameSheetController.m in Sources */ = {isa = PBXBuildFile; fileRef = A2451E6716ACE4EB00586E0E /* FileRenameSheetController.m */; }; A2451E6A16ACE4EB00586E0E /* FileRenameSheetController.xib in Resources */ = {isa = PBXBuildFile; fileRef = A2451E6816ACE4EB00586E0E /* FileRenameSheetController.xib */; }; A24621410C769D0900088E81 /* trevent.h in Headers */ = {isa = PBXBuildFile; fileRef = A24621350C769CF400088E81 /* trevent.h */; }; - A24621420C769D0900088E81 /* trevent.c in Sources */ = {isa = PBXBuildFile; fileRef = A24621360C769CF400088E81 /* trevent.c */; }; + A24621420C769D0900088E81 /* trevent.cc in Sources */ = {isa = PBXBuildFile; fileRef = A24621360C769CF400088E81 /* trevent.cc */; }; A247A443114C701800547DFC /* InfoViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = A247A442114C701800547DFC /* InfoViewController.h */; }; A24F19080A3A790800C9C145 /* Sparkle.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A24F19070A3A790800C9C145 /* Sparkle.framework */; }; A24F19210A3A796800C9C145 /* Sparkle.framework in Copy Files */ = {isa = PBXBuildFile; fileRef = A24F19070A3A790800C9C145 /* Sparkle.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; @@ -158,25 +158,25 @@ A257C1820CAD3003004E121C /* PeerTableView.m in Sources */ = {isa = PBXBuildFile; fileRef = A257C1800CAD3003004E121C /* PeerTableView.m */; }; A25892640CF1F7E800CCCDDF /* StatsWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = A25892630CF1F7E800CCCDDF /* StatsWindowController.m */; }; A259317E0A73B2CC002F4FE7 /* TransmissionHelp in Resources */ = {isa = PBXBuildFile; fileRef = A259316A0A73B2CC002F4FE7 /* TransmissionHelp */; }; - A25964A6106D73A800453B31 /* announcer.c in Sources */ = {isa = PBXBuildFile; fileRef = A25964A4106D73A800453B31 /* announcer.c */; }; + A25964A6106D73A800453B31 /* announcer.cc in Sources */ = {isa = PBXBuildFile; fileRef = A25964A4106D73A800453B31 /* announcer.cc */; }; A25964A7106D73A800453B31 /* announcer.h in Headers */ = {isa = PBXBuildFile; fileRef = A25964A5106D73A800453B31 /* announcer.h */; }; A25BB02A12F4F517004B724E /* InfoTabButtonBack.m in Sources */ = {isa = PBXBuildFile; fileRef = A25BB02912F4F517004B724E /* InfoTabButtonBack.m */; }; - A25BFD69167BED3B0039D1AA /* variant-benc.c in Sources */ = {isa = PBXBuildFile; fileRef = A25BFD63167BED3B0039D1AA /* variant-benc.c */; }; + A25BFD69167BED3B0039D1AA /* variant-benc.cc in Sources */ = {isa = PBXBuildFile; fileRef = A25BFD63167BED3B0039D1AA /* variant-benc.cc */; }; A25BFD6A167BED3B0039D1AA /* variant-common.h in Headers */ = {isa = PBXBuildFile; fileRef = A25BFD64167BED3B0039D1AA /* variant-common.h */; }; - A25BFD6B167BED3B0039D1AA /* variant-json.c in Sources */ = {isa = PBXBuildFile; fileRef = A25BFD65167BED3B0039D1AA /* variant-json.c */; }; - A25BFD6D167BED3B0039D1AA /* variant.c in Sources */ = {isa = PBXBuildFile; fileRef = A25BFD67167BED3B0039D1AA /* variant.c */; }; + A25BFD6B167BED3B0039D1AA /* variant-json.cc in Sources */ = {isa = PBXBuildFile; fileRef = A25BFD65167BED3B0039D1AA /* variant-json.cc */; }; + A25BFD6D167BED3B0039D1AA /* variant.cc in Sources */ = {isa = PBXBuildFile; fileRef = A25BFD67167BED3B0039D1AA /* variant.cc */; }; A25BFD6E167BED3B0039D1AA /* variant.h in Headers */ = {isa = PBXBuildFile; fileRef = A25BFD68167BED3B0039D1AA /* variant.h */; }; - A25D2CBD0CF4C73E0096A262 /* stats.c in Sources */ = {isa = PBXBuildFile; fileRef = A25D2CBB0CF4C7190096A262 /* stats.c */; }; + A25D2CBD0CF4C73E0096A262 /* stats.cc in Sources */ = {isa = PBXBuildFile; fileRef = A25D2CBB0CF4C7190096A262 /* stats.cc */; }; A25D2CBE0CF4C73E0096A262 /* stats.h in Headers */ = {isa = PBXBuildFile; fileRef = A25D2CBA0CF4C7190096A262 /* stats.h */; }; A25E03D90E4015100086C225 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; }; A25E03E20E4015380086C225 /* tr-getopt.h in Headers */ = {isa = PBXBuildFile; fileRef = A25E03E00E4015380086C225 /* tr-getopt.h */; }; - A25E03E30E4015380086C225 /* tr-getopt.c in Sources */ = {isa = PBXBuildFile; fileRef = A25E03E10E4015380086C225 /* tr-getopt.c */; }; + A25E03E30E4015380086C225 /* tr-getopt.cc in Sources */ = {isa = PBXBuildFile; fileRef = A25E03E10E4015380086C225 /* tr-getopt.cc */; }; A25E74650AF5097C006F11AE /* ExpandedPathToPathTransformer.m in Sources */ = {isa = PBXBuildFile; fileRef = A25E74440AF5089E006F11AE /* ExpandedPathToPathTransformer.m */; }; A25E74660AF5097D006F11AE /* ExpandedPathToIconTransformer.m in Sources */ = {isa = PBXBuildFile; fileRef = A25E74460AF5089E006F11AE /* ExpandedPathToIconTransformer.m */; }; A263CFC010DD67670038DE27 /* InfoTextField.m in Sources */ = {isa = PBXBuildFile; fileRef = A263CFBF10DD67670038DE27 /* InfoTextField.m */; }; A2661D6112D0E8D9004F69D5 /* FilterBarView.m in Sources */ = {isa = PBXBuildFile; fileRef = A2661D3B12D0E51B004F69D5 /* FilterBarView.m */; }; A267927C130DFF2700CB7464 /* libutp.a in Frameworks */ = {isa = PBXBuildFile; fileRef = A2E38544130DFEE3001F501B /* libutp.a */; }; - A2679294130E00A000CB7464 /* tr-utp.c in Sources */ = {isa = PBXBuildFile; fileRef = A2679292130E00A000CB7464 /* tr-utp.c */; }; + A2679294130E00A000CB7464 /* tr-utp.cc in Sources */ = {isa = PBXBuildFile; fileRef = A2679292130E00A000CB7464 /* tr-utp.cc */; }; A2679295130E00A000CB7464 /* tr-utp.h in Headers */ = {isa = PBXBuildFile; fileRef = A2679293130E00A000CB7464 /* tr-utp.h */; }; A26AF21A0D2DA35A00FF7140 /* FileOutlineController.m in Sources */ = {isa = PBXBuildFile; fileRef = A26AF2190D2DA35A00FF7140 /* FileOutlineController.m */; }; A26AF27E0D2DBDDF00FF7140 /* AddWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = A26AF27C0D2DBDDF00FF7140 /* AddWindow.xib */; }; @@ -185,10 +185,10 @@ A2725B6E0DE5C4F5003445E7 /* FileListNode.m in Sources */ = {isa = PBXBuildFile; fileRef = A2725B6D0DE5C4F5003445E7 /* FileListNode.m */; }; A2725D5D0DE7507C003445E7 /* TrackerTableView.m in Sources */ = {isa = PBXBuildFile; fileRef = A2725D5C0DE7507C003445E7 /* TrackerTableView.m */; }; A27F0F330E19AD9800B2DB97 /* TorrentGroup.m in Sources */ = {isa = PBXBuildFile; fileRef = A27F0F320E19AD9800B2DB97 /* TorrentGroup.m */; }; - A284214412DA663E00FBDDBB /* tr-udp.c in Sources */ = {isa = PBXBuildFile; fileRef = A284214212DA663E00FBDDBB /* tr-udp.c */; }; + A284214412DA663E00FBDDBB /* tr-udp.cc in Sources */ = {isa = PBXBuildFile; fileRef = A284214212DA663E00FBDDBB /* tr-udp.cc */; }; A284214512DA663E00FBDDBB /* tr-udp.h in Headers */ = {isa = PBXBuildFile; fileRef = A284214312DA663E00FBDDBB /* tr-udp.h */; }; A28F4F770E085BDC003A3882 /* ColorTextField.m in Sources */ = {isa = PBXBuildFile; fileRef = A28F4F760E085BDC003A3882 /* ColorTextField.m */; }; - A292A6E80DFB45FC004B9C0A /* webseed.c in Sources */ = {isa = PBXBuildFile; fileRef = A292A6E50DFB45EC004B9C0A /* webseed.c */; }; + A292A6E80DFB45FC004B9C0A /* webseed.cc in Sources */ = {isa = PBXBuildFile; fileRef = A292A6E50DFB45EC004B9C0A /* webseed.cc */; }; A29304ED15D7465100B1F726 /* style.css in Resources */ = {isa = PBXBuildFile; fileRef = A29304EC15D7465100B1F726 /* style.css */; }; A29304EE15D7497C00B1F726 /* main.c in Sources */ = {isa = PBXBuildFile; fileRef = A2F35BCD15C5A0A100EBF632 /* main.c */; }; A29576030D11D63C0093B167 /* Creator.xib in Resources */ = {isa = PBXBuildFile; fileRef = A29576010D11D63C0093B167 /* Creator.xib */; }; @@ -200,31 +200,31 @@ A29B0C270BD15FEF0006F230 /* Credits.rtf in Resources */ = {isa = PBXBuildFile; fileRef = A2F8951E0A2D4BA500ED2127 /* Credits.rtf */; }; A29C8B370ACC6EB3000ED9F9 /* PortChecker.m in Sources */ = {isa = PBXBuildFile; fileRef = A29C8B350ACC6EB3000ED9F9 /* PortChecker.m */; }; A29D84041049C25600D1987A /* NSApplicationAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = A29D84031049C25600D1987A /* NSApplicationAdditions.m */; }; - A29DF8B90DB2544C00D04E5A /* resume.c in Sources */ = {isa = PBXBuildFile; fileRef = A29DF8B60DB2544C00D04E5A /* resume.c */; }; + A29DF8B90DB2544C00D04E5A /* resume.cc in Sources */ = {isa = PBXBuildFile; fileRef = A29DF8B60DB2544C00D04E5A /* resume.cc */; }; A29DF8BA0DB2544C00D04E5A /* resume.h in Headers */ = {isa = PBXBuildFile; fileRef = A29DF8B70DB2544C00D04E5A /* resume.h */; }; A29DF8BB0DB2544C00D04E5A /* torrent.h in Headers */ = {isa = PBXBuildFile; fileRef = A29DF8B80DB2544C00D04E5A /* torrent.h */; }; A29DF8BE0DB2545F00D04E5A /* verify.h in Headers */ = {isa = PBXBuildFile; fileRef = A2D22A110D65EED100007D5F /* verify.h */; }; A29E653613F1603100048D71 /* evutil_rand.c in Sources */ = {isa = PBXBuildFile; fileRef = A29E653513F1603100048D71 /* evutil_rand.c */; }; A2A1CB7A0BF29D5500AE959F /* PeerProgressIndicatorCell.m in Sources */ = {isa = PBXBuildFile; fileRef = A2A1CB780BF29D5500AE959F /* PeerProgressIndicatorCell.m */; }; A2A4E9210DE0F7E9000CE197 /* web.h in Headers */ = {isa = PBXBuildFile; fileRef = A29EBE530DC01FC9006CEE80 /* web.h */; }; - A2A4E9220DE0F7EB000CE197 /* web.c in Sources */ = {isa = PBXBuildFile; fileRef = A29EBE520DC01FC9006CEE80 /* web.c */; }; + A2A4E9220DE0F7EB000CE197 /* web.cc in Sources */ = {isa = PBXBuildFile; fileRef = A29EBE520DC01FC9006CEE80 /* web.cc */; }; A2A4EA0E0DE106EB000CE197 /* ConvertUTF.c in Sources */ = {isa = PBXBuildFile; fileRef = A2A4EA0A0DE106E8000CE197 /* ConvertUTF.c */; }; A2A4EA0F0DE106EE000CE197 /* ConvertUTF.h in Headers */ = {isa = PBXBuildFile; fileRef = A2A4EA0B0DE106E8000CE197 /* ConvertUTF.h */; }; A2A6321B0CD9751700E3DA60 /* BadgeView.m in Sources */ = {isa = PBXBuildFile; fileRef = A2A6321A0CD9751700E3DA60 /* BadgeView.m */; }; A2A7B32A164F87D400B98C65 /* jsonsl.c in Sources */ = {isa = PBXBuildFile; fileRef = A2A7B328164F87D400B98C65 /* jsonsl.c */; }; A2A7B32B164F87D400B98C65 /* jsonsl.h in Headers */ = {isa = PBXBuildFile; fileRef = A2A7B329164F87D400B98C65 /* jsonsl.h */; }; A2AA579D0ADFCAB400CA59F6 /* PiecesView.m in Sources */ = {isa = PBXBuildFile; fileRef = A2AA579B0ADFCAB400CA59F6 /* PiecesView.m */; }; - A2AA9BE1132CAC8E00FA131E /* announcer-udp.c in Sources */ = {isa = PBXBuildFile; fileRef = A2AA9BE0132CAC8D00FA131E /* announcer-udp.c */; }; + A2AA9BE1132CAC8E00FA131E /* announcer-udp.cc in Sources */ = {isa = PBXBuildFile; fileRef = A2AA9BE0132CAC8D00FA131E /* announcer-udp.cc */; }; A2AA9BE3132CAE2000FA131E /* evdns.c in Sources */ = {isa = PBXBuildFile; fileRef = A2AA9BE2132CAE2000FA131E /* evdns.c */; }; - A2AAB65C0DE0CF6200E04DDA /* rpc-server.c in Sources */ = {isa = PBXBuildFile; fileRef = A2AAB6580DE0CF6200E04DDA /* rpc-server.c */; }; + A2AAB65C0DE0CF6200E04DDA /* rpc-server.cc in Sources */ = {isa = PBXBuildFile; fileRef = A2AAB6580DE0CF6200E04DDA /* rpc-server.cc */; }; A2AAB65D0DE0CF6200E04DDA /* rpcimpl.h in Headers */ = {isa = PBXBuildFile; fileRef = A2AAB6590DE0CF6200E04DDA /* rpcimpl.h */; }; A2AAB65E0DE0CF6200E04DDA /* rpc-server.h in Headers */ = {isa = PBXBuildFile; fileRef = A2AAB65A0DE0CF6200E04DDA /* rpc-server.h */; }; - A2AAB65F0DE0CF6200E04DDA /* rpcimpl.c in Sources */ = {isa = PBXBuildFile; fileRef = A2AAB65B0DE0CF6200E04DDA /* rpcimpl.c */; }; + A2AAB65F0DE0CF6200E04DDA /* rpcimpl.cc in Sources */ = {isa = PBXBuildFile; fileRef = A2AAB65B0DE0CF6200E04DDA /* rpcimpl.cc */; }; A2AAB6650DE0D08B00E04DDA /* blocklist.h in Headers */ = {isa = PBXBuildFile; fileRef = A2D307930D9EC4860051FD27 /* blocklist.h */; }; A2AB76EA15D8130B009EFC95 /* libcurl.4.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = A2290D2D1442B23200B95A09 /* libcurl.4.dylib */; }; A2AB883E16A399A6008FAD50 /* VDKQueue.m in Sources */ = {isa = PBXBuildFile; fileRef = A2AB883C16A399A6008FAD50 /* VDKQueue.m */; }; A2AF1C390A3D0F6200F1575D /* FileOutlineView.m in Sources */ = {isa = PBXBuildFile; fileRef = A2AF1C370A3D0F6200F1575D /* FileOutlineView.m */; }; - A2AF23C816B44FA0003BC59E /* log.c in Sources */ = {isa = PBXBuildFile; fileRef = A2AF23C616B44FA0003BC59E /* log.c */; }; + A2AF23C816B44FA0003BC59E /* log.cc in Sources */ = {isa = PBXBuildFile; fileRef = A2AF23C616B44FA0003BC59E /* log.cc */; }; A2AF23C916B44FA0003BC59E /* log.h in Headers */ = {isa = PBXBuildFile; fileRef = A2AF23C716B44FA0003BC59E /* log.h */; }; A2B3FB460E5901E700FF78FB /* cli.c in Sources */ = {isa = PBXBuildFile; fileRef = A2B3FB450E5901E700FF78FB /* cli.c */; }; A2B3FB4C0E59023000FF78FB /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; }; @@ -234,11 +234,11 @@ A2B6141D1395B0E3000E0975 /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = A2B6141B1395ADE9000E0975 /* libz.dylib */; }; A2B6141E1395B0EC000E0975 /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = A2B6141B1395ADE9000E0975 /* libz.dylib */; }; A2B6141F1395B0F5000E0975 /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = A2B6141B1395ADE9000E0975 /* libz.dylib */; }; - A2BE9C520C1E4AF5002D16E6 /* makemeta.c in Sources */ = {isa = PBXBuildFile; fileRef = A2BE9C4E0C1E4ADA002D16E6 /* makemeta.c */; }; + A2BE9C520C1E4AF5002D16E6 /* makemeta.cc in Sources */ = {isa = PBXBuildFile; fileRef = A2BE9C4E0C1E4ADA002D16E6 /* makemeta.cc */; }; A2BE9C530C1E4AF7002D16E6 /* makemeta.h in Headers */ = {isa = PBXBuildFile; fileRef = A2BE9C4F0C1E4ADA002D16E6 /* makemeta.h */; }; A2C89D600CFCBF57004CC2BC /* ButtonToolbarItem.m in Sources */ = {isa = PBXBuildFile; fileRef = A2C89D5F0CFCBF57004CC2BC /* ButtonToolbarItem.m */; }; A2CB38AF0E1E6896002B514C /* COPYING in Resources */ = {isa = PBXBuildFile; fileRef = A2CB38AE0E1E6896002B514C /* COPYING */; }; - A2D22A130D65EEE700007D5F /* verify.c in Sources */ = {isa = PBXBuildFile; fileRef = A2D22A100D65EED100007D5F /* verify.c */; }; + A2D22A130D65EEE700007D5F /* verify.cc in Sources */ = {isa = PBXBuildFile; fileRef = A2D22A100D65EED100007D5F /* verify.cc */; }; A2D307A40D9EC6870051FD27 /* BlocklistDownloader.m in Sources */ = {isa = PBXBuildFile; fileRef = A2D307A30D9EC6870051FD27 /* BlocklistDownloader.m */; }; A2D307B10D9EC9F50051FD27 /* BlocklistStatusWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = A2D307B00D9EC9F50051FD27 /* BlocklistStatusWindow.xib */; }; A2D77451154CC25700A62B93 /* WebSeedTableView.h in Headers */ = {isa = PBXBuildFile; fileRef = A2D7744F154CC25700A62B93 /* WebSeedTableView.h */; }; @@ -261,7 +261,7 @@ A2E57B9C13109DC200A7DAB1 /* FilterBar.xib in Resources */ = {isa = PBXBuildFile; fileRef = A2E57B9B13109DC200A7DAB1 /* FilterBar.xib */; }; A2E57BA713109E6B00A7DAB1 /* FilterBarController.m in Sources */ = {isa = PBXBuildFile; fileRef = A2E57BA613109E6B00A7DAB1 /* FilterBarController.m */; }; A2E669790F5B8E5A00B4251A /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A2E669780F5B8E5A00B4251A /* Security.framework */; }; - A2EA52311686AC0D00180493 /* quark.c in Sources */ = {isa = PBXBuildFile; fileRef = A2EA522F1686AC0D00180493 /* quark.c */; }; + A2EA52311686AC0D00180493 /* quark.cc in Sources */ = {isa = PBXBuildFile; fileRef = A2EA522F1686AC0D00180493 /* quark.cc */; }; A2EA52321686AC0D00180493 /* quark.h in Headers */ = {isa = PBXBuildFile; fileRef = A2EA52301686AC0D00180493 /* quark.h */; }; A2EB2E7715C8CF2C00FBD5B4 /* QuickLookPlugin.qlgenerator in CopyFiles */ = {isa = PBXBuildFile; fileRef = A2F35BB915C5A0A100EBF632 /* QuickLookPlugin.qlgenerator */; }; A2ED7D8F0CEF431B00970975 /* FilterButton.m in Sources */ = {isa = PBXBuildFile; fileRef = A2ED7D8E0CEF431B00970975 /* FilterButton.m */; }; @@ -306,50 +306,50 @@ BEFC1D2D0C0783D900B0BB3C /* libtransmission.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4D18389709DEC0030047D688 /* libtransmission.a */; }; BEFC1E290C07861A00B0BB3C /* version.h in Headers */ = {isa = PBXBuildFile; fileRef = BEFC1DF00C07861A00B0BB3C /* version.h */; }; BEFC1E2A0C07861A00B0BB3C /* utils.h in Headers */ = {isa = PBXBuildFile; fileRef = BEFC1DF10C07861A00B0BB3C /* utils.h */; }; - BEFC1E2B0C07861A00B0BB3C /* utils.c in Sources */ = {isa = PBXBuildFile; fileRef = BEFC1DF20C07861A00B0BB3C /* utils.c */; }; + BEFC1E2B0C07861A00B0BB3C /* utils.cc in Sources */ = {isa = PBXBuildFile; fileRef = BEFC1DF20C07861A00B0BB3C /* utils.cc */; }; BEFC1E2C0C07861A00B0BB3C /* upnp.h in Headers */ = {isa = PBXBuildFile; fileRef = BEFC1DF30C07861A00B0BB3C /* upnp.h */; }; - BEFC1E2D0C07861A00B0BB3C /* upnp.c in Sources */ = {isa = PBXBuildFile; fileRef = BEFC1DF40C07861A00B0BB3C /* upnp.c */; }; - BEFC1E2F0C07861A00B0BB3C /* session.c in Sources */ = {isa = PBXBuildFile; fileRef = BEFC1DF60C07861A00B0BB3C /* session.c */; }; - BEFC1E320C07861A00B0BB3C /* torrent.c in Sources */ = {isa = PBXBuildFile; fileRef = BEFC1DF90C07861A00B0BB3C /* torrent.c */; }; + BEFC1E2D0C07861A00B0BB3C /* upnp.cc in Sources */ = {isa = PBXBuildFile; fileRef = BEFC1DF40C07861A00B0BB3C /* upnp.cc */; }; + BEFC1E2F0C07861A00B0BB3C /* session.cc in Sources */ = {isa = PBXBuildFile; fileRef = BEFC1DF60C07861A00B0BB3C /* session.cc */; }; + BEFC1E320C07861A00B0BB3C /* torrent.cc in Sources */ = {isa = PBXBuildFile; fileRef = BEFC1DF90C07861A00B0BB3C /* torrent.cc */; }; BEFC1E350C07861A00B0BB3C /* port-forwarding.h in Headers */ = {isa = PBXBuildFile; fileRef = BEFC1DFC0C07861A00B0BB3C /* port-forwarding.h */; }; - BEFC1E360C07861A00B0BB3C /* port-forwarding.c in Sources */ = {isa = PBXBuildFile; fileRef = BEFC1DFD0C07861A00B0BB3C /* port-forwarding.c */; }; + BEFC1E360C07861A00B0BB3C /* port-forwarding.cc in Sources */ = {isa = PBXBuildFile; fileRef = BEFC1DFD0C07861A00B0BB3C /* port-forwarding.cc */; }; BEFC1E3B0C07861A00B0BB3C /* platform.h in Headers */ = {isa = PBXBuildFile; fileRef = BEFC1E020C07861A00B0BB3C /* platform.h */; }; - BEFC1E3C0C07861A00B0BB3C /* platform.c in Sources */ = {isa = PBXBuildFile; fileRef = BEFC1E030C07861A00B0BB3C /* platform.c */; }; + BEFC1E3C0C07861A00B0BB3C /* platform.cc in Sources */ = {isa = PBXBuildFile; fileRef = BEFC1E030C07861A00B0BB3C /* platform.cc */; }; BEFC1E450C07861A00B0BB3C /* net.h in Headers */ = {isa = PBXBuildFile; fileRef = BEFC1E0C0C07861A00B0BB3C /* net.h */; }; - BEFC1E460C07861A00B0BB3C /* net.c in Sources */ = {isa = PBXBuildFile; fileRef = BEFC1E0D0C07861A00B0BB3C /* net.c */; }; - BEFC1E480C07861A00B0BB3C /* natpmp.c in Sources */ = {isa = PBXBuildFile; fileRef = BEFC1E0F0C07861A00B0BB3C /* natpmp.c */; }; + BEFC1E460C07861A00B0BB3C /* net.cc in Sources */ = {isa = PBXBuildFile; fileRef = BEFC1E0D0C07861A00B0BB3C /* net.cc */; }; + BEFC1E480C07861A00B0BB3C /* natpmp.cc in Sources */ = {isa = PBXBuildFile; fileRef = BEFC1E0F0C07861A00B0BB3C /* natpmp.cc */; }; BEFC1E490C07861A00B0BB3C /* metainfo.h in Headers */ = {isa = PBXBuildFile; fileRef = BEFC1E100C07861A00B0BB3C /* metainfo.h */; }; - BEFC1E4A0C07861A00B0BB3C /* metainfo.c in Sources */ = {isa = PBXBuildFile; fileRef = BEFC1E110C07861A00B0BB3C /* metainfo.c */; }; + BEFC1E4A0C07861A00B0BB3C /* metainfo.cc in Sources */ = {isa = PBXBuildFile; fileRef = BEFC1E110C07861A00B0BB3C /* metainfo.cc */; }; BEFC1E4D0C07861A00B0BB3C /* session.h in Headers */ = {isa = PBXBuildFile; fileRef = BEFC1E140C07861A00B0BB3C /* session.h */; }; BEFC1E4E0C07861A00B0BB3C /* inout.h in Headers */ = {isa = PBXBuildFile; fileRef = BEFC1E150C07861A00B0BB3C /* inout.h */; }; - BEFC1E4F0C07861A00B0BB3C /* inout.c in Sources */ = {isa = PBXBuildFile; fileRef = BEFC1E160C07861A00B0BB3C /* inout.c */; }; + BEFC1E4F0C07861A00B0BB3C /* inout.cc in Sources */ = {isa = PBXBuildFile; fileRef = BEFC1E160C07861A00B0BB3C /* inout.cc */; }; BEFC1E520C07861A00B0BB3C /* fdlimit.h in Headers */ = {isa = PBXBuildFile; fileRef = BEFC1E190C07861A00B0BB3C /* fdlimit.h */; }; - BEFC1E530C07861A00B0BB3C /* fdlimit.c in Sources */ = {isa = PBXBuildFile; fileRef = BEFC1E1A0C07861A00B0BB3C /* fdlimit.c */; }; + BEFC1E530C07861A00B0BB3C /* fdlimit.cc in Sources */ = {isa = PBXBuildFile; fileRef = BEFC1E1A0C07861A00B0BB3C /* fdlimit.cc */; }; BEFC1E550C07861A00B0BB3C /* completion.h in Headers */ = {isa = PBXBuildFile; fileRef = BEFC1E1C0C07861A00B0BB3C /* completion.h */; }; - BEFC1E560C07861A00B0BB3C /* completion.c in Sources */ = {isa = PBXBuildFile; fileRef = BEFC1E1D0C07861A00B0BB3C /* completion.c */; }; + BEFC1E560C07861A00B0BB3C /* completion.cc in Sources */ = {isa = PBXBuildFile; fileRef = BEFC1E1D0C07861A00B0BB3C /* completion.cc */; }; BEFC1E570C07861A00B0BB3C /* clients.h in Headers */ = {isa = PBXBuildFile; fileRef = BEFC1E1E0C07861A00B0BB3C /* clients.h */; }; - BEFC1E580C07861A00B0BB3C /* clients.c in Sources */ = {isa = PBXBuildFile; fileRef = BEFC1E1F0C07861A00B0BB3C /* clients.c */; }; - C1033E071A3279B800EF44D8 /* crypto-utils-fallback.c in Sources */ = {isa = PBXBuildFile; fileRef = C1033E031A3279B800EF44D8 /* crypto-utils-fallback.c */; }; - C1033E081A3279B800EF44D8 /* crypto-utils-openssl.c in Sources */ = {isa = PBXBuildFile; fileRef = C1033E041A3279B800EF44D8 /* crypto-utils-openssl.c */; }; - C1033E091A3279B800EF44D8 /* crypto-utils.c in Sources */ = {isa = PBXBuildFile; fileRef = C1033E051A3279B800EF44D8 /* crypto-utils.c */; }; + BEFC1E580C07861A00B0BB3C /* clients.cc in Sources */ = {isa = PBXBuildFile; fileRef = BEFC1E1F0C07861A00B0BB3C /* clients.cc */; }; + C1033E071A3279B800EF44D8 /* crypto-utils-fallback.cc in Sources */ = {isa = PBXBuildFile; fileRef = C1033E031A3279B800EF44D8 /* crypto-utils-fallback.cc */; }; + C1033E081A3279B800EF44D8 /* crypto-utils-openssl.cc in Sources */ = {isa = PBXBuildFile; fileRef = C1033E041A3279B800EF44D8 /* crypto-utils-openssl.cc */; }; + C1033E091A3279B800EF44D8 /* crypto-utils.cc in Sources */ = {isa = PBXBuildFile; fileRef = C1033E051A3279B800EF44D8 /* crypto-utils.cc */; }; C1033E0A1A3279B800EF44D8 /* crypto-utils.h in Headers */ = {isa = PBXBuildFile; fileRef = C1033E061A3279B800EF44D8 /* crypto-utils.h */; }; - C1077A4E183EB29600634C22 /* error.c in Sources */ = {isa = PBXBuildFile; fileRef = C1077A4A183EB29600634C22 /* error.c */; }; + C1077A4E183EB29600634C22 /* error.cc in Sources */ = {isa = PBXBuildFile; fileRef = C1077A4A183EB29600634C22 /* error.cc */; }; C1077A4F183EB29600634C22 /* error.h in Headers */ = {isa = PBXBuildFile; fileRef = C1077A4B183EB29600634C22 /* error.h */; }; - C1077A50183EB29600634C22 /* file-posix.c in Sources */ = {isa = PBXBuildFile; fileRef = C1077A4C183EB29600634C22 /* file-posix.c */; }; + C1077A50183EB29600634C22 /* file-posix.cc in Sources */ = {isa = PBXBuildFile; fileRef = C1077A4C183EB29600634C22 /* file-posix.cc */; }; C1077A51183EB29600634C22 /* file.h in Headers */ = {isa = PBXBuildFile; fileRef = C1077A4D183EB29600634C22 /* file.h */; }; - C10C644D1D9AF328003C1B4C /* session-id.c in Sources */ = {isa = PBXBuildFile; fileRef = C10C644B1D9AF328003C1B4C /* session-id.c */; }; + C10C644D1D9AF328003C1B4C /* session-id.cc in Sources */ = {isa = PBXBuildFile; fileRef = C10C644B1D9AF328003C1B4C /* session-id.cc */; }; C10C644E1D9AF328003C1B4C /* session-id.h in Headers */ = {isa = PBXBuildFile; fileRef = C10C644C1D9AF328003C1B4C /* session-id.h */; }; - C11DEA161FCD31C0009E22B9 /* subprocess-posix.c in Sources */ = {isa = PBXBuildFile; fileRef = C11DEA141FCD31C0009E22B9 /* subprocess-posix.c */; }; + C11DEA161FCD31C0009E22B9 /* subprocess-posix.cc in Sources */ = {isa = PBXBuildFile; fileRef = C11DEA141FCD31C0009E22B9 /* subprocess-posix.cc */; }; C11DEA171FCD31C0009E22B9 /* subprocess.h in Headers */ = {isa = PBXBuildFile; fileRef = C11DEA151FCD31C0009E22B9 /* subprocess.h */; }; C12F19791E1AE3C30005E93F /* upnperrors.c in Sources */ = {isa = PBXBuildFile; fileRef = C12F19771E1AE3C30005E93F /* upnperrors.c */; }; C12F197B1E1AE4460005E93F /* upnperrors.h in Headers */ = {isa = PBXBuildFile; fileRef = C12F197A1E1AE4460005E93F /* upnperrors.h */; }; - C1305EBE186A13B100F03351 /* file.c in Sources */ = {isa = PBXBuildFile; fileRef = C1305EB8186A134000F03351 /* file.c */; }; + C1305EBE186A13B100F03351 /* file.cc in Sources */ = {isa = PBXBuildFile; fileRef = C1305EB8186A134000F03351 /* file.cc */; }; C139E3B122BE70FB0007870C /* libssl.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = C139E3B022BE70FA0007870C /* libssl.dylib */; }; C139E3B222BE71030007870C /* libssl.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = C139E3B022BE70FA0007870C /* libssl.dylib */; }; C139E3B322BE71180007870C /* libssl.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = C139E3B022BE70FA0007870C /* libssl.dylib */; }; C139E3B422BE71250007870C /* libssl.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = C139E3B022BE70FA0007870C /* libssl.dylib */; }; C139E3B522BE712C0007870C /* libssl.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = C139E3B022BE70FA0007870C /* libssl.dylib */; }; - C1425B351EE9C5F5001DB85F /* tr-assert.c in Sources */ = {isa = PBXBuildFile; fileRef = C1425B321EE9C5EA001DB85F /* tr-assert.c */; }; + C1425B351EE9C5F5001DB85F /* tr-assert.cc in Sources */ = {isa = PBXBuildFile; fileRef = C1425B321EE9C5EA001DB85F /* tr-assert.cc */; }; C1425B361EE9C605001DB85F /* tr-assert.h in Headers */ = {isa = PBXBuildFile; fileRef = C1425B331EE9C5EA001DB85F /* tr-assert.h */; }; C1425B371EE9C705001DB85F /* tr-macros.h in Headers */ = {isa = PBXBuildFile; fileRef = C1425B341EE9C5EA001DB85F /* tr-macros.h */; }; C1425B381EE9C805001DB85F /* peer-socket.h in Headers */ = {isa = PBXBuildFile; fileRef = C1425B351EE9C5EA001DB85F /* peer-socket.h */; }; @@ -365,13 +365,13 @@ C1BF7BAA1F2A3CCE008E88A7 /* upnpdev.h in Headers */ = {isa = PBXBuildFile; fileRef = C1BF7BA91F2A3CCE008E88A7 /* upnpdev.h */; }; C1F690FD1AD0627500D95CF0 /* daemon-posix.c in Sources */ = {isa = PBXBuildFile; fileRef = C1F690FC1AD0627500D95CF0 /* daemon-posix.c */; }; C1FEE5771C3223CC00D62832 /* watchdir-common.h in Headers */ = {isa = PBXBuildFile; fileRef = C1FEE5721C3223CC00D62832 /* watchdir-common.h */; }; - C1FEE5781C3223CC00D62832 /* watchdir-generic.c in Sources */ = {isa = PBXBuildFile; fileRef = C1FEE5731C3223CC00D62832 /* watchdir-generic.c */; }; - C1FEE5791C3223CC00D62832 /* watchdir-kqueue.c in Sources */ = {isa = PBXBuildFile; fileRef = C1FEE5741C3223CC00D62832 /* watchdir-kqueue.c */; }; - C1FEE57A1C3223CC00D62832 /* watchdir.c in Sources */ = {isa = PBXBuildFile; fileRef = C1FEE5751C3223CC00D62832 /* watchdir.c */; }; + C1FEE5781C3223CC00D62832 /* watchdir-generic.cc in Sources */ = {isa = PBXBuildFile; fileRef = C1FEE5731C3223CC00D62832 /* watchdir-generic.cc */; }; + C1FEE5791C3223CC00D62832 /* watchdir-kqueue.cc in Sources */ = {isa = PBXBuildFile; fileRef = C1FEE5741C3223CC00D62832 /* watchdir-kqueue.cc */; }; + C1FEE57A1C3223CC00D62832 /* watchdir.cc in Sources */ = {isa = PBXBuildFile; fileRef = C1FEE5751C3223CC00D62832 /* watchdir.cc */; }; C1FEE57B1C3223CC00D62832 /* watchdir.h in Headers */ = {isa = PBXBuildFile; fileRef = C1FEE5761C3223CC00D62832 /* watchdir.h */; }; CAB35C64252F6F5E00552A55 /* mime-types.h in Headers */ = {isa = PBXBuildFile; fileRef = CAB35C62252F6F5E00552A55 /* mime-types.h */; }; - CAB35C65252F6F5E00552A55 /* mime-types.c in Sources */ = {isa = PBXBuildFile; fileRef = CAB35C63252F6F5E00552A55 /* mime-types.c */; }; - D4AF3B2F0C41F7A500D46B6B /* list.c in Sources */ = {isa = PBXBuildFile; fileRef = D4AF3B2D0C41F7A500D46B6B /* list.c */; }; + CAB35C65252F6F5E00552A55 /* mime-types.cc in Sources */ = {isa = PBXBuildFile; fileRef = CAB35C63252F6F5E00552A55 /* mime-types.cc */; }; + D4AF3B2F0C41F7A500D46B6B /* list.cc in Sources */ = {isa = PBXBuildFile; fileRef = D4AF3B2D0C41F7A500D46B6B /* list.cc */; }; D4AF3B300C41F7A600D46B6B /* list.h in Headers */ = {isa = PBXBuildFile; fileRef = D4AF3B2E0C41F7A500D46B6B /* list.h */; }; E138A9780C04D88F00C5426C /* ProgressGradients.m in Sources */ = {isa = PBXBuildFile; fileRef = E138A9760C04D88F00C5426C /* ProgressGradients.m */; }; EDBDFA9E25AFCCA60093D9C1 /* evutil_time.c in Sources */ = {isa = PBXBuildFile; fileRef = EDBDFA9D25AFCCA60093D9C1 /* evutil_time.c */; }; @@ -497,7 +497,7 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ - 0A6169A50FE5C9A200C66CE6 /* bitfield.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = bitfield.c; sourceTree = ""; }; + 0A6169A50FE5C9A200C66CE6 /* bitfield.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = bitfield.cc; sourceTree = ""; }; 0A6169A60FE5C9A200C66CE6 /* bitfield.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = bitfield.h; sourceTree = ""; }; 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; }; 13E42FB307B3F0F600E4EEF1 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = System/Library/Frameworks/CoreData.framework; sourceTree = SDKROOT; }; @@ -512,28 +512,28 @@ 3C7A11920D0B2EE300B5701F /* getgateway.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = getgateway.h; sourceTree = ""; }; 3C7A11930D0B2EE300B5701F /* natpmp.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = natpmp.c; sourceTree = ""; }; 3C7A11940D0B2EE300B5701F /* natpmp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = natpmp.h; sourceTree = ""; }; - 4394AC640C74FB6000F367E8 /* ptrarray.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = ptrarray.c; sourceTree = ""; }; + 4394AC640C74FB6000F367E8 /* ptrarray.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = ptrarray.cc; sourceTree = ""; }; 4D043A7E090AE979009FEDA8 /* TransmissionDocument.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; name = TransmissionDocument.icns; path = Images/TransmissionDocument.icns; sourceTree = ""; }; 4D118E1808CB46B20033958F /* PrefsController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PrefsController.h; sourceTree = ""; }; 4D118E1908CB46B20033958F /* PrefsController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PrefsController.m; sourceTree = ""; }; 4D18389709DEC0030047D688 /* libtransmission.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libtransmission.a; sourceTree = BUILT_PRODUCTS_DIR; }; 4D364D9E091FBB2C00377D12 /* TorrentTableView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TorrentTableView.h; sourceTree = ""; }; 4D364D9F091FBB2C00377D12 /* TorrentTableView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = TorrentTableView.m; sourceTree = ""; }; - 4D36BA600CA2F00800A63CA5 /* crypto.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = crypto.c; sourceTree = ""; }; + 4D36BA600CA2F00800A63CA5 /* crypto.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = crypto.cc; sourceTree = ""; }; 4D36BA610CA2F00800A63CA5 /* crypto.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = crypto.h; sourceTree = ""; }; - 4D36BA630CA2F00800A63CA5 /* handshake.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = handshake.c; sourceTree = ""; }; + 4D36BA630CA2F00800A63CA5 /* handshake.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = handshake.cc; sourceTree = ""; }; 4D36BA640CA2F00800A63CA5 /* handshake.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = handshake.h; sourceTree = ""; }; - 4D36BA650CA2F00800A63CA5 /* peer-io.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = "peer-io.c"; sourceTree = ""; }; + 4D36BA650CA2F00800A63CA5 /* peer-io.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = "peer-io.cc"; sourceTree = ""; }; 4D36BA660CA2F00800A63CA5 /* peer-io.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "peer-io.h"; sourceTree = ""; }; - 4D36BA680CA2F00800A63CA5 /* peer-mgr.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = "peer-mgr.c"; sourceTree = ""; }; + 4D36BA680CA2F00800A63CA5 /* peer-mgr.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = "peer-mgr.cc"; sourceTree = ""; }; 4D36BA690CA2F00800A63CA5 /* peer-mgr.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "peer-mgr.h"; sourceTree = ""; }; - 4D36BA6A0CA2F00800A63CA5 /* peer-msgs.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = "peer-msgs.c"; sourceTree = ""; }; + 4D36BA6A0CA2F00800A63CA5 /* peer-msgs.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = "peer-msgs.cc"; sourceTree = ""; }; 4D36BA6B0CA2F00800A63CA5 /* peer-msgs.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "peer-msgs.h"; sourceTree = ""; }; 4D36BA6C0CA2F00800A63CA5 /* ptrarray.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ptrarray.h; sourceTree = ""; }; 4D3EA0A908AE13C600EA10C2 /* IOKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOKit.framework; path = System/Library/Frameworks/IOKit.framework; sourceTree = SDKROOT; }; - 4D8017E810BBC073008A4AF2 /* torrent-magnet.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = "torrent-magnet.c"; sourceTree = ""; }; + 4D8017E810BBC073008A4AF2 /* torrent-magnet.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = "torrent-magnet.cc"; sourceTree = ""; }; 4D8017E910BBC073008A4AF2 /* torrent-magnet.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "torrent-magnet.h"; sourceTree = ""; }; - 4D80185710BBC0B0008A4AF2 /* magnet.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = magnet.c; sourceTree = ""; }; + 4D80185710BBC0B0008A4AF2 /* magnet.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = magnet.cc; sourceTree = ""; }; 4D80185810BBC0B0008A4AF2 /* magnet.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = magnet.h; sourceTree = ""; }; 4DB74F070E8CD75100AEB1A8 /* wildmat.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wildmat.c; sourceTree = ""; }; 4DCCBB3C09C3D71100D3CABF /* TorrentCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = TorrentCell.m; sourceTree = ""; }; @@ -552,7 +552,7 @@ 8D1107320486CEB800E47090 /* Transmission.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Transmission.app; sourceTree = BUILT_PRODUCTS_DIR; }; A200B8390A2263BA007BBB1E /* InfoWindowController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = InfoWindowController.h; sourceTree = ""; }; A200B83A0A2263BA007BBB1E /* InfoWindowController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = InfoWindowController.m; sourceTree = ""; }; - A20152790D1C26EB0081714F /* torrent-ctor.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = "torrent-ctor.c"; sourceTree = ""; }; + A20152790D1C26EB0081714F /* torrent-ctor.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = "torrent-ctor.cc"; sourceTree = ""; }; A20162C713DE48BF00E15488 /* receivedata.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = receivedata.c; sourceTree = ""; }; A20162C813DE48BF00E15488 /* receivedata.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = receivedata.h; sourceTree = ""; }; A20162CB13DE497000E15488 /* portlistingparse.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = portlistingparse.c; sourceTree = ""; }; @@ -602,7 +602,7 @@ A209EBF81142FEEE002B02D1 /* InfoOptionsViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = InfoOptionsViewController.m; sourceTree = ""; }; A209EC13114301C6002B02D1 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/InfoOptionsView.xib; sourceTree = ""; }; A209ECA1114319C3002B02D1 /* InfoWindow.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = InfoWindow.xib; sourceTree = ""; }; - A209EE5A1144B51E002B02D1 /* history.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = history.c; sourceTree = ""; }; + A209EE5A1144B51E002B02D1 /* history.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = history.cc; sourceTree = ""; }; A209EE5B1144B51E002B02D1 /* history.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = history.h; sourceTree = ""; }; A20BFFB50D091CC700CE5D2B /* ToolbarSegmentedCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ToolbarSegmentedCell.h; sourceTree = ""; }; A20BFFB60D091CC700CE5D2B /* ToolbarSegmentedCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ToolbarSegmentedCell.m; sourceTree = ""; }; @@ -619,9 +619,9 @@ A21F15AA11729A8B00CF5A9C /* AddMagnetWindowController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AddMagnetWindowController.m; sourceTree = ""; }; A21F15AB11729A8B00CF5A9C /* AddMagnetWindowController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AddMagnetWindowController.h; sourceTree = ""; }; A21FBBA90EDA78C300BC3C51 /* bandwidth.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = bandwidth.h; sourceTree = ""; }; - A21FBBAA0EDA78C300BC3C51 /* bandwidth.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = bandwidth.c; sourceTree = ""; }; + A21FBBAA0EDA78C300BC3C51 /* bandwidth.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = bandwidth.cc; sourceTree = ""; }; A220AF7A13D7CC460035C512 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/GlobalOptionsPopover.xib; sourceTree = ""; }; - A220EC59118C8A060022B4BE /* tr-lpd.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = "tr-lpd.c"; sourceTree = ""; }; + A220EC59118C8A060022B4BE /* tr-lpd.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = "tr-lpd.cc"; sourceTree = ""; }; A220EC5A118C8A060022B4BE /* tr-lpd.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "tr-lpd.h"; sourceTree = ""; }; A220EE6611A8382C0022B4BE /* de */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = de; path = de.lproj/AddMagnetWindow.xib; sourceTree = ""; }; A220EE6911A838450022B4BE /* de */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = de; path = de.lproj/InfoActivityView.xib; sourceTree = ""; }; @@ -668,7 +668,7 @@ A22CF7CC0FA5E2DB0009BD3E /* nl */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = nl; path = nl.lproj/GroupRules.xib; sourceTree = ""; }; A22CF7D10FA6A19B0009BD3E /* ru */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = ru; path = ru.lproj/GroupRules.xib; sourceTree = ""; }; A22CFB810FB66EF30009BD3E /* Carbon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Carbon.framework; path = System/Library/Frameworks/Carbon.framework; sourceTree = SDKROOT; }; - A22CFCA60FC24ED80009BD3E /* tr-dht.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = "tr-dht.c"; sourceTree = ""; }; + A22CFCA60FC24ED80009BD3E /* tr-dht.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = "tr-dht.cc"; sourceTree = ""; }; A22CFCA70FC24ED80009BD3E /* tr-dht.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "tr-dht.h"; sourceTree = ""; }; A22CFCBA0FC24F710009BD3E /* libdht.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libdht.a; sourceTree = BUILT_PRODUCTS_DIR; }; A22CFCC00FC24F890009BD3E /* dht.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = dht.h; sourceTree = ""; }; @@ -681,7 +681,7 @@ A233BD680D8CF2C7007EE7B4 /* StatsWindow.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = StatsWindow.xib; sourceTree = ""; }; A234EA521453563B000F3E97 /* NSImageAdditions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NSImageAdditions.h; sourceTree = ""; }; A234EA531453563B000F3E97 /* NSImageAdditions.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = NSImageAdditions.m; sourceTree = ""; }; - A23547E011CD0B090046EAE6 /* cache.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = cache.c; sourceTree = ""; }; + A23547E011CD0B090046EAE6 /* cache.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = cache.cc; sourceTree = ""; }; A23547E111CD0B090046EAE6 /* cache.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cache.h; sourceTree = ""; }; A236D19215F6BB54000C3DD4 /* es */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = es; path = es.lproj/Localizable.strings; sourceTree = ""; }; A236D19415F6BCB2000C3DD4 /* da */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = da; path = da.lproj/Localizable.strings; sourceTree = ""; }; @@ -691,17 +691,17 @@ A238D49D21CDA1A5006B03EA /* InfoTabMatrix.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = InfoTabMatrix.h; sourceTree = ""; }; A238D49E21CDA1A5006B03EA /* InfoTabMatrix.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = InfoTabMatrix.m; sourceTree = ""; }; A23F299F132A447400E9A83B /* announcer-common.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "announcer-common.h"; sourceTree = ""; }; - A23F29A0132A447400E9A83B /* announcer-http.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = "announcer-http.c"; sourceTree = ""; }; + A23F29A0132A447400E9A83B /* announcer-http.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = "announcer-http.cc"; sourceTree = ""; }; A23F526D0F14395900AA02E3 /* PredicateEditorRowTemplateAny.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PredicateEditorRowTemplateAny.h; sourceTree = ""; }; A23F526E0F14395900AA02E3 /* PredicateEditorRowTemplateAny.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PredicateEditorRowTemplateAny.m; sourceTree = ""; }; - A23FAE52178BC2950053DC5B /* platform-quota.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = "platform-quota.c"; sourceTree = ""; }; + A23FAE52178BC2950053DC5B /* platform-quota.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = "platform-quota.cc"; sourceTree = ""; }; A23FAE53178BC2950053DC5B /* platform-quota.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "platform-quota.h"; sourceTree = ""; }; A242AD9215F05D23002B3A6C /* en */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = ""; }; A2451E6616ACE4EB00586E0E /* FileRenameSheetController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FileRenameSheetController.h; sourceTree = ""; }; A2451E6716ACE4EB00586E0E /* FileRenameSheetController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FileRenameSheetController.m; sourceTree = ""; }; A2451E6816ACE4EB00586E0E /* FileRenameSheetController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = FileRenameSheetController.xib; sourceTree = ""; }; A24621350C769CF400088E81 /* trevent.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = trevent.h; sourceTree = ""; }; - A24621360C769CF400088E81 /* trevent.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = trevent.c; sourceTree = ""; }; + A24621360C769CF400088E81 /* trevent.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = trevent.cc; sourceTree = ""; }; A247A442114C701800547DFC /* InfoViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = InfoViewController.h; sourceTree = ""; }; A24F19070A3A790800C9C145 /* Sparkle.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Sparkle.framework; sourceTree = ""; }; A250EE800E2ED87B00A688E6 /* web */ = {isa = PBXFileReference; lastKnownFileType = folder; name = web; path = ../web; sourceTree = ""; }; @@ -713,19 +713,19 @@ A25892620CF1F7E800CCCDDF /* StatsWindowController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = StatsWindowController.h; sourceTree = ""; }; A25892630CF1F7E800CCCDDF /* StatsWindowController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = StatsWindowController.m; sourceTree = ""; }; A259316A0A73B2CC002F4FE7 /* TransmissionHelp */ = {isa = PBXFileReference; lastKnownFileType = folder; path = TransmissionHelp; sourceTree = ""; }; - A25964A4106D73A800453B31 /* announcer.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = announcer.c; sourceTree = ""; }; + A25964A4106D73A800453B31 /* announcer.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = announcer.cc; sourceTree = ""; }; A25964A5106D73A800453B31 /* announcer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = announcer.h; sourceTree = ""; }; A25BB02812F4F517004B724E /* InfoTabButtonBack.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = InfoTabButtonBack.h; sourceTree = ""; }; A25BB02912F4F517004B724E /* InfoTabButtonBack.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = InfoTabButtonBack.m; sourceTree = ""; }; - A25BFD63167BED3B0039D1AA /* variant-benc.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = "variant-benc.c"; sourceTree = ""; }; + A25BFD63167BED3B0039D1AA /* variant-benc.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = "variant-benc.cc"; sourceTree = ""; }; A25BFD64167BED3B0039D1AA /* variant-common.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "variant-common.h"; sourceTree = ""; }; - A25BFD65167BED3B0039D1AA /* variant-json.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = "variant-json.c"; sourceTree = ""; }; - A25BFD67167BED3B0039D1AA /* variant.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = variant.c; sourceTree = ""; }; + A25BFD65167BED3B0039D1AA /* variant-json.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = "variant-json.cc"; sourceTree = ""; }; + A25BFD67167BED3B0039D1AA /* variant.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = variant.cc; sourceTree = ""; }; A25BFD68167BED3B0039D1AA /* variant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = variant.h; sourceTree = ""; }; A25D2CBA0CF4C7190096A262 /* stats.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = stats.h; sourceTree = ""; }; - A25D2CBB0CF4C7190096A262 /* stats.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = stats.c; sourceTree = ""; }; + A25D2CBB0CF4C7190096A262 /* stats.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = stats.cc; sourceTree = ""; }; A25E03E00E4015380086C225 /* tr-getopt.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "tr-getopt.h"; sourceTree = ""; }; - A25E03E10E4015380086C225 /* tr-getopt.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = "tr-getopt.c"; sourceTree = ""; }; + A25E03E10E4015380086C225 /* tr-getopt.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = "tr-getopt.cc"; sourceTree = ""; }; A25E74440AF5089E006F11AE /* ExpandedPathToPathTransformer.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ExpandedPathToPathTransformer.m; sourceTree = ""; }; A25E74450AF5089E006F11AE /* ExpandedPathToPathTransformer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ExpandedPathToPathTransformer.h; sourceTree = ""; }; A25E74460AF5089E006F11AE /* ExpandedPathToIconTransformer.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ExpandedPathToIconTransformer.m; sourceTree = ""; }; @@ -763,7 +763,7 @@ A265A3C20D25AE7800198AC8 /* es */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = es; path = es.lproj/PrefsWindow.xib; sourceTree = ""; }; A2661D3A12D0E51A004F69D5 /* FilterBarView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FilterBarView.h; sourceTree = ""; }; A2661D3B12D0E51B004F69D5 /* FilterBarView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FilterBarView.m; sourceTree = ""; }; - A2679292130E00A000CB7464 /* tr-utp.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = "tr-utp.c"; sourceTree = ""; }; + A2679292130E00A000CB7464 /* tr-utp.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = "tr-utp.cc"; sourceTree = ""; }; A2679293130E00A000CB7464 /* tr-utp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "tr-utp.h"; sourceTree = ""; }; A26AF1040D2855FC00FF7140 /* ru */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = ru; path = ru.lproj/Creator.xib; sourceTree = ""; }; A26AF1050D2855FC00FF7140 /* ru */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = ru; path = ru.lproj/InfoPlist.strings; sourceTree = ""; }; @@ -797,7 +797,7 @@ A28393FF10D54A96005C0240 /* de */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = de; path = de.lproj/Localizable.strings; sourceTree = ""; }; A283940010D54A9D005C0240 /* de */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = de; path = de.lproj/MainMenu.xib; sourceTree = ""; }; A283940110D54AA7005C0240 /* de */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = de; path = de.lproj/PrefsWindow.xib; sourceTree = ""; }; - A284214212DA663E00FBDDBB /* tr-udp.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = "tr-udp.c"; sourceTree = ""; }; + A284214212DA663E00FBDDBB /* tr-udp.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = "tr-udp.cc"; sourceTree = ""; }; A284214312DA663E00FBDDBB /* tr-udp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "tr-udp.h"; sourceTree = ""; }; A28B3A2D160E1BC900D4A2BC /* pt_PT */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = pt_PT; path = pt_PT.lproj/Localizable.strings; sourceTree = ""; }; A28E1DDF0CFFD8EC00E16385 /* ButtonToolbarItem.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ButtonToolbarItem.h; sourceTree = ""; }; @@ -810,7 +810,7 @@ A29147800E195A0C00F60CB2 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/MainMenu.xib; sourceTree = ""; }; A29147810E195A0C00F60CB2 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/PrefsWindow.xib; sourceTree = ""; }; A292A6E40DFB45E5004B9C0A /* peer-common.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "peer-common.h"; sourceTree = ""; }; - A292A6E50DFB45EC004B9C0A /* webseed.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = webseed.c; sourceTree = ""; }; + A292A6E50DFB45EC004B9C0A /* webseed.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = webseed.cc; sourceTree = ""; }; A292A6E60DFB45EC004B9C0A /* webseed.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = webseed.h; sourceTree = ""; }; A292C9E01413BA5F00EF710F /* es */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = es; path = es.lproj/GlobalOptionsPopover.xib; sourceTree = ""; }; A292C9E2141593DA00EF710F /* de */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = de; path = de.lproj/GlobalOptionsPopover.xib; sourceTree = ""; }; @@ -826,11 +826,11 @@ A29C8B350ACC6EB3000ED9F9 /* PortChecker.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PortChecker.m; sourceTree = ""; }; A29D84021049C25600D1987A /* NSApplicationAdditions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NSApplicationAdditions.h; sourceTree = ""; }; A29D84031049C25600D1987A /* NSApplicationAdditions.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = NSApplicationAdditions.m; sourceTree = ""; }; - A29DF8B60DB2544C00D04E5A /* resume.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = resume.c; sourceTree = ""; }; + A29DF8B60DB2544C00D04E5A /* resume.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = resume.cc; sourceTree = ""; }; A29DF8B70DB2544C00D04E5A /* resume.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = resume.h; sourceTree = ""; }; A29DF8B80DB2544C00D04E5A /* torrent.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = torrent.h; sourceTree = ""; }; A29E653513F1603100048D71 /* evutil_rand.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = evutil_rand.c; sourceTree = ""; }; - A29EBE520DC01FC9006CEE80 /* web.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = web.c; sourceTree = ""; }; + A29EBE520DC01FC9006CEE80 /* web.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = web.cc; sourceTree = ""; }; A29EBE530DC01FC9006CEE80 /* web.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = web.h; sourceTree = ""; }; A2A1C81D142EC032008C17BF /* nl */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = nl; path = nl.lproj/GlobalOptionsPopover.xib; sourceTree = ""; }; A2A1CB770BF29D5500AE959F /* PeerProgressIndicatorCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PeerProgressIndicatorCell.h; sourceTree = ""; }; @@ -856,18 +856,18 @@ A2A9D124187DD75C00C52A1F /* tr */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = tr; path = tr.lproj/GlobalOptionsPopover.xib; sourceTree = ""; }; A2AA579A0ADFCAB400CA59F6 /* PiecesView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PiecesView.h; sourceTree = ""; }; A2AA579B0ADFCAB400CA59F6 /* PiecesView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PiecesView.m; sourceTree = ""; }; - A2AA9BE0132CAC8D00FA131E /* announcer-udp.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = "announcer-udp.c"; sourceTree = ""; }; + A2AA9BE0132CAC8D00FA131E /* announcer-udp.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = "announcer-udp.cc"; sourceTree = ""; }; A2AA9BE2132CAE2000FA131E /* evdns.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = evdns.c; sourceTree = ""; }; - A2AAB6580DE0CF6200E04DDA /* rpc-server.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = "rpc-server.c"; sourceTree = ""; }; + A2AAB6580DE0CF6200E04DDA /* rpc-server.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = "rpc-server.cc"; sourceTree = ""; }; A2AAB6590DE0CF6200E04DDA /* rpcimpl.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = rpcimpl.h; sourceTree = ""; }; A2AAB65A0DE0CF6200E04DDA /* rpc-server.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "rpc-server.h"; sourceTree = ""; }; - A2AAB65B0DE0CF6200E04DDA /* rpcimpl.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = rpcimpl.c; sourceTree = ""; }; + A2AAB65B0DE0CF6200E04DDA /* rpcimpl.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = rpcimpl.cc; sourceTree = ""; }; A2AB883B16A399A6008FAD50 /* VDKQueue.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VDKQueue.h; sourceTree = ""; }; A2AB883C16A399A6008FAD50 /* VDKQueue.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VDKQueue.m; sourceTree = ""; }; A2AC81D60D987E2D00A2878C /* nl */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = nl; path = nl.lproj/AddWindow.xib; sourceTree = ""; }; A2AF1C360A3D0F6200F1575D /* FileOutlineView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FileOutlineView.h; sourceTree = ""; }; A2AF1C370A3D0F6200F1575D /* FileOutlineView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FileOutlineView.m; sourceTree = ""; }; - A2AF23C616B44FA0003BC59E /* log.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = log.c; sourceTree = ""; }; + A2AF23C616B44FA0003BC59E /* log.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = log.cc; sourceTree = ""; }; A2AF23C716B44FA0003BC59E /* log.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = log.h; sourceTree = ""; }; A2B3FB450E5901E700FF78FB /* cli.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = cli.c; sourceTree = ""; }; A2B5B4E71880665E0071A66A /* ShareTorrentFileHelper.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ShareTorrentFileHelper.h; sourceTree = ""; }; @@ -878,16 +878,16 @@ A2B9F90411BD10BE003FC8CA /* fr */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = fr; path = fr.lproj/InfoActivityView.xib; sourceTree = ""; }; A2B9F90511BD10BE003FC8CA /* fr */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = fr; path = fr.lproj/InfoGeneralView.xib; sourceTree = ""; }; A2B9F90611BD10BE003FC8CA /* fr */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = fr; path = fr.lproj/InfoOptionsView.xib; sourceTree = ""; }; - A2BE9C4E0C1E4ADA002D16E6 /* makemeta.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = makemeta.c; sourceTree = ""; }; + A2BE9C4E0C1E4ADA002D16E6 /* makemeta.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = makemeta.cc; sourceTree = ""; }; A2BE9C4F0C1E4ADA002D16E6 /* makemeta.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = makemeta.h; sourceTree = ""; }; A2C89D5F0CFCBF57004CC2BC /* ButtonToolbarItem.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ButtonToolbarItem.m; sourceTree = ""; }; A2CA772B187F063A00154956 /* tr */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = tr; path = tr.lproj/Localizable.strings; sourceTree = ""; }; A2CB38AE0E1E6896002B514C /* COPYING */ = {isa = PBXFileReference; lastKnownFileType = text; name = COPYING; path = ../COPYING; sourceTree = ""; }; A2CBDED80D993E4500BB22BC /* fr */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = fr; path = fr.lproj/AddWindow.xib; sourceTree = ""; }; A2CBDF9E0D9AD08100BB22BC /* ru */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = ru; path = ru.lproj/AddWindow.xib; sourceTree = ""; }; - A2D22A100D65EED100007D5F /* verify.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = verify.c; sourceTree = ""; }; + A2D22A100D65EED100007D5F /* verify.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = verify.cc; sourceTree = ""; }; A2D22A110D65EED100007D5F /* verify.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = verify.h; sourceTree = ""; }; - A2D3078E0D9EC45F0051FD27 /* blocklist.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = blocklist.c; sourceTree = ""; }; + A2D3078E0D9EC45F0051FD27 /* blocklist.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = blocklist.cc; sourceTree = ""; }; A2D307930D9EC4860051FD27 /* blocklist.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = blocklist.h; sourceTree = ""; }; A2D307A20D9EC6870051FD27 /* BlocklistDownloader.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BlocklistDownloader.h; sourceTree = ""; }; A2D307A30D9EC6870051FD27 /* BlocklistDownloader.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = BlocklistDownloader.m; sourceTree = ""; }; @@ -916,7 +916,7 @@ A2E57BA513109E6B00A7DAB1 /* FilterBarController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FilterBarController.h; sourceTree = ""; }; A2E57BA613109E6B00A7DAB1 /* FilterBarController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FilterBarController.m; sourceTree = ""; }; A2E669780F5B8E5A00B4251A /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = System/Library/Frameworks/Security.framework; sourceTree = SDKROOT; }; - A2EA522F1686AC0D00180493 /* quark.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = quark.c; sourceTree = ""; }; + A2EA522F1686AC0D00180493 /* quark.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = quark.cc; sourceTree = ""; }; A2EA52301686AC0D00180493 /* quark.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = quark.h; sourceTree = ""; }; A2EA8E3C0CC3C9830081201C /* fr */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = fr; path = fr.lproj/InfoPlist.strings; sourceTree = ""; }; A2EA8E3E0CC3C9830081201C /* fr */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = fr; path = fr.lproj/Localizable.strings; sourceTree = ""; }; @@ -971,47 +971,47 @@ BEFC1CF90C07822400B0BB3C /* transmission-remote */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "transmission-remote"; sourceTree = BUILT_PRODUCTS_DIR; }; BEFC1DF00C07861A00B0BB3C /* version.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = version.h; sourceTree = ""; }; BEFC1DF10C07861A00B0BB3C /* utils.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = utils.h; sourceTree = ""; }; - BEFC1DF20C07861A00B0BB3C /* utils.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = utils.c; sourceTree = ""; }; + BEFC1DF20C07861A00B0BB3C /* utils.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = utils.cc; sourceTree = ""; }; BEFC1DF30C07861A00B0BB3C /* upnp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = upnp.h; sourceTree = ""; }; - BEFC1DF40C07861A00B0BB3C /* upnp.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = upnp.c; sourceTree = ""; }; + BEFC1DF40C07861A00B0BB3C /* upnp.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = upnp.cc; sourceTree = ""; }; BEFC1DF50C07861A00B0BB3C /* transmission.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = transmission.h; sourceTree = ""; }; - BEFC1DF60C07861A00B0BB3C /* session.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = session.c; sourceTree = ""; }; - BEFC1DF90C07861A00B0BB3C /* torrent.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = torrent.c; sourceTree = ""; }; + BEFC1DF60C07861A00B0BB3C /* session.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = session.cc; sourceTree = ""; }; + BEFC1DF90C07861A00B0BB3C /* torrent.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = torrent.cc; sourceTree = ""; }; BEFC1DFC0C07861A00B0BB3C /* port-forwarding.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "port-forwarding.h"; sourceTree = ""; }; - BEFC1DFD0C07861A00B0BB3C /* port-forwarding.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = "port-forwarding.c"; sourceTree = ""; }; + BEFC1DFD0C07861A00B0BB3C /* port-forwarding.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = "port-forwarding.cc"; sourceTree = ""; }; BEFC1E020C07861A00B0BB3C /* platform.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = platform.h; sourceTree = ""; }; - BEFC1E030C07861A00B0BB3C /* platform.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = platform.c; sourceTree = ""; }; + BEFC1E030C07861A00B0BB3C /* platform.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = platform.cc; sourceTree = ""; }; BEFC1E0C0C07861A00B0BB3C /* net.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = net.h; sourceTree = ""; }; - BEFC1E0D0C07861A00B0BB3C /* net.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = net.c; sourceTree = ""; }; - BEFC1E0F0C07861A00B0BB3C /* natpmp.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = natpmp.c; sourceTree = ""; }; + BEFC1E0D0C07861A00B0BB3C /* net.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = net.cc; sourceTree = ""; }; + BEFC1E0F0C07861A00B0BB3C /* natpmp.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = natpmp.cc; sourceTree = ""; }; BEFC1E100C07861A00B0BB3C /* metainfo.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = metainfo.h; sourceTree = ""; }; - BEFC1E110C07861A00B0BB3C /* metainfo.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = metainfo.c; sourceTree = ""; }; + BEFC1E110C07861A00B0BB3C /* metainfo.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = metainfo.cc; sourceTree = ""; }; BEFC1E140C07861A00B0BB3C /* session.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = session.h; sourceTree = ""; }; BEFC1E150C07861A00B0BB3C /* inout.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = inout.h; sourceTree = ""; }; - BEFC1E160C07861A00B0BB3C /* inout.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = inout.c; sourceTree = ""; }; + BEFC1E160C07861A00B0BB3C /* inout.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = inout.cc; sourceTree = ""; }; BEFC1E190C07861A00B0BB3C /* fdlimit.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = fdlimit.h; sourceTree = ""; }; - BEFC1E1A0C07861A00B0BB3C /* fdlimit.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = fdlimit.c; sourceTree = ""; }; + BEFC1E1A0C07861A00B0BB3C /* fdlimit.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = fdlimit.cc; sourceTree = ""; }; BEFC1E1C0C07861A00B0BB3C /* completion.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = completion.h; sourceTree = ""; }; - BEFC1E1D0C07861A00B0BB3C /* completion.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = completion.c; sourceTree = ""; }; + BEFC1E1D0C07861A00B0BB3C /* completion.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = completion.cc; sourceTree = ""; }; BEFC1E1E0C07861A00B0BB3C /* clients.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = clients.h; sourceTree = ""; }; - BEFC1E1F0C07861A00B0BB3C /* clients.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = clients.c; sourceTree = ""; }; - C1033E031A3279B800EF44D8 /* crypto-utils-fallback.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = "crypto-utils-fallback.c"; sourceTree = ""; }; - C1033E041A3279B800EF44D8 /* crypto-utils-openssl.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = "crypto-utils-openssl.c"; sourceTree = ""; }; - C1033E051A3279B800EF44D8 /* crypto-utils.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = "crypto-utils.c"; sourceTree = ""; }; + BEFC1E1F0C07861A00B0BB3C /* clients.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = clients.cc; sourceTree = ""; }; + C1033E031A3279B800EF44D8 /* crypto-utils-fallback.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = "crypto-utils-fallback.cc"; sourceTree = ""; }; + C1033E041A3279B800EF44D8 /* crypto-utils-openssl.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = "crypto-utils-openssl.cc"; sourceTree = ""; }; + C1033E051A3279B800EF44D8 /* crypto-utils.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = "crypto-utils.cc"; sourceTree = ""; }; C1033E061A3279B800EF44D8 /* crypto-utils.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "crypto-utils.h"; sourceTree = ""; }; - C1077A4A183EB29600634C22 /* error.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = error.c; sourceTree = ""; }; + C1077A4A183EB29600634C22 /* error.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = error.cc; sourceTree = ""; }; C1077A4B183EB29600634C22 /* error.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = error.h; sourceTree = ""; }; - C1077A4C183EB29600634C22 /* file-posix.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = "file-posix.c"; sourceTree = ""; }; + C1077A4C183EB29600634C22 /* file-posix.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = "file-posix.cc"; sourceTree = ""; }; C1077A4D183EB29600634C22 /* file.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = file.h; sourceTree = ""; }; - C10C644B1D9AF328003C1B4C /* session-id.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "session-id.c"; sourceTree = ""; }; + C10C644B1D9AF328003C1B4C /* session-id.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "session-id.cc"; sourceTree = ""; }; C10C644C1D9AF328003C1B4C /* session-id.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "session-id.h"; sourceTree = ""; }; - C11DEA141FCD31C0009E22B9 /* subprocess-posix.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "subprocess-posix.c"; sourceTree = ""; }; + C11DEA141FCD31C0009E22B9 /* subprocess-posix.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "subprocess-posix.cc"; sourceTree = ""; }; C11DEA151FCD31C0009E22B9 /* subprocess.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = subprocess.h; sourceTree = ""; }; C12F19771E1AE3C30005E93F /* upnperrors.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = upnperrors.c; sourceTree = ""; }; C12F197A1E1AE4460005E93F /* upnperrors.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = upnperrors.h; sourceTree = ""; }; - C1305EB8186A134000F03351 /* file.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = file.c; sourceTree = ""; }; + C1305EB8186A134000F03351 /* file.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = file.cc; sourceTree = ""; }; C139E3B022BE70FA0007870C /* libssl.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libssl.dylib; path = "third-party/openssl/lib/libssl.dylib"; sourceTree = ""; }; - C1425B321EE9C5EA001DB85F /* tr-assert.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "tr-assert.c"; sourceTree = ""; }; + C1425B321EE9C5EA001DB85F /* tr-assert.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "tr-assert.cc"; sourceTree = ""; }; C1425B331EE9C5EA001DB85F /* tr-assert.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "tr-assert.h"; sourceTree = ""; }; C1425B341EE9C5EA001DB85F /* tr-macros.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "tr-macros.h"; sourceTree = ""; }; C1425B351EE9C5EA001DB85F /* peer-socket.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "peer-socket.h"; sourceTree = ""; }; @@ -1028,13 +1028,13 @@ C1F690FC1AD0627500D95CF0 /* daemon-posix.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = "daemon-posix.c"; sourceTree = ""; }; C1F690FE1AD0628400D95CF0 /* daemon.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = daemon.h; sourceTree = ""; }; C1FEE5721C3223CC00D62832 /* watchdir-common.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "watchdir-common.h"; sourceTree = ""; }; - C1FEE5731C3223CC00D62832 /* watchdir-generic.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "watchdir-generic.c"; sourceTree = ""; }; - C1FEE5741C3223CC00D62832 /* watchdir-kqueue.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "watchdir-kqueue.c"; sourceTree = ""; }; - C1FEE5751C3223CC00D62832 /* watchdir.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = watchdir.c; sourceTree = ""; }; + C1FEE5731C3223CC00D62832 /* watchdir-generic.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "watchdir-generic.cc"; sourceTree = ""; }; + C1FEE5741C3223CC00D62832 /* watchdir-kqueue.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "watchdir-kqueue.cc"; sourceTree = ""; }; + C1FEE5751C3223CC00D62832 /* watchdir.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = watchdir.cc; sourceTree = ""; }; C1FEE5761C3223CC00D62832 /* watchdir.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = watchdir.h; sourceTree = ""; }; CAB35C62252F6F5E00552A55 /* mime-types.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "mime-types.h"; sourceTree = ""; }; - CAB35C63252F6F5E00552A55 /* mime-types.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "mime-types.c"; sourceTree = ""; }; - D4AF3B2D0C41F7A500D46B6B /* list.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = list.c; sourceTree = ""; }; + CAB35C63252F6F5E00552A55 /* mime-types.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "mime-types.cc"; sourceTree = ""; }; + D4AF3B2D0C41F7A500D46B6B /* list.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = list.cc; sourceTree = ""; }; D4AF3B2E0C41F7A500D46B6B /* list.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = list.h; sourceTree = ""; }; E138A9750C04D88F00C5426C /* ProgressGradients.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ProgressGradients.h; sourceTree = ""; }; E138A9760C04D88F00C5426C /* ProgressGradients.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ProgressGradients.m; sourceTree = ""; }; @@ -1394,136 +1394,136 @@ 4D1838DC09DEC04A0047D688 /* libtransmission */ = { isa = PBXGroup; children = ( - CAB35C63252F6F5E00552A55 /* mime-types.c */, + CAB35C63252F6F5E00552A55 /* mime-types.cc */, CAB35C62252F6F5E00552A55 /* mime-types.h */, - C1077A4A183EB29600634C22 /* error.c */, + C1077A4A183EB29600634C22 /* error.cc */, C1077A4B183EB29600634C22 /* error.h */, - C1077A4C183EB29600634C22 /* file-posix.c */, - C1305EB8186A134000F03351 /* file.c */, + C1077A4C183EB29600634C22 /* file-posix.cc */, + C1305EB8186A134000F03351 /* file.cc */, C1077A4D183EB29600634C22 /* file.h */, - C11DEA141FCD31C0009E22B9 /* subprocess-posix.c */, + C11DEA141FCD31C0009E22B9 /* subprocess-posix.cc */, C11DEA151FCD31C0009E22B9 /* subprocess.h */, - 4D80185710BBC0B0008A4AF2 /* magnet.c */, + 4D80185710BBC0B0008A4AF2 /* magnet.cc */, 4D80185810BBC0B0008A4AF2 /* magnet.h */, - 4D8017E810BBC073008A4AF2 /* torrent-magnet.c */, + 4D8017E810BBC073008A4AF2 /* torrent-magnet.cc */, 4D8017E910BBC073008A4AF2 /* torrent-magnet.h */, - 0A6169A50FE5C9A200C66CE6 /* bitfield.c */, + 0A6169A50FE5C9A200C66CE6 /* bitfield.cc */, 0A6169A60FE5C9A200C66CE6 /* bitfield.h */, - C1425B321EE9C5EA001DB85F /* tr-assert.c */, + C1425B321EE9C5EA001DB85F /* tr-assert.cc */, C1425B331EE9C5EA001DB85F /* tr-assert.h */, - A22CFCA60FC24ED80009BD3E /* tr-dht.c */, + A22CFCA60FC24ED80009BD3E /* tr-dht.cc */, A22CFCA70FC24ED80009BD3E /* tr-dht.h */, C1425B341EE9C5EA001DB85F /* tr-macros.h */, C1425B351EE9C5EA001DB85F /* peer-socket.h */, - A284214212DA663E00FBDDBB /* tr-udp.c */, + A284214212DA663E00FBDDBB /* tr-udp.cc */, A284214312DA663E00FBDDBB /* tr-udp.h */, - A2679292130E00A000CB7464 /* tr-utp.c */, + A2679292130E00A000CB7464 /* tr-utp.cc */, A2679293130E00A000CB7464 /* tr-utp.h */, - A220EC59118C8A060022B4BE /* tr-lpd.c */, + A220EC59118C8A060022B4BE /* tr-lpd.cc */, A220EC5A118C8A060022B4BE /* tr-lpd.h */, - A2AAB65B0DE0CF6200E04DDA /* rpcimpl.c */, + A2AAB65B0DE0CF6200E04DDA /* rpcimpl.cc */, A2AAB6590DE0CF6200E04DDA /* rpcimpl.h */, - A2AAB6580DE0CF6200E04DDA /* rpc-server.c */, + A2AAB6580DE0CF6200E04DDA /* rpc-server.cc */, A2AAB65A0DE0CF6200E04DDA /* rpc-server.h */, - A29DF8B60DB2544C00D04E5A /* resume.c */, + A29DF8B60DB2544C00D04E5A /* resume.cc */, A29DF8B70DB2544C00D04E5A /* resume.h */, A29DF8B80DB2544C00D04E5A /* torrent.h */, - C1033E031A3279B800EF44D8 /* crypto-utils-fallback.c */, - C1033E041A3279B800EF44D8 /* crypto-utils-openssl.c */, - C1033E051A3279B800EF44D8 /* crypto-utils.c */, + C1033E031A3279B800EF44D8 /* crypto-utils-fallback.cc */, + C1033E041A3279B800EF44D8 /* crypto-utils-openssl.cc */, + C1033E051A3279B800EF44D8 /* crypto-utils.cc */, C1033E061A3279B800EF44D8 /* crypto-utils.h */, - 4D36BA600CA2F00800A63CA5 /* crypto.c */, + 4D36BA600CA2F00800A63CA5 /* crypto.cc */, 4D36BA610CA2F00800A63CA5 /* crypto.h */, - 4D36BA630CA2F00800A63CA5 /* handshake.c */, + 4D36BA630CA2F00800A63CA5 /* handshake.cc */, 4D36BA640CA2F00800A63CA5 /* handshake.h */, - 4D36BA650CA2F00800A63CA5 /* peer-io.c */, + 4D36BA650CA2F00800A63CA5 /* peer-io.cc */, 4D36BA660CA2F00800A63CA5 /* peer-io.h */, - 4D36BA680CA2F00800A63CA5 /* peer-mgr.c */, + 4D36BA680CA2F00800A63CA5 /* peer-mgr.cc */, 4D36BA690CA2F00800A63CA5 /* peer-mgr.h */, - 4D36BA6A0CA2F00800A63CA5 /* peer-msgs.c */, + 4D36BA6A0CA2F00800A63CA5 /* peer-msgs.cc */, 4D36BA6B0CA2F00800A63CA5 /* peer-msgs.h */, A292A6E40DFB45E5004B9C0A /* peer-common.h */, - A292A6E50DFB45EC004B9C0A /* webseed.c */, + A292A6E50DFB45EC004B9C0A /* webseed.cc */, A292A6E60DFB45EC004B9C0A /* webseed.h */, 4D36BA6C0CA2F00800A63CA5 /* ptrarray.h */, A24621350C769CF400088E81 /* trevent.h */, - A24621360C769CF400088E81 /* trevent.c */, - 4394AC640C74FB6000F367E8 /* ptrarray.c */, - D4AF3B2D0C41F7A500D46B6B /* list.c */, + A24621360C769CF400088E81 /* trevent.cc */, + 4394AC640C74FB6000F367E8 /* ptrarray.cc */, + D4AF3B2D0C41F7A500D46B6B /* list.cc */, D4AF3B2E0C41F7A500D46B6B /* list.h */, - A2BE9C4E0C1E4ADA002D16E6 /* makemeta.c */, + A2BE9C4E0C1E4ADA002D16E6 /* makemeta.cc */, A2BE9C4F0C1E4ADA002D16E6 /* makemeta.h */, BEFC1DF00C07861A00B0BB3C /* version.h */, BEFC1DF10C07861A00B0BB3C /* utils.h */, - BEFC1DF20C07861A00B0BB3C /* utils.c */, + BEFC1DF20C07861A00B0BB3C /* utils.cc */, BEFC1DF30C07861A00B0BB3C /* upnp.h */, - BEFC1DF40C07861A00B0BB3C /* upnp.c */, + BEFC1DF40C07861A00B0BB3C /* upnp.cc */, BEFC1DF50C07861A00B0BB3C /* transmission.h */, - BEFC1DF60C07861A00B0BB3C /* session.c */, + BEFC1DF60C07861A00B0BB3C /* session.cc */, BEFC1E140C07861A00B0BB3C /* session.h */, - C10C644B1D9AF328003C1B4C /* session-id.c */, + C10C644B1D9AF328003C1B4C /* session-id.cc */, C10C644C1D9AF328003C1B4C /* session-id.h */, - A20152790D1C26EB0081714F /* torrent-ctor.c */, + A20152790D1C26EB0081714F /* torrent-ctor.cc */, A23F299F132A447400E9A83B /* announcer-common.h */, - A25964A4106D73A800453B31 /* announcer.c */, + A25964A4106D73A800453B31 /* announcer.cc */, A25964A5106D73A800453B31 /* announcer.h */, - A23F29A0132A447400E9A83B /* announcer-http.c */, - A2AA9BE0132CAC8D00FA131E /* announcer-udp.c */, - BEFC1DF90C07861A00B0BB3C /* torrent.c */, + A23F29A0132A447400E9A83B /* announcer-http.cc */, + A2AA9BE0132CAC8D00FA131E /* announcer-udp.cc */, + BEFC1DF90C07861A00B0BB3C /* torrent.cc */, BEFC1DFC0C07861A00B0BB3C /* port-forwarding.h */, - BEFC1DFD0C07861A00B0BB3C /* port-forwarding.c */, + BEFC1DFD0C07861A00B0BB3C /* port-forwarding.cc */, A21FBBA90EDA78C300BC3C51 /* bandwidth.h */, - A21FBBAA0EDA78C300BC3C51 /* bandwidth.c */, + A21FBBAA0EDA78C300BC3C51 /* bandwidth.cc */, A209EE5B1144B51E002B02D1 /* history.h */, - A209EE5A1144B51E002B02D1 /* history.c */, - A23547E011CD0B090046EAE6 /* cache.c */, + A209EE5A1144B51E002B02D1 /* history.cc */, + A23547E011CD0B090046EAE6 /* cache.cc */, A23547E111CD0B090046EAE6 /* cache.h */, BEFC1E020C07861A00B0BB3C /* platform.h */, - BEFC1E030C07861A00B0BB3C /* platform.c */, + BEFC1E030C07861A00B0BB3C /* platform.cc */, A23FAE53178BC2950053DC5B /* platform-quota.h */, - A23FAE52178BC2950053DC5B /* platform-quota.c */, + A23FAE52178BC2950053DC5B /* platform-quota.cc */, BEFC1E0C0C07861A00B0BB3C /* net.h */, - BEFC1E0D0C07861A00B0BB3C /* net.c */, + BEFC1E0D0C07861A00B0BB3C /* net.cc */, A2EE726E14DCCC950093C99A /* natpmp_local.h */, - BEFC1E0F0C07861A00B0BB3C /* natpmp.c */, + BEFC1E0F0C07861A00B0BB3C /* natpmp.cc */, BEFC1E100C07861A00B0BB3C /* metainfo.h */, - BEFC1E110C07861A00B0BB3C /* metainfo.c */, + BEFC1E110C07861A00B0BB3C /* metainfo.cc */, BEFC1E150C07861A00B0BB3C /* inout.h */, - BEFC1E160C07861A00B0BB3C /* inout.c */, + BEFC1E160C07861A00B0BB3C /* inout.cc */, BEFC1E190C07861A00B0BB3C /* fdlimit.h */, - BEFC1E1A0C07861A00B0BB3C /* fdlimit.c */, + BEFC1E1A0C07861A00B0BB3C /* fdlimit.cc */, BEFC1E1C0C07861A00B0BB3C /* completion.h */, - BEFC1E1D0C07861A00B0BB3C /* completion.c */, + BEFC1E1D0C07861A00B0BB3C /* completion.cc */, BEFC1E1E0C07861A00B0BB3C /* clients.h */, - BEFC1E1F0C07861A00B0BB3C /* clients.c */, + BEFC1E1F0C07861A00B0BB3C /* clients.cc */, A25D2CBA0CF4C7190096A262 /* stats.h */, - A25D2CBB0CF4C7190096A262 /* stats.c */, + A25D2CBB0CF4C7190096A262 /* stats.cc */, A2D22A110D65EED100007D5F /* verify.h */, - A2D22A100D65EED100007D5F /* verify.c */, + A2D22A100D65EED100007D5F /* verify.cc */, A2D307930D9EC4860051FD27 /* blocklist.h */, - A2D3078E0D9EC45F0051FD27 /* blocklist.c */, + A2D3078E0D9EC45F0051FD27 /* blocklist.cc */, A29EBE530DC01FC9006CEE80 /* web.h */, - A29EBE520DC01FC9006CEE80 /* web.c */, + A29EBE520DC01FC9006CEE80 /* web.cc */, A25E03E00E4015380086C225 /* tr-getopt.h */, - A25E03E10E4015380086C225 /* tr-getopt.c */, + A25E03E10E4015380086C225 /* tr-getopt.cc */, A2A7B329164F87D400B98C65 /* jsonsl.h */, A2A7B328164F87D400B98C65 /* jsonsl.c */, - A25BFD63167BED3B0039D1AA /* variant-benc.c */, + A25BFD63167BED3B0039D1AA /* variant-benc.cc */, A25BFD64167BED3B0039D1AA /* variant-common.h */, - A25BFD65167BED3B0039D1AA /* variant-json.c */, - A25BFD67167BED3B0039D1AA /* variant.c */, + A25BFD65167BED3B0039D1AA /* variant-json.cc */, + A25BFD67167BED3B0039D1AA /* variant.cc */, A25BFD68167BED3B0039D1AA /* variant.h */, - A2EA522F1686AC0D00180493 /* quark.c */, + A2EA522F1686AC0D00180493 /* quark.cc */, A2EA52301686AC0D00180493 /* quark.h */, A2AF23C616B44FA0003BC59E /* log.c */, A2AF23C716B44FA0003BC59E /* log.h */, A2A4EA0B0DE106E8000CE197 /* ConvertUTF.h */, A2A4EA0A0DE106E8000CE197 /* ConvertUTF.c */, 4DB74F070E8CD75100AEB1A8 /* wildmat.c */, - C1FEE5751C3223CC00D62832 /* watchdir.c */, + C1FEE5751C3223CC00D62832 /* watchdir.cc */, C1FEE5761C3223CC00D62832 /* watchdir.h */, - C1FEE5731C3223CC00D62832 /* watchdir-generic.c */, - C1FEE5741C3223CC00D62832 /* watchdir-kqueue.c */, + C1FEE5731C3223CC00D62832 /* watchdir-generic.cc */, + C1FEE5741C3223CC00D62832 /* watchdir-kqueue.cc */, C1FEE5721C3223CC00D62832 /* watchdir-common.h */, ); path = libtransmission; @@ -2445,74 +2445,74 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - BEFC1E2B0C07861A00B0BB3C /* utils.c in Sources */, - A2AAB65F0DE0CF6200E04DDA /* rpcimpl.c in Sources */, - BEFC1E2D0C07861A00B0BB3C /* upnp.c in Sources */, - A2AAB65C0DE0CF6200E04DDA /* rpc-server.c in Sources */, - BEFC1E2F0C07861A00B0BB3C /* session.c in Sources */, - BEFC1E320C07861A00B0BB3C /* torrent.c in Sources */, - BEFC1E360C07861A00B0BB3C /* port-forwarding.c in Sources */, - BEFC1E3C0C07861A00B0BB3C /* platform.c in Sources */, - BEFC1E460C07861A00B0BB3C /* net.c in Sources */, - C1033E091A3279B800EF44D8 /* crypto-utils.c in Sources */, - BEFC1E480C07861A00B0BB3C /* natpmp.c in Sources */, - C1077A4E183EB29600634C22 /* error.c in Sources */, - BEFC1E4A0C07861A00B0BB3C /* metainfo.c in Sources */, - BEFC1E4F0C07861A00B0BB3C /* inout.c in Sources */, - BEFC1E530C07861A00B0BB3C /* fdlimit.c in Sources */, - C1FEE5781C3223CC00D62832 /* watchdir-generic.c in Sources */, - BEFC1E560C07861A00B0BB3C /* completion.c in Sources */, - BEFC1E580C07861A00B0BB3C /* clients.c in Sources */, - A2BE9C520C1E4AF5002D16E6 /* makemeta.c in Sources */, - D4AF3B2F0C41F7A500D46B6B /* list.c in Sources */, - 4394AC670C74FB6000F367E8 /* ptrarray.c in Sources */, - A24621420C769D0900088E81 /* trevent.c in Sources */, - C11DEA161FCD31C0009E22B9 /* subprocess-posix.c in Sources */, - 4D36BA6F0CA2F00800A63CA5 /* crypto.c in Sources */, - 4D36BA720CA2F00800A63CA5 /* handshake.c in Sources */, - 4D36BA740CA2F00800A63CA5 /* peer-io.c in Sources */, - C1033E071A3279B800EF44D8 /* crypto-utils-fallback.c in Sources */, - C10C644D1D9AF328003C1B4C /* session-id.c in Sources */, - 4D36BA770CA2F00800A63CA5 /* peer-mgr.c in Sources */, - C1077A50183EB29600634C22 /* file-posix.c in Sources */, - 4D36BA790CA2F00800A63CA5 /* peer-msgs.c in Sources */, - A25D2CBD0CF4C73E0096A262 /* stats.c in Sources */, - A201527E0D1C270F0081714F /* torrent-ctor.c in Sources */, - A2D22A130D65EEE700007D5F /* verify.c in Sources */, - 4D4ADFC70DA1631500A68297 /* blocklist.c in Sources */, - CAB35C65252F6F5E00552A55 /* mime-types.c in Sources */, - A29DF8B90DB2544C00D04E5A /* resume.c in Sources */, - A2A4E9220DE0F7EB000CE197 /* web.c in Sources */, + BEFC1E2B0C07861A00B0BB3C /* utils.cc in Sources */, + A2AAB65F0DE0CF6200E04DDA /* rpcimpl.cc in Sources */, + BEFC1E2D0C07861A00B0BB3C /* upnp.cc in Sources */, + A2AAB65C0DE0CF6200E04DDA /* rpc-server.cc in Sources */, + BEFC1E2F0C07861A00B0BB3C /* session.cc in Sources */, + BEFC1E320C07861A00B0BB3C /* torrent.cc in Sources */, + BEFC1E360C07861A00B0BB3C /* port-forwarding.cc in Sources */, + BEFC1E3C0C07861A00B0BB3C /* platform.cc in Sources */, + BEFC1E460C07861A00B0BB3C /* net.cc in Sources */, + C1033E091A3279B800EF44D8 /* crypto-utils.cc in Sources */, + BEFC1E480C07861A00B0BB3C /* natpmp.cc in Sources */, + C1077A4E183EB29600634C22 /* error.cc in Sources */, + BEFC1E4A0C07861A00B0BB3C /* metainfo.cc in Sources */, + BEFC1E4F0C07861A00B0BB3C /* inout.cc in Sources */, + BEFC1E530C07861A00B0BB3C /* fdlimit.cc in Sources */, + C1FEE5781C3223CC00D62832 /* watchdir-generic.cc in Sources */, + BEFC1E560C07861A00B0BB3C /* completion.cc in Sources */, + BEFC1E580C07861A00B0BB3C /* clients.cc in Sources */, + A2BE9C520C1E4AF5002D16E6 /* makemeta.cc in Sources */, + D4AF3B2F0C41F7A500D46B6B /* list.cc in Sources */, + 4394AC670C74FB6000F367E8 /* ptrarray.cc in Sources */, + A24621420C769D0900088E81 /* trevent.cc in Sources */, + C11DEA161FCD31C0009E22B9 /* subprocess-posix.cc in Sources */, + 4D36BA6F0CA2F00800A63CA5 /* crypto.cc in Sources */, + 4D36BA720CA2F00800A63CA5 /* handshake.cc in Sources */, + 4D36BA740CA2F00800A63CA5 /* peer-io.cc in Sources */, + C1033E071A3279B800EF44D8 /* crypto-utils-fallback.cc in Sources */, + C10C644D1D9AF328003C1B4C /* session-id.cc in Sources */, + 4D36BA770CA2F00800A63CA5 /* peer-mgr.cc in Sources */, + C1077A50183EB29600634C22 /* file-posix.cc in Sources */, + 4D36BA790CA2F00800A63CA5 /* peer-msgs.cc in Sources */, + A25D2CBD0CF4C73E0096A262 /* stats.cc in Sources */, + A201527E0D1C270F0081714F /* torrent-ctor.cc in Sources */, + A2D22A130D65EEE700007D5F /* verify.cc in Sources */, + 4D4ADFC70DA1631500A68297 /* blocklist.cc in Sources */, + CAB35C65252F6F5E00552A55 /* mime-types.cc in Sources */, + A29DF8B90DB2544C00D04E5A /* resume.cc in Sources */, + A2A4E9220DE0F7EB000CE197 /* web.cc in Sources */, A2A4EA0E0DE106EB000CE197 /* ConvertUTF.c in Sources */, - A292A6E80DFB45FC004B9C0A /* webseed.c in Sources */, - A25E03E30E4015380086C225 /* tr-getopt.c in Sources */, - C1305EBE186A13B100F03351 /* file.c in Sources */, + A292A6E80DFB45FC004B9C0A /* webseed.cc in Sources */, + A25E03E30E4015380086C225 /* tr-getopt.cc in Sources */, + C1305EBE186A13B100F03351 /* file.cc in Sources */, 4DB74F080E8CD75100AEB1A8 /* wildmat.c in Sources */, - A21FBBAC0EDA78C300BC3C51 /* bandwidth.c in Sources */, - C1033E081A3279B800EF44D8 /* crypto-utils-openssl.c in Sources */, - A22CFCA80FC24ED80009BD3E /* tr-dht.c in Sources */, - 0A6169A70FE5C9A200C66CE6 /* bitfield.c in Sources */, - A25964A6106D73A800453B31 /* announcer.c in Sources */, - 4D8017EA10BBC073008A4AF2 /* torrent-magnet.c in Sources */, - 4D80185910BBC0B0008A4AF2 /* magnet.c in Sources */, - A209EE5C1144B51E002B02D1 /* history.c in Sources */, - A220EC5B118C8A060022B4BE /* tr-lpd.c in Sources */, - C1FEE57A1C3223CC00D62832 /* watchdir.c in Sources */, - A23547E211CD0B090046EAE6 /* cache.c in Sources */, - A284214412DA663E00FBDDBB /* tr-udp.c in Sources */, - C1425B351EE9C5F5001DB85F /* tr-assert.c in Sources */, - A2679294130E00A000CB7464 /* tr-utp.c in Sources */, - A23F29A2132A447400E9A83B /* announcer-http.c in Sources */, - C1FEE5791C3223CC00D62832 /* watchdir-kqueue.c in Sources */, - A2AA9BE1132CAC8E00FA131E /* announcer-udp.c in Sources */, + A21FBBAC0EDA78C300BC3C51 /* bandwidth.cc in Sources */, + C1033E081A3279B800EF44D8 /* crypto-utils-openssl.cc in Sources */, + A22CFCA80FC24ED80009BD3E /* tr-dht.cc in Sources */, + 0A6169A70FE5C9A200C66CE6 /* bitfield.cc in Sources */, + A25964A6106D73A800453B31 /* announcer.cc in Sources */, + 4D8017EA10BBC073008A4AF2 /* torrent-magnet.cc in Sources */, + 4D80185910BBC0B0008A4AF2 /* magnet.cc in Sources */, + A209EE5C1144B51E002B02D1 /* history.cc in Sources */, + A220EC5B118C8A060022B4BE /* tr-lpd.cc in Sources */, + C1FEE57A1C3223CC00D62832 /* watchdir.cc in Sources */, + A23547E211CD0B090046EAE6 /* cache.cc in Sources */, + A284214412DA663E00FBDDBB /* tr-udp.cc in Sources */, + C1425B351EE9C5F5001DB85F /* tr-assert.cc in Sources */, + A2679294130E00A000CB7464 /* tr-utp.cc in Sources */, + A23F29A2132A447400E9A83B /* announcer-http.cc in Sources */, + C1FEE5791C3223CC00D62832 /* watchdir-kqueue.cc in Sources */, + A2AA9BE1132CAC8E00FA131E /* announcer-udp.cc in Sources */, A2D77452154CC25700A62B93 /* WebSeedTableView.m in Sources */, A2A7B32A164F87D400B98C65 /* jsonsl.c in Sources */, - A25BFD69167BED3B0039D1AA /* variant-benc.c in Sources */, - A25BFD6B167BED3B0039D1AA /* variant-json.c in Sources */, - A25BFD6D167BED3B0039D1AA /* variant.c in Sources */, - A2EA52311686AC0D00180493 /* quark.c in Sources */, - A2AF23C816B44FA0003BC59E /* log.c in Sources */, - A23FAE54178BC2950053DC5B /* platform-quota.c in Sources */, + A25BFD69167BED3B0039D1AA /* variant-benc.cc in Sources */, + A25BFD6B167BED3B0039D1AA /* variant-json.cc in Sources */, + A25BFD6D167BED3B0039D1AA /* variant.cc in Sources */, + A2EA52311686AC0D00180493 /* quark.cc in Sources */, + A2AF23C816B44FA0003BC59E /* log.cc in Sources */, + A23FAE54178BC2950053DC5B /* platform-quota.cc in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -3032,6 +3032,8 @@ 0053D3D40C86774200545606 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + CLANG_CXX_LANGUAGE_STANDARD = "c++17"; + CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_OBJC_ARC = NO; HEADER_SEARCH_PATHS = ( "$(inherited)", @@ -3221,6 +3223,8 @@ 4D18389C09DEC01E0047D688 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + CLANG_CXX_LANGUAGE_STANDARD = "c++17"; + CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_OBJC_ARC = NO; HEADER_SEARCH_PATHS = ( "$(inherited)", @@ -3475,6 +3479,8 @@ A250CFEE0CDA19680068B4B6 /* Release - Debug */ = { isa = XCBuildConfiguration; buildSettings = { + CLANG_CXX_LANGUAGE_STANDARD = "c++17"; + CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_OBJC_ARC = NO; HEADER_SEARCH_PATHS = ( "$(inherited)", diff --git a/cmake/FindICONV.cmake b/cmake/FindICONV.cmake index 02cbbccaa..2f5933a2b 100644 --- a/cmake/FindICONV.cmake +++ b/cmake/FindICONV.cmake @@ -17,12 +17,12 @@ find_package_handle_standard_args(ICONV ) if(ICONV_FOUND AND NOT DEFINED ICONV_SECOND_ARGUMENT_IS_CONST) - include(CheckCSourceCompiles) + include(CheckCXXSourceCompiles) set(CMAKE_REQUIRED_INCLUDES ${ICONV_INCLUDE_DIRS}) set(CMAKE_REQUIRED_LIBRARIES ${ICONV_LIBRARIES}) - check_c_source_compiles(" + check_cxx_source_compiles(" #include int main() { @@ -35,8 +35,11 @@ if(ICONV_FOUND AND NOT DEFINED ICONV_SECOND_ARGUMENT_IS_CONST) return 0; }" ICONV_SECOND_ARGUMENT_IS_CONST + FAIL_REGEX "discards qualifiers in nested pointer types" FAIL_REGEX "incompatible pointer type" - FAIL_REGEX "discards qualifiers in nested pointer types") + FAIL_REGEX "invalid conversion" + FAIL_REGEX "no matching function" + ) set(CMAKE_REQUIRED_INCLUDES) set(CMAKE_REQUIRED_LIBRARIES) diff --git a/code_style.sh b/code_style.sh index ad089c7a7..c59a78d4c 100755 --- a/code_style.sh +++ b/code_style.sh @@ -49,13 +49,13 @@ if ! find_cfiles -exec clang-format $clang_format_args '{}' '+'; then fi # enforce east const -matches="$(find_cfiles -exec perl -ne 'print "west const:",$ARGV,":",$_ if /((?:^|[(,;]|\bstatic\s+)\s*)\b(const)\b(?!\s+\w+\s*\[)/' '{}' '+')" +matches="$(find_cfiles -exec perl -ne 'print "west const:",$ARGV,":",$_ if /((?:^|[(<,;]|\bstatic\s+)\s*)\b(const)\b(?!\s+\w+\s*\[)/' '{}' '+')" if [ -n "$matches" ]; then echo "$matches" exitcode=1 fi if [ -n "$fix" ]; then - find_cfiles -exec perl -pi -e 's/((?:^|[(,;]|\bstatic\s+)\s*)\b(const)\b(?!\s+\w+\s*\[)/\1>\2\2(vdata); if (data->response_func != NULL) { @@ -208,7 +208,7 @@ static void on_announce_done( void* vdata) { tr_announce_response* response; - struct announce_data* data = vdata; + auto* data = static_cast(vdata); response = &data->response; response->did_connect = did_connect; @@ -363,7 +363,7 @@ struct scrape_data static void on_scrape_done_eventthread(void* vdata) { - struct scrape_data* data = vdata; + auto* data = static_cast(vdata); if (data->response_func != NULL) { @@ -384,10 +384,9 @@ static void on_scrape_done( size_t msglen, void* vdata) { - tr_scrape_response* response; - struct scrape_data* data = vdata; + auto* data = static_cast(vdata); - response = &data->response; + tr_scrape_response* response = &data->response; response->did_connect = did_connect; response->did_timeout = did_timeout; dbgmsg(data->log_name, "Got scrape response for \"%s\"", response->url); diff --git a/libtransmission/announcer-udp.c b/libtransmission/announcer-udp.cc similarity index 94% rename from libtransmission/announcer-udp.c rename to libtransmission/announcer-udp.cc index b4572f636..c94a18203 100644 --- a/libtransmission/announcer-udp.c +++ b/libtransmission/announcer-udp.cc @@ -69,7 +69,7 @@ static int tau_sendto(tr_session const* session, struct evutil_addrinfo* ai, tr_ } tau_sockaddr_setport(ai->ai_addr, port); - return sendto(sockfd, buf, buflen, 0, ai->ai_addr, ai->ai_addrlen); + return sendto(sockfd, static_cast(buf), buflen, 0, ai->ai_addr, ai->ai_addrlen); } /**** @@ -486,34 +486,34 @@ static void tau_tracker_free(struct tau_tracker* t) static void tau_tracker_fail_all(struct tau_tracker* tracker, bool did_connect, bool did_timeout, char const* errmsg) { - tr_ptrArray* reqs; - /* fail all the scrapes */ - reqs = &tracker->scrapes; + tr_ptrArray* reqs = &tracker->scrapes; for (int i = 0, n = tr_ptrArraySize(reqs); i < n; ++i) { - tau_scrape_request_fail(tr_ptrArrayNth(reqs, i), did_connect, did_timeout, errmsg); + auto* req = static_cast(tr_ptrArrayNth(reqs, i)); + tau_scrape_request_fail(req, did_connect, did_timeout, errmsg); } tr_ptrArrayDestruct(reqs, (PtrArrayForeachFunc)tau_scrape_request_free); - *reqs = TR_PTR_ARRAY_INIT; + *reqs = {}; /* fail all the announces */ reqs = &tracker->announces; for (int i = 0, n = tr_ptrArraySize(reqs); i < n; ++i) { - tau_announce_request_fail(tr_ptrArrayNth(reqs, i), did_connect, did_timeout, errmsg); + auto* req = static_cast(tr_ptrArrayNth(reqs, i)); + tau_announce_request_fail(req, did_connect, did_timeout, errmsg); } tr_ptrArrayDestruct(reqs, (PtrArrayForeachFunc)tau_announce_request_free); - *reqs = TR_PTR_ARRAY_INIT; + *reqs = {}; } static void tau_tracker_on_dns(int errcode, struct evutil_addrinfo* addr, void* vtracker) { - struct tau_tracker* tracker = vtracker; + auto* tracker = static_cast(vtracker); tracker->dns_request = NULL; @@ -557,7 +557,7 @@ static void tau_tracker_send_reqs(struct tau_tracker* tracker) for (int i = 0, n = tr_ptrArraySize(reqs); i < n; ++i) { - struct tau_announce_request* req = tr_ptrArrayNth(reqs, i); + auto* req = static_cast(tr_ptrArrayNth(reqs, i)); if (req->sent_at == 0) { @@ -579,7 +579,7 @@ static void tau_tracker_send_reqs(struct tau_tracker* tracker) for (int i = 0, n = tr_ptrArraySize(reqs); i < n; ++i) { - struct tau_scrape_request* req = tr_ptrArrayNth(reqs, i); + auto* req = static_cast(tr_ptrArrayNth(reqs, i)); if (req->sent_at == 0) { @@ -648,7 +648,7 @@ static void tau_tracker_timeout_reqs(struct tau_tracker* tracker) for (int i = 0, n = tr_ptrArraySize(reqs); i < n; ++i) { - struct tau_announce_request* req = tr_ptrArrayNth(reqs, i); + auto* req = static_cast(tr_ptrArrayNth(reqs, i)); if (cancel_all || req->created_at + TAU_REQUEST_TTL < now) { @@ -665,7 +665,7 @@ static void tau_tracker_timeout_reqs(struct tau_tracker* tracker) for (int i = 0, n = tr_ptrArraySize(reqs); i < n; ++i) { - struct tau_scrape_request* req = tr_ptrArrayNth(reqs, i); + auto* req = static_cast(tr_ptrArrayNth(reqs, i)); if (cancel_all || req->created_at + TAU_REQUEST_TTL < now) { @@ -786,7 +786,7 @@ static struct tr_announcer_udp* announcer_udp_get(tr_session* session) } tau = tr_new0(struct tr_announcer_udp, 1); - tau->trackers = TR_PTR_ARRAY_INIT; + tau->trackers = {}; tau->session = session; session->announcer_udp = tau; return tau; @@ -807,7 +807,7 @@ static struct tau_tracker* tau_session_get_tracker(struct tr_announcer_udp* tau, for (int i = 0, n = tr_ptrArraySize(&tau->trackers); tracker == NULL && i < n; ++i) { - struct tau_tracker* tmp = tr_ptrArrayNth(&tau->trackers, i); + auto* tmp = static_cast(tr_ptrArrayNth(&tau->trackers, i)); if (tr_strcmp0(tmp->key, key) == 0) { @@ -823,8 +823,8 @@ static struct tau_tracker* tau_session_get_tracker(struct tr_announcer_udp* tau, tracker->key = key; tracker->host = host; tracker->port = port; - tracker->scrapes = TR_PTR_ARRAY_INIT; - tracker->announces = TR_PTR_ARRAY_INIT; + tracker->scrapes = {}; + tracker->announces = {}; tr_ptrArrayAppend(&tau->trackers, tracker); dbgmsg(tracker->key, "New tau_tracker created"); } @@ -861,7 +861,8 @@ bool tr_tracker_udp_is_idle(tr_session const* session) { for (int i = 0, n = tr_ptrArraySize(&tau->trackers); i < n; ++i) { - if (!tau_tracker_is_idle(tr_ptrArrayNth(&tau->trackers, i))) + auto const* tracker = static_cast(tr_ptrArrayNth(&tau->trackers, i)); + if (!tau_tracker_is_idle(tracker)) { return false; } @@ -896,7 +897,7 @@ void tr_tracker_udp_start_shutdown(tr_session* session) { for (int i = 0, n = tr_ptrArraySize(&tau->trackers); i < n; ++i) { - struct tau_tracker* tracker = tr_ptrArrayNth(&tau->trackers, i); + auto* tracker = static_cast(tr_ptrArrayNth(&tau->trackers, i)); if (tracker->dns_request != NULL) { @@ -914,7 +915,6 @@ void tr_tracker_udp_start_shutdown(tr_session* session) bool tau_handle_message(tr_session* session, uint8_t const* msg, size_t msglen) { struct tr_announcer_udp* tau; - tau_action_t action_id; tau_transaction_t transaction_id; struct evbuffer* buf; @@ -931,7 +931,7 @@ bool tau_handle_message(tr_session* session, uint8_t const* msg, size_t msglen) /* extract the action_id and see if it makes sense */ buf = evbuffer_new(); evbuffer_add_reference(buf, msg, msglen, NULL, NULL); - action_id = evbuffer_read_ntoh_32(buf); + auto const action_id = tau_action_t(evbuffer_read_ntoh_32(buf)); if (!is_tau_response_message(action_id, msglen)) { @@ -946,7 +946,7 @@ bool tau_handle_message(tr_session* session, uint8_t const* msg, size_t msglen) for (int i = 0, n = tr_ptrArraySize(&tau->trackers); i < n; ++i) { tr_ptrArray* reqs; - struct tau_tracker* tracker = tr_ptrArrayNth(&tau->trackers, i); + auto* tracker = static_cast(tr_ptrArrayNth(&tau->trackers, i)); /* is it a connection response? */ if (tracker->connecting_at != 0 && transaction_id == tracker->connection_transaction_id) @@ -962,7 +962,7 @@ bool tau_handle_message(tr_session* session, uint8_t const* msg, size_t msglen) for (int j = 0, jn = tr_ptrArraySize(reqs); j < jn; ++j) { - struct tau_announce_request* req = tr_ptrArrayNth(reqs, j); + auto* req = static_cast(tr_ptrArrayNth(reqs, j)); if (req->sent_at != 0 && transaction_id == req->transaction_id) { @@ -980,7 +980,7 @@ bool tau_handle_message(tr_session* session, uint8_t const* msg, size_t msglen) for (int j = 0, jn = tr_ptrArraySize(reqs); j < jn; ++j) { - struct tau_scrape_request* req = tr_ptrArrayNth(reqs, j); + auto* req = static_cast(tr_ptrArrayNth(reqs, j)); if (req->sent_at != 0 && transaction_id == req->transaction_id) { diff --git a/libtransmission/announcer.c b/libtransmission/announcer.cc similarity index 97% rename from libtransmission/announcer.c rename to libtransmission/announcer.cc index 4e0208b19..9492c6a98 100644 --- a/libtransmission/announcer.c +++ b/libtransmission/announcer.cc @@ -119,8 +119,8 @@ static int compareTransfer(uint64_t a_uploaded, uint64_t a_downloaded, uint64_t static int compareStops(void const* va, void const* vb) { int i; - tr_announce_request const* a = va; - tr_announce_request const* b = vb; + auto const* a = static_cast(va); + auto const* b = static_cast(vb); /* primary key: volume of data transferred. */ if ((i = compareTransfer(a->up, a->down, b->up, b->down)) != 0) @@ -151,7 +151,7 @@ struct tr_scrape_info static void scrapeInfoFree(void* va) { - struct tr_scrape_info* a = va; + auto* a = static_cast(va); tr_free(a->url); tr_free(a); @@ -159,8 +159,8 @@ static void scrapeInfoFree(void* va) static int compareScrapeInfo(void const* va, void const* vb) { - struct tr_scrape_info const* a = va; - struct tr_scrape_info const* b = vb; + auto const* a = static_cast(va); + auto const* b = static_cast(vb); return tr_strcmp0(a->url, b->url); } @@ -185,11 +185,11 @@ static struct tr_scrape_info* tr_announcerGetScrapeInfo(struct tr_announcer* ann if (!tr_str_is_empty(url)) { bool found; - struct tr_scrape_info const key = { .url = (char*)url }; + auto const key = tr_scrape_info{ const_cast(url), {} }; int const pos = tr_ptrArrayLowerBound(&announcer->scrape_info, &key, compareScrapeInfo, &found); if (found) { - info = tr_ptrArrayNth(&announcer->scrape_info, pos); + info = static_cast(tr_ptrArrayNth(&announcer->scrape_info, pos)); } else { @@ -210,7 +210,7 @@ void tr_announcerInit(tr_session* session) TR_ASSERT(tr_isSession(session)); tr_announcer* a = tr_new0(tr_announcer, 1); - a->stops = TR_PTR_ARRAY_INIT; + a->stops = {}; a->key = tr_rand_int(INT_MAX); a->session = session; a->upkeepTimer = evtimer_new(session->event_base, onUpkeepTimer, a); @@ -505,20 +505,12 @@ static tr_tier* getTier(tr_announcer* announcer, uint8_t const* info_hash, int t **** PUBLISH ***/ -static tr_tracker_event const TRACKER_EVENT_INIT = { .messageType = TR_TRACKER_WARNING, - .text = NULL, - .tracker = NULL, - .pex = NULL, - .pexCount = 0, - .seeders = 0, - .leechers = 0 }; - -static void publishMessage(tr_tier* tier, char const* msg, int type) +static void publishMessage(tr_tier* tier, char const* msg, TrackerEventType type) { if (tier != NULL && tier->tor != NULL && tier->tor->tiers != NULL && tier->tor->tiers->callback != NULL) { tr_torrent_tiers* tiers = tier->tor->tiers; - tr_tracker_event event = TRACKER_EVENT_INIT; + auto event = tr_tracker_event{}; event.messageType = type; event.text = msg; @@ -550,7 +542,7 @@ static void publishPeerCounts(tr_tier* tier, int seeders, int leechers) { if (tier->tor->tiers->callback != NULL) { - tr_tracker_event e = TRACKER_EVENT_INIT; + auto e = tr_tracker_event{}; e.messageType = TR_TRACKER_COUNTS; e.seeders = seeders; e.leechers = leechers; @@ -564,7 +556,7 @@ static void publishPeersPex(tr_tier* tier, int seeders, int leechers, tr_pex con { if (tier->tor->tiers->callback != NULL) { - tr_tracker_event e = TRACKER_EVENT_INIT; + auto e = tr_tracker_event{}; e.messageType = TR_TRACKER_PEERS; e.seeders = seeders; e.leechers = leechers; @@ -594,8 +586,8 @@ struct ann_tracker_info * secondary key: udp comes before http */ static int filter_trackers_compare_func(void const* va, void const* vb) { - struct ann_tracker_info const* a = va; - struct ann_tracker_info const* b = vb; + auto* a = static_cast(va); + auto* b = static_cast(vb); if (a->info.tier != b->info.tier) { @@ -1099,7 +1091,7 @@ static void on_announce_error(tr_tier* tier, char const* err, tr_announce_event static void on_announce_done(tr_announce_response const* response, void* vdata) { - struct announce_data* data = vdata; + auto* data = static_cast(vdata); tr_announcer* announcer = data->session->announcer; tr_tier* tier = getTier(announcer, response->info_hash, data->tierId); time_t const now = tr_time(); @@ -1426,7 +1418,7 @@ static tr_tier* find_tier(tr_torrent* tor, char const* scrape) static void on_scrape_done(tr_scrape_response const* response, void* vsession) { time_t const now = tr_time(); - tr_session* session = vsession; + auto* session = static_cast(vsession); tr_announcer* announcer = session->announcer; for (int i = 0; i < response->row_count; ++i) @@ -1580,12 +1572,12 @@ static void multiscrape(tr_announcer* announcer, tr_ptrArray* tiers) size_t request_count = 0; time_t const now = tr_time(); size_t const tier_count = tr_ptrArraySize(tiers); - tr_scrape_request requests[MAX_SCRAPES_PER_UPKEEP] = { 0 }; + tr_scrape_request requests[MAX_SCRAPES_PER_UPKEEP] = {}; /* batch as many info_hashes into a request as we can */ for (size_t i = 0; i < tier_count; ++i) { - tr_tier* tier = tr_ptrArrayNth(tiers, i); + auto* tier = static_cast(tr_ptrArrayNth(tiers, i)); struct tr_scrape_info* const scrape_info = tier->currentTracker->scrape_info; uint8_t const* hash = tier->tor->info.hash; bool found = false; @@ -1637,7 +1629,11 @@ static void flushCloseMessages(tr_announcer* announcer) { for (int i = 0, n = tr_ptrArraySize(&announcer->stops); i < n; ++i) { - announce_request_delegate(announcer, tr_ptrArrayNth(&announcer->stops, i), NULL, NULL); + announce_request_delegate( + announcer, + static_cast(tr_ptrArrayNth(&announcer->stops, i)), + nullptr, + nullptr); } tr_ptrArrayClear(&announcer->stops); @@ -1718,8 +1714,8 @@ static void scrapeAndAnnounceMore(tr_announcer* announcer) time_t const now = tr_time(); /* build a list of tiers that need to be announced */ - tr_ptrArray announceMe = TR_PTR_ARRAY_INIT; - tr_ptrArray scrapeMe = TR_PTR_ARRAY_INIT; + auto announceMe = tr_ptrArray{}; + auto scrapeMe = tr_ptrArray{}; tr_torrent* tor = NULL; while ((tor = tr_torrentNext(announcer->session, tor)) != NULL) { @@ -1752,7 +1748,7 @@ static void scrapeAndAnnounceMore(tr_announcer* announcer) int n = MIN(tr_ptrArraySize(&announceMe), MAX_ANNOUNCES_PER_UPKEEP); for (int i = 0; i < n; ++i) { - tr_tier* tier = tr_ptrArrayNth(&announceMe, i); + auto* tier = static_cast(tr_ptrArrayNth(&announceMe, i)); tr_logAddTorDbg(tier->tor, "%s", "Announcing to tracker"); dbgmsg(tier, "announcing tier %d of %d", i, n); tierAnnounce(announcer, tier); @@ -1768,7 +1764,7 @@ static void onUpkeepTimer(evutil_socket_t fd, short what, void* vannouncer) TR_UNUSED(fd); TR_UNUSED(what); - tr_announcer* announcer = vannouncer; + auto* announcer = static_cast(vannouncer); tr_session* session = announcer->session; bool const is_closing = session->isClosed; time_t const now = tr_time(); @@ -1940,7 +1936,8 @@ static void copy_tier_attributes_impl(struct tr_tier* tgt, int trackerIndex, tr_ tgt->wasCopied = true; tgt->trackers = keep.trackers; tgt->tracker_count = keep.tracker_count; - tgt->announce_events = tr_memdup(src->announce_events, sizeof(tr_announce_event) * src->announce_event_count); + tgt->announce_events = static_cast( + tr_memdup(src->announce_events, sizeof(tr_announce_event) * src->announce_event_count)); tgt->announce_event_priority = src->announce_event_priority; tgt->announce_event_count = src->announce_event_count; tgt->announce_event_alloc = src->announce_event_count; diff --git a/libtransmission/bandwidth.c b/libtransmission/bandwidth.cc similarity index 97% rename from libtransmission/bandwidth.c rename to libtransmission/bandwidth.cc index 91a3e806e..03ebfcff9 100644 --- a/libtransmission/bandwidth.c +++ b/libtransmission/bandwidth.cc @@ -85,8 +85,8 @@ static void bytesUsed(uint64_t const now, struct bratecontrol* r, size_t size) static int compareBandwidth(void const* va, void const* vb) { - tr_bandwidth const* a = va; - tr_bandwidth const* b = vb; + auto const* a = static_cast(va); + auto const* b = static_cast(vb); return a->uniqueKey - b->uniqueKey; } @@ -99,7 +99,7 @@ void tr_bandwidthConstruct(tr_bandwidth* b, tr_session* session, tr_bandwidth* p static unsigned int uniqueKey = 0; b->session = session; - b->children = TR_PTR_ARRAY_INIT; + b->children = {}; b->magicNumber = BANDWIDTH_MAGIC_NUMBER; b->uniqueKey = uniqueKey++; b->band[TR_UP].honorParentLimits = true; @@ -224,10 +224,10 @@ static void phaseOne(tr_ptrArray const* peerArray, tr_direction dir) void tr_bandwidthAllocate(tr_bandwidth* b, tr_direction dir, unsigned int period_msec) { int peerCount; - tr_ptrArray tmp = TR_PTR_ARRAY_INIT; - tr_ptrArray low = TR_PTR_ARRAY_INIT; - tr_ptrArray high = TR_PTR_ARRAY_INIT; - tr_ptrArray normal = TR_PTR_ARRAY_INIT; + auto tmp = tr_ptrArray{}; + auto low = tr_ptrArray{}; + auto high = tr_ptrArray{}; + auto normal = tr_ptrArray{}; struct tr_peerIo** peers; /* allocateBandwidth () is a helper function with two purposes: diff --git a/libtransmission/bitfield.c b/libtransmission/bitfield.cc similarity index 98% rename from libtransmission/bitfield.c rename to libtransmission/bitfield.cc index c4ed85b70..416a78a97 100644 --- a/libtransmission/bitfield.c +++ b/libtransmission/bitfield.cc @@ -13,15 +13,6 @@ #include "tr-assert.h" #include "utils.h" /* tr_new0() */ -tr_bitfield const TR_BITFIELD_INIT = { - .bits = NULL, - .alloc_count = 0, - .bit_count = 0, - .true_count = 0, - .have_all_hint = false, - .have_none_hint = false, -}; - /**** ***** ****/ @@ -365,7 +356,7 @@ void tr_bitfieldSetRaw(tr_bitfield* b, void const* bits, size_t byte_count, bool byte_count = MIN(byte_count, get_bytes_needed(b->bit_count)); } - b->bits = tr_memdup(bits, byte_count); + b->bits = static_cast(tr_memdup(bits, byte_count)); b->alloc_count = byte_count; if (bounded) diff --git a/libtransmission/bitfield.h b/libtransmission/bitfield.h index 070ee7f63..89dac0f35 100644 --- a/libtransmission/bitfield.h +++ b/libtransmission/bitfield.h @@ -53,8 +53,6 @@ void tr_bitfieldRemRange(tr_bitfield*, size_t begin, size_t end); **** life cycle ***/ -extern tr_bitfield const TR_BITFIELD_INIT; - void tr_bitfieldConstruct(tr_bitfield*, size_t bit_count); static inline void tr_bitfieldDestruct(tr_bitfield* b) diff --git a/libtransmission/blocklist.c b/libtransmission/blocklist.cc similarity index 95% rename from libtransmission/blocklist.c rename to libtransmission/blocklist.cc index 653687033..33855fa19 100644 --- a/libtransmission/blocklist.c +++ b/libtransmission/blocklist.cc @@ -85,7 +85,7 @@ static void blocklistLoad(tr_blocklistFile* b) return; } - b->rules = tr_sys_file_map_for_reading(fd, 0, byteCount, &error); + b->rules = static_cast(tr_sys_file_map_for_reading(fd, 0, byteCount, &error)); if (b->rules == NULL) { @@ -114,8 +114,8 @@ static void blocklistEnsureLoaded(tr_blocklistFile* b) static int compareAddressToRange(void const* va, void const* vb) { - uint32_t const* a = va; - struct tr_ipv4_range const* b = vb; + auto const* a = static_cast(va); + auto const* b = static_cast(vb); if (*a < b->begin) { @@ -193,7 +193,6 @@ bool tr_blocklistFileHasAddress(tr_blocklistFile* b, tr_address const* addr) TR_ASSERT(tr_address_is_valid(addr)); uint32_t needle; - struct tr_ipv4_range const* range; if (!b->isEnabled || addr->type == TR_AF_INET6) { @@ -209,7 +208,8 @@ bool tr_blocklistFileHasAddress(tr_blocklistFile* b, tr_address const* addr) needle = ntohl(addr->addr.addr4.s_addr); - range = bsearch(&needle, b->rules, b->ruleCount, sizeof(struct tr_ipv4_range), compareAddressToRange); + auto const* range = static_cast( + bsearch(&needle, b->rules, b->ruleCount, sizeof(struct tr_ipv4_range), compareAddressToRange)); return range != NULL; } @@ -347,8 +347,8 @@ static bool parseLine(char const* line, struct tr_ipv4_range* range) static int compareAddressRangesByFirstAddress(void const* va, void const* vb) { - struct tr_ipv4_range const* a = va; - struct tr_ipv4_range const* b = vb; + auto const* a = static_cast(va); + auto const* b = static_cast(vb); if (a->begin != b->begin) { diff --git a/libtransmission/cache.c b/libtransmission/cache.cc similarity index 94% rename from libtransmission/cache.c rename to libtransmission/cache.cc index c8af2980d..5a1ab659e 100644 --- a/libtransmission/cache.c +++ b/libtransmission/cache.cc @@ -112,8 +112,8 @@ static int getBlockRun(tr_cache const* cache, int pos, struct run_info* info) /* higher rank comes before lower rank */ static int compareRuns(void const* va, void const* vb) { - struct run_info const* a = va; - struct run_info const* b = vb; + auto* a = static_cast(va); + auto* b = static_cast(vb); return b->rank - a->rank; } @@ -265,7 +265,7 @@ int64_t tr_cacheGetLimit(tr_cache const* cache) tr_cache* tr_cacheNew(int64_t max_bytes) { tr_cache* cache = tr_new0(tr_cache, 1); - cache->blocks = TR_PTR_ARRAY_INIT; + cache->blocks = {}; cache->max_bytes = max_bytes; cache->max_blocks = getMaxBlocks(max_bytes); return cache; @@ -285,8 +285,8 @@ void tr_cacheFree(tr_cache* cache) static int cache_block_compare(void const* va, void const* vb) { - struct cache_block const* a = va; - struct cache_block const* b = vb; + auto const* a = static_cast(va); + auto const* b = static_cast(vb); /* primary key: torrent id */ if (a->tor->uniqueId != b->tor->uniqueId) @@ -309,7 +309,7 @@ static struct cache_block* findBlock(tr_cache* cache, tr_torrent* torrent, tr_pi struct cache_block key; key.tor = torrent; key.block = _tr_block(torrent, piece, offset); - return tr_ptrArrayFindSorted(&cache->blocks, &key, cache_block_compare); + return static_cast(tr_ptrArrayFindSorted(&cache->blocks, &key, cache_block_compare)); } int tr_cacheWriteBlock( @@ -437,7 +437,7 @@ int tr_cacheFlushFile(tr_cache* cache, tr_torrent* torrent, tr_file_index_t i) /* flush out all the blocks in that file */ while (err == 0 && pos < tr_ptrArraySize(&cache->blocks)) { - struct cache_block const* b = tr_ptrArrayNth(&cache->blocks, pos); + auto const* b = static_cast(tr_ptrArrayNth(&cache->blocks, pos)); if (b->tor != torrent) { @@ -463,7 +463,7 @@ int tr_cacheFlushTorrent(tr_cache* cache, tr_torrent* torrent) /* flush out all the blocks in that torrent */ while (err == 0 && pos < tr_ptrArraySize(&cache->blocks)) { - struct cache_block const* b = tr_ptrArrayNth(&cache->blocks, pos); + auto const* b = static_cast(tr_ptrArrayNth(&cache->blocks, pos)); if (b->tor != torrent) { diff --git a/libtransmission/clients.c b/libtransmission/clients.cc similarity index 99% rename from libtransmission/clients.c rename to libtransmission/clients.cc index 634f2be6a..16e1e57cf 100644 --- a/libtransmission/clients.c +++ b/libtransmission/clients.cc @@ -192,8 +192,8 @@ static bool decodeBitCometClient(char* buf, size_t buflen, uint8_t const* id) char* tr_clientForId(char* buf, size_t buflen, void const* id_in) { - uint8_t const* id = id_in; - char const* chid = (char const*)id; + auto const* id = static_cast(id_in); + auto const* chid = static_cast(id_in); *buf = '\0'; diff --git a/libtransmission/completion.c b/libtransmission/completion.cc similarity index 100% rename from libtransmission/completion.c rename to libtransmission/completion.cc diff --git a/libtransmission/crypto-utils-cyassl.c b/libtransmission/crypto-utils-cyassl.cc similarity index 88% rename from libtransmission/crypto-utils-cyassl.c rename to libtransmission/crypto-utils-cyassl.cc index b4b0be24b..fd0c596b7 100644 --- a/libtransmission/crypto-utils-cyassl.c +++ b/libtransmission/crypto-utils-cyassl.cc @@ -33,7 +33,7 @@ #define TR_CRYPTO_DH_SECRET_FALLBACK #define TR_CRYPTO_X509_FALLBACK -#include "crypto-utils-fallback.c" +#include "crypto-utils-fallback.cc" struct tr_dh_ctx { @@ -131,8 +131,9 @@ tr_sha1_ctx_t tr_sha1_init(void) return NULL; } -bool tr_sha1_update(tr_sha1_ctx_t handle, void const* data, size_t data_length) +bool tr_sha1_update(tr_sha1_ctx_t raw_handle, void const* data, size_t data_length) { + auto* handle = static_cast(raw_handle); TR_ASSERT(handle != NULL); if (data_length == 0) @@ -142,11 +143,12 @@ bool tr_sha1_update(tr_sha1_ctx_t handle, void const* data, size_t data_length) TR_ASSERT(data != NULL); - return check_result(API(ShaUpdate)(handle, data, data_length)); + return check_result(API(ShaUpdate)(handle, static_cast(data), data_length)); } -bool tr_sha1_final(tr_sha1_ctx_t handle, uint8_t* hash) +bool tr_sha1_final(tr_sha1_ctx_t raw_handle, uint8_t* hash) { + auto* handle = static_cast(raw_handle); bool ret = true; if (hash != NULL) @@ -190,7 +192,7 @@ tr_dh_ctx_t tr_dh_new( void tr_dh_free(tr_dh_ctx_t raw_handle) { - struct tr_dh_ctx* handle = raw_handle; + auto* handle = static_cast(raw_handle); if (handle == NULL) { @@ -209,14 +211,14 @@ bool tr_dh_make_key(tr_dh_ctx_t raw_handle, size_t private_key_length, uint8_t* TR_ASSERT(raw_handle != NULL); TR_ASSERT(public_key != NULL); - struct tr_dh_ctx* handle = raw_handle; + auto* handle = static_cast(raw_handle); word32 my_private_key_length; word32 my_public_key_length; tr_lock* rng_lock = get_rng_lock(); if (handle->private_key == NULL) { - handle->private_key = tr_malloc(handle->key_length); + handle->private_key = static_cast(tr_malloc(handle->key_length)); } tr_lockLock(rng_lock); @@ -252,7 +254,7 @@ tr_dh_secret_t tr_dh_agree(tr_dh_ctx_t raw_handle, uint8_t const* other_public_k TR_ASSERT(raw_handle != NULL); TR_ASSERT(other_public_key != NULL); - struct tr_dh_ctx* handle = raw_handle; + auto* handle = static_cast(raw_handle); struct tr_dh_secret* ret; word32 my_secret_key_length; @@ -290,7 +292,7 @@ bool tr_rand_buffer(void* buffer, size_t length) tr_lock* rng_lock = get_rng_lock(); tr_lockLock(rng_lock); - ret = check_result(API(RNG_GenerateBlock)(get_rng(), buffer, length)); + ret = check_result(API(RNG_GenerateBlock)(get_rng(), static_cast(buffer), length)); tr_lockUnlock(rng_lock); return ret; diff --git a/libtransmission/crypto-utils-fallback.c b/libtransmission/crypto-utils-fallback.cc similarity index 92% rename from libtransmission/crypto-utils-fallback.c rename to libtransmission/crypto-utils-fallback.cc index 40fe2de16..77cdc0ed5 100644 --- a/libtransmission/crypto-utils-fallback.c +++ b/libtransmission/crypto-utils-fallback.cc @@ -33,7 +33,7 @@ struct tr_dh_secret static struct tr_dh_secret* tr_dh_secret_new(size_t key_length) { - struct tr_dh_secret* handle = tr_malloc(sizeof(struct tr_dh_secret) + key_length); + auto* handle = static_cast(tr_malloc(sizeof(struct tr_dh_secret) + key_length)); handle->key_length = key_length; return handle; } @@ -54,7 +54,7 @@ bool tr_dh_secret_derive( TR_ASSERT(raw_handle != NULL); TR_ASSERT(hash != NULL); - struct tr_dh_secret* handle = raw_handle; + auto* handle = static_cast(raw_handle); return tr_sha1( hash, diff --git a/libtransmission/crypto-utils-openssl.c b/libtransmission/crypto-utils-openssl.cc similarity index 89% rename from libtransmission/crypto-utils-openssl.c rename to libtransmission/crypto-utils-openssl.cc index 87fa8ad9f..44c395356 100644 --- a/libtransmission/crypto-utils-openssl.c +++ b/libtransmission/crypto-utils-openssl.cc @@ -28,7 +28,7 @@ #include "utils.h" #define TR_CRYPTO_DH_SECRET_FALLBACK -#include "crypto-utils-fallback.c" +#include "crypto-utils-fallback.cc" /*** **** @@ -114,8 +114,10 @@ tr_sha1_ctx_t tr_sha1_init(void) return NULL; } -bool tr_sha1_update(tr_sha1_ctx_t handle, void const* data, size_t data_length) +bool tr_sha1_update(tr_sha1_ctx_t raw_handle, void const* data, size_t data_length) { + auto* handle = static_cast(raw_handle); + TR_ASSERT(handle != NULL); if (data_length == 0) @@ -128,8 +130,10 @@ bool tr_sha1_update(tr_sha1_ctx_t handle, void const* data, size_t data_length) return check_result(EVP_DigestUpdate(handle, data, data_length)); } -bool tr_sha1_final(tr_sha1_ctx_t handle, uint8_t* hash) +bool tr_sha1_final(tr_sha1_ctx_t raw_handle, uint8_t* hash) { + auto* handle = static_cast(raw_handle); + bool ret = true; if (hash != NULL) @@ -271,8 +275,10 @@ tr_dh_ctx_t tr_dh_new( return handle; } -void tr_dh_free(tr_dh_ctx_t handle) +void tr_dh_free(tr_dh_ctx_t raw_handle) { + auto* handle = static_cast(raw_handle); + if (handle == NULL) { return; @@ -286,7 +292,7 @@ bool tr_dh_make_key(tr_dh_ctx_t raw_handle, size_t private_key_length, uint8_t* TR_ASSERT(raw_handle != NULL); TR_ASSERT(public_key != NULL); - DH* handle = raw_handle; + auto* handle = static_cast(raw_handle); int dh_size; int my_public_key_length; BIGNUM const* my_public_key; @@ -313,8 +319,10 @@ bool tr_dh_make_key(tr_dh_ctx_t raw_handle, size_t private_key_length, uint8_t* return true; } -tr_dh_secret_t tr_dh_agree(tr_dh_ctx_t handle, uint8_t const* other_public_key, size_t other_public_key_length) +tr_dh_secret_t tr_dh_agree(tr_dh_ctx_t raw_handle, uint8_t const* other_public_key, size_t other_public_key_length) { + auto* handle = static_cast(raw_handle); + TR_ASSERT(handle != NULL); TR_ASSERT(other_public_key != NULL); @@ -358,7 +366,7 @@ tr_x509_store_t tr_ssl_get_x509_store(tr_ssl_ctx_t handle) return NULL; } - return SSL_CTX_get_cert_store(handle); + return SSL_CTX_get_cert_store(static_cast(handle)); } bool tr_x509_store_add(tr_x509_store_t handle, tr_x509_cert_t cert) @@ -366,7 +374,7 @@ bool tr_x509_store_add(tr_x509_store_t handle, tr_x509_cert_t cert) TR_ASSERT(handle != NULL); TR_ASSERT(cert != NULL); - return check_result(X509_STORE_add_cert(handle, cert)); + return check_result(X509_STORE_add_cert(static_cast(handle), static_cast(cert))); } tr_x509_cert_t tr_x509_cert_new(void const* der, size_t der_length) @@ -390,7 +398,7 @@ void tr_x509_cert_free(tr_x509_cert_t handle) return; } - X509_free(handle); + X509_free(static_cast(handle)); } /*** @@ -401,5 +409,5 @@ bool tr_rand_buffer(void* buffer, size_t length) { TR_ASSERT(buffer != NULL); - return check_result(RAND_bytes(buffer, (int)length)); + return check_result(RAND_bytes(static_cast(buffer), (int)length)); } diff --git a/libtransmission/crypto-utils-polarssl.c b/libtransmission/crypto-utils-polarssl.cc similarity index 89% rename from libtransmission/crypto-utils-polarssl.c rename to libtransmission/crypto-utils-polarssl.cc index 3de8cff12..1da16f513 100644 --- a/libtransmission/crypto-utils-polarssl.c +++ b/libtransmission/crypto-utils-polarssl.cc @@ -32,7 +32,7 @@ #define TR_CRYPTO_DH_SECRET_FALLBACK #define TR_CRYPTO_X509_FALLBACK -#include "crypto-utils-fallback.c" +#include "crypto-utils-fallback.cc" /*** **** @@ -148,8 +148,9 @@ tr_sha1_ctx_t tr_sha1_init(void) return handle; } -bool tr_sha1_update(tr_sha1_ctx_t handle, void const* data, size_t data_length) +bool tr_sha1_update(tr_sha1_ctx_t raw_handle, void const* data, size_t data_length) { + auto* handle = static_cast(raw_handle); TR_ASSERT(handle != NULL); if (data_length == 0) @@ -159,12 +160,14 @@ bool tr_sha1_update(tr_sha1_ctx_t handle, void const* data, size_t data_length) TR_ASSERT(data != NULL); - API(sha1_update)(handle, data, data_length); + API(sha1_update)(handle, static_cast(data), data_length); return true; } -bool tr_sha1_final(tr_sha1_ctx_t handle, uint8_t* hash) +bool tr_sha1_final(tr_sha1_ctx_t raw_handle, uint8_t* hash) { + auto* handle = static_cast(raw_handle); + if (hash != NULL) { TR_ASSERT(handle != NULL); @@ -211,8 +214,10 @@ tr_dh_ctx_t tr_dh_new( return handle; } -void tr_dh_free(tr_dh_ctx_t handle) +void tr_dh_free(tr_dh_ctx_t raw_handle) { + auto* handle = static_cast(raw_handle); + if (handle == NULL) { return; @@ -226,7 +231,7 @@ bool tr_dh_make_key(tr_dh_ctx_t raw_handle, size_t private_key_length, uint8_t* TR_ASSERT(raw_handle != NULL); TR_ASSERT(public_key != NULL); - api_dhm_context* handle = raw_handle; + auto* handle = static_cast(raw_handle); if (public_key_length != NULL) { @@ -241,7 +246,7 @@ tr_dh_secret_t tr_dh_agree(tr_dh_ctx_t raw_handle, uint8_t const* other_public_k TR_ASSERT(raw_handle != NULL); TR_ASSERT(other_public_key != NULL); - api_dhm_context* handle = raw_handle; + auto* handle = static_cast(raw_handle); struct tr_dh_secret* ret; size_t secret_key_length; @@ -286,7 +291,7 @@ bool tr_rand_buffer(void* buffer, size_t length) tr_lock* rng_lock = get_rng_lock(); tr_lockLock(rng_lock); - ret = check_result(API(ctr_drbg_random)(get_rng(), buffer, length)); + ret = check_result(API(ctr_drbg_random)(get_rng(), static_cast(buffer), length)); tr_lockUnlock(rng_lock); return ret; diff --git a/libtransmission/crypto-utils.c b/libtransmission/crypto-utils.cc similarity index 96% rename from libtransmission/crypto-utils.c rename to libtransmission/crypto-utils.cc index bc6ae0e72..593f87d23 100644 --- a/libtransmission/crypto-utils.c +++ b/libtransmission/crypto-utils.cc @@ -11,8 +11,12 @@ #include /* memcpy(), memmove(), memset(), strcmp(), strlen() */ #include + +extern "C" +{ #include #include +} #include "transmission.h" #include "crypto-utils.h" @@ -207,7 +211,7 @@ void* tr_base64_encode(void const* input, size_t input_length, size_t* output_le ret = tr_new(char, ret_length + 8); base64_init_encodestate(&state); - ret_length = base64_encode_block(input, input_length, ret, &state); + ret_length = base64_encode_block(static_cast(input), input_length, ret, &state); ret_length += base64_encode_blockend(ret + ret_length, &state); if (output_length != NULL) @@ -256,7 +260,7 @@ void* tr_base64_decode(void const* input, size_t input_length, size_t* output_le ret = tr_new(char, ret_length + 8); base64_init_decodestate(&state); - ret_length = base64_decode_block(input, input_length, ret, &state); + ret_length = base64_decode_block(static_cast(input), input_length, ret, &state); if (output_length != NULL) { diff --git a/libtransmission/crypto.c b/libtransmission/crypto.cc similarity index 100% rename from libtransmission/crypto.c rename to libtransmission/crypto.cc diff --git a/libtransmission/error.c b/libtransmission/error.cc similarity index 100% rename from libtransmission/error.c rename to libtransmission/error.cc diff --git a/libtransmission/fdlimit.c b/libtransmission/fdlimit.cc similarity index 97% rename from libtransmission/fdlimit.c rename to libtransmission/fdlimit.cc index e06ee4885..bc8fd2afd 100644 --- a/libtransmission/fdlimit.c +++ b/libtransmission/fdlimit.cc @@ -271,20 +271,12 @@ struct tr_fileset static void fileset_construct(struct tr_fileset* set, int n) { - struct tr_cached_file const TR_CACHED_FILE_INIT = { - .is_writable = false, - .fd = TR_BAD_SYS_FILE, - .torrent_id = 0, - .file_index = 0, - .used_at = 0, - }; - set->begin = tr_new(struct tr_cached_file, n); set->end = set->begin + n; for (struct tr_cached_file* o = set->begin; o != set->end; ++o) { - *o = TR_CACHED_FILE_INIT; + *o = { false, TR_BAD_SYS_FILE, 0, 0, 0 }; } } @@ -456,7 +448,7 @@ tr_sys_file_t tr_fdFileGetCached(tr_session* s, int torrent_id, tr_file_index_t bool tr_fdFileGetCachedMTime(tr_session* s, int torrent_id, tr_file_index_t i, time_t* mtime) { struct tr_cached_file const* o = fileset_lookup(get_fileset(s), torrent_id, i); - tr_sys_path_info info = { 0 }; + auto info = tr_sys_path_info{}; bool const success = o != NULL && tr_sys_file_get_info(o->fd, &info, NULL); if (success) @@ -560,7 +552,7 @@ tr_socket_t tr_fdSocketCreate(tr_session* session, int domain, int type) int i = 0; socklen_t size = sizeof(i); - if (getsockopt(s, SOL_SOCKET, SO_SNDBUF, (void*)&i, &size) != -1) + if (getsockopt(s, SOL_SOCKET, SO_SNDBUF, reinterpret_cast(&i), &size) != -1) { tr_logAddDebug("SO_SNDBUF size is %d", i); } @@ -568,7 +560,7 @@ tr_socket_t tr_fdSocketCreate(tr_session* session, int domain, int type) i = 0; size = sizeof(i); - if (getsockopt(s, SOL_SOCKET, SO_RCVBUF, (void*)&i, &size) != -1) + if (getsockopt(s, SOL_SOCKET, SO_RCVBUF, reinterpret_cast(&i), &size) != -1) { tr_logAddDebug("SO_RCVBUF size is %d", i); } diff --git a/libtransmission/file-posix.c b/libtransmission/file-posix.cc similarity index 98% rename from libtransmission/file-posix.c rename to libtransmission/file-posix.cc index c27f42b34..9a84b0aea 100644 --- a/libtransmission/file-posix.c +++ b/libtransmission/file-posix.cc @@ -513,7 +513,7 @@ bool tr_sys_path_copy(char const* src_path, char const* dst_path, tr_error** err /* Fallback to user-space copy. */ size_t const buflen = 1024 * 1024; /* 1024 KiB buffer */ - char* buf = tr_malloc(buflen); + auto* buf = static_cast(tr_malloc(buflen)); while (file_size > 0) { @@ -946,25 +946,20 @@ bool tr_sys_file_advise(tr_sys_file_t handle, uint64_t offset, uint64_t size, tr #elif defined(__APPLE__) - if (advice != TR_SYS_FILE_ADVICE_WILL_NEED) + if (advice == TR_SYS_FILE_ADVICE_WILL_NEED) { - goto skip_darwin_fcntl; + auto radv = radvisory{}; + radv.ra_offset = offset; + radv.ra_count = size; + + ret = fcntl(handle, F_RDADVISE, &radv) != -1; + + if (!ret) + { + set_system_error(error, errno); + } } - struct radvisory const radv = { - .ra_offset = offset, - .ra_count = size, - }; - - ret = fcntl(handle, F_RDADVISE, &radv) != -1; - - if (!ret) - { - set_system_error(error, errno); - } - -skip_darwin_fcntl: - #else TR_UNUSED(handle); @@ -1126,7 +1121,7 @@ bool tr_sys_file_lock(tr_sys_file_t handle, int operation, tr_error** error) #if defined(F_OFD_SETLK) - struct flock fl = { 0 }; + struct flock fl = {}; switch (operation & (TR_SYS_FILE_LOCK_SH | TR_SYS_FILE_LOCK_EX | TR_SYS_FILE_LOCK_UN)) { diff --git a/libtransmission/file-win32.c b/libtransmission/file-win32.cc similarity index 99% rename from libtransmission/file-win32.c rename to libtransmission/file-win32.cc index a1e39ccb9..8fb4db53c 100644 --- a/libtransmission/file-win32.c +++ b/libtransmission/file-win32.cc @@ -773,7 +773,7 @@ bool tr_sys_path_copy(char const* src_path, char const* dst_path, tr_error** err goto out; } - LPBOOL cancel = FALSE; + auto cancel = BOOL{ FALSE }; DWORD const flags = COPY_FILE_ALLOW_DECRYPTED_DESTINATION | COPY_FILE_FAIL_IF_EXISTS; if (CopyFileExW(wide_src_path, wide_dst_path, NULL, NULL, &cancel, flags) == 0) { @@ -1306,7 +1306,7 @@ bool tr_sys_file_lock(tr_sys_file_t handle, int operation, tr_error** error) !!(operation & TR_SYS_FILE_LOCK_SH) + !!(operation & TR_SYS_FILE_LOCK_EX) + !!(operation & TR_SYS_FILE_LOCK_UN) == 1); bool ret; - OVERLAPPED overlapped = { .Pointer = 0, .hEvent = NULL }; + auto overlapped = OVERLAPPED{}; if ((operation & TR_SYS_FILE_LOCK_UN) == 0) { diff --git a/libtransmission/file.c b/libtransmission/file.cc similarity index 100% rename from libtransmission/file.c rename to libtransmission/file.cc diff --git a/libtransmission/handshake.c b/libtransmission/handshake.cc similarity index 98% rename from libtransmission/handshake.c rename to libtransmission/handshake.cc index 3597bbc03..ac916e8ac 100644 --- a/libtransmission/handshake.c +++ b/libtransmission/handshake.cc @@ -567,7 +567,7 @@ static ReadState readPadD(tr_handshake* handshake, struct evbuffer* inbuf) tr_peerIoDrain(handshake->io, inbuf, needlen); - tr_peerIoSetEncryption(handshake->io, handshake->crypto_select); + tr_peerIoSetEncryption(handshake->io, static_cast(handshake->crypto_select)); setState(handshake, AWAITING_HANDSHAKE); return READ_NOW; @@ -999,12 +999,13 @@ static ReadState readPayloadStream(tr_handshake* handshake, struct evbuffer* inb **** ***/ -static ReadState canRead(struct tr_peerIo* io, void* arg, size_t* piece) +static ReadState canRead(struct tr_peerIo* io, void* vhandshake, size_t* piece) { TR_ASSERT(tr_isPeerIo(io)); ReadState ret; - tr_handshake* handshake = arg; + auto* handshake = static_cast(vhandshake); + struct evbuffer* inbuf = tr_peerIoGetReadBuffer(io); bool readyForMore = true; @@ -1141,7 +1142,7 @@ void tr_handshakeAbort(tr_handshake* handshake) static void gotError(tr_peerIo* io, short what, void* vhandshake) { int errcode = errno; - tr_handshake* handshake = vhandshake; + auto* handshake = static_cast(vhandshake); if (io->socket.type == TR_PEER_SOCKET_TYPE_UTP && !io->isIncoming && handshake->state == AWAITING_YB) { @@ -1204,7 +1205,7 @@ static void handshakeTimeout(evutil_socket_t s, short type, void* handshake) TR_UNUSED(s); TR_UNUSED(type); - tr_handshakeAbort(handshake); + tr_handshakeAbort(static_cast(handshake)); } tr_handshake* tr_handshakeNew(tr_peerIo* io, tr_encryption_mode encryptionMode, handshakeDoneCB doneCB, void* doneUserData) diff --git a/libtransmission/history.c b/libtransmission/history.cc similarity index 100% rename from libtransmission/history.c rename to libtransmission/history.cc diff --git a/libtransmission/inout.c b/libtransmission/inout.cc similarity index 93% rename from libtransmission/inout.c rename to libtransmission/inout.cc index adebabd77..7518f6f84 100644 --- a/libtransmission/inout.c +++ b/libtransmission/inout.cc @@ -92,7 +92,8 @@ static int readOrWriteBytes( { /* open (and maybe create) the file */ char* filename = tr_buildPath(base, subpath, NULL); - int const prealloc = (file->dnd || !doWrite) ? TR_PREALLOCATE_NONE : tor->session->preallocationMode; + tr_preallocation_mode const prealloc = (file->dnd || !doWrite) ? TR_PREALLOCATE_NONE : + tor->session->preallocationMode; if ((fd = tr_fdFileCheckout(session, tor->uniqueId, fileIndex, filename, doWrite, prealloc, file->length)) == TR_BAD_SYS_FILE) @@ -153,8 +154,8 @@ static int readOrWriteBytes( static int compareOffsetToFile(void const* a, void const* b) { - uint64_t const offset = *(uint64_t const*)a; - tr_file const* file = b; + auto const offset = *static_cast(a); + auto const* file = static_cast(b); if (offset < file->offset) { @@ -179,16 +180,14 @@ void tr_ioFindFileLocation( TR_ASSERT(tr_isTorrent(tor)); uint64_t const offset = tr_pieceOffset(tor, pieceIndex, pieceOffset, 0); - TR_ASSERT(offset < tor->info.totalSize); - tr_file const* file = bsearch(&offset, tor->info.files, tor->info.fileCount, sizeof(tr_file), compareOffsetToFile); - + auto const* file = static_cast( + bsearch(&offset, tor->info.files, tor->info.fileCount, sizeof(tr_file), compareOffsetToFile)); TR_ASSERT(file != NULL); *fileIndex = file - tor->info.files; *fileOffset = offset - file->offset; - TR_ASSERT(*fileIndex < tor->info.fileCount); TR_ASSERT(*fileOffset < file->length); TR_ASSERT(tor->info.files[*fileIndex].offset + *fileOffset == offset); @@ -280,7 +279,7 @@ static bool recalculateHash(tr_torrent* tor, tr_piece_index_t pieceIndex, uint8_ while (bytesLeft != 0) { size_t const len = MIN(bytesLeft, buflen); - success = tr_cacheReadBlock(tor->session->cache, tor, pieceIndex, offset, len, buffer) == 0; + success = tr_cacheReadBlock(tor->session->cache, tor, pieceIndex, offset, len, static_cast(buffer)) == 0; if (!success) { diff --git a/libtransmission/list.c b/libtransmission/list.cc similarity index 96% rename from libtransmission/list.c rename to libtransmission/list.cc index 1f2e44f43..8572bbbb2 100644 --- a/libtransmission/list.c +++ b/libtransmission/list.cc @@ -11,12 +11,6 @@ #include "platform.h" #include "utils.h" -static tr_list const TR_LIST_CLEAR = { - .data = NULL, - .next = NULL, - .prev = NULL, -}; - static tr_list* recycled_nodes = NULL; static tr_lock* getRecycledNodesLock(void) @@ -51,7 +45,7 @@ static tr_list* node_alloc(void) ret = tr_new(tr_list, 1); } - *ret = TR_LIST_CLEAR; + *ret = {}; return ret; } @@ -61,7 +55,7 @@ static void node_free(tr_list* node) if (node != NULL) { - *node = TR_LIST_CLEAR; + *node = {}; tr_lockLock(lock); node->next = recycled_nodes; recycled_nodes = node; diff --git a/libtransmission/log.c b/libtransmission/log.cc similarity index 100% rename from libtransmission/log.c rename to libtransmission/log.cc diff --git a/libtransmission/magnet.c b/libtransmission/magnet.cc similarity index 97% rename from libtransmission/magnet.c rename to libtransmission/magnet.cc index 369a3ccbd..024958711 100644 --- a/libtransmission/magnet.c +++ b/libtransmission/magnet.cc @@ -206,9 +206,9 @@ tr_magnet_info* tr_magnetParse(char const* uri) info = tr_new0(tr_magnet_info, 1); info->displayName = displayName; info->trackerCount = trCount; - info->trackers = tr_memdup(tr, sizeof(char*) * trCount); + info->trackers = static_cast(tr_memdup(tr, sizeof(char*) * trCount)); info->webseedCount = wsCount; - info->webseeds = tr_memdup(ws, sizeof(char*) * wsCount); + info->webseeds = static_cast(tr_memdup(ws, sizeof(char*) * wsCount)); memcpy(info->hash, sha1, sizeof(uint8_t) * SHA_DIGEST_LENGTH); } else diff --git a/libtransmission/makemeta.c b/libtransmission/makemeta.cc similarity index 97% rename from libtransmission/makemeta.c rename to libtransmission/makemeta.cc index 4dc4f9c58..d8283fbe5 100644 --- a/libtransmission/makemeta.c +++ b/libtransmission/makemeta.cc @@ -126,8 +126,8 @@ static uint32_t bestPieceSize(uint64_t totalSize) static int builderFileCompare(void const* va, void const* vb) { - tr_metainfo_builder_file const* a = va; - tr_metainfo_builder_file const* b = vb; + auto const* a = static_cast(va); + auto const* b = static_cast(vb); return evutil_ascii_strcasecmp(a->filename, b->filename); } @@ -254,10 +254,7 @@ static uint8_t* getHashInfo(tr_metainfo_builder* b) uint32_t fileIndex = 0; uint8_t* ret = tr_new0(uint8_t, SHA_DIGEST_LENGTH * b->pieceCount); uint8_t* walk = ret; - uint8_t* buf; - uint64_t totalRemain; uint64_t off = 0; - tr_sys_file_t fd; tr_error* error = NULL; if (b->totalSize == 0) @@ -265,11 +262,11 @@ static uint8_t* getHashInfo(tr_metainfo_builder* b) return ret; } - buf = tr_malloc(b->pieceSize); + auto* const buf = static_cast(tr_malloc(b->pieceSize)); b->pieceIndex = 0; - totalRemain = b->totalSize; - fd = tr_sys_file_open(b->files[fileIndex].filename, TR_SYS_FILE_READ | TR_SYS_FILE_SEQUENTIAL, 0, &error); + uint64_t totalRemain = b->totalSize; + tr_sys_file_t fd = tr_sys_file_open(b->files[fileIndex].filename, TR_SYS_FILE_READ | TR_SYS_FILE_SEQUENTIAL, 0, &error); if (fd == TR_BAD_SYS_FILE) { b->my_errno = error->code; @@ -589,7 +586,7 @@ void tr_makeMetaInfo( /* initialize the builder variables */ builder->abortFlag = false; - builder->result = 0; + builder->result = TR_MAKEMETA_OK; builder->isDone = false; builder->pieceIndex = 0; builder->trackerCount = trackerCount; diff --git a/libtransmission/metainfo.c b/libtransmission/metainfo.cc similarity index 100% rename from libtransmission/metainfo.c rename to libtransmission/metainfo.cc diff --git a/libtransmission/mime-types.c b/libtransmission/mime-types.cc similarity index 100% rename from libtransmission/mime-types.c rename to libtransmission/mime-types.cc diff --git a/libtransmission/natpmp.c b/libtransmission/natpmp.cc similarity index 97% rename from libtransmission/natpmp.c rename to libtransmission/natpmp.cc index bf5d70c93..6425a5846 100644 --- a/libtransmission/natpmp.c +++ b/libtransmission/natpmp.cc @@ -115,9 +115,9 @@ static void setCommandTime(struct tr_natpmp* nat) nat->command_time = tr_time() + COMMAND_WAIT_SECS; } -int tr_natpmpPulse(struct tr_natpmp* nat, tr_port private_port, bool is_enabled, tr_port* public_port) +tr_port_forwarding tr_natpmpPulse(struct tr_natpmp* nat, tr_port private_port, bool is_enabled, tr_port* public_port) { - int ret; + tr_port_forwarding ret; if (is_enabled && nat->state == TR_NATPMP_DISCOVER) { diff --git a/libtransmission/natpmp_local.h b/libtransmission/natpmp_local.h index 4f5a55751..2dc970423 100644 --- a/libtransmission/natpmp_local.h +++ b/libtransmission/natpmp_local.h @@ -23,6 +23,6 @@ tr_natpmp* tr_natpmpInit(void); void tr_natpmpClose(tr_natpmp*); -int tr_natpmpPulse(tr_natpmp*, tr_port port, bool isEnabled, tr_port* public_port); +tr_port_forwarding tr_natpmpPulse(tr_natpmp*, tr_port port, bool isEnabled, tr_port* public_port); /* @} */ diff --git a/libtransmission/net.c b/libtransmission/net.cc similarity index 94% rename from libtransmission/net.c rename to libtransmission/net.cc index 0def9cab1..6566b7da2 100644 --- a/libtransmission/net.c +++ b/libtransmission/net.cc @@ -52,15 +52,9 @@ #define IN_MULTICAST(a) (((a)&0xf0000000) == 0xe0000000) #endif -tr_address const tr_in6addr_any = { - .type = TR_AF_INET6, - .addr.addr6 = IN6ADDR_ANY_INIT, -}; +tr_address const tr_in6addr_any = { TR_AF_INET6, { IN6ADDR_ANY_INIT } }; -tr_address const tr_inaddr_any = { - .type = TR_AF_INET, - .addr.addr4.s_addr = INADDR_ANY, -}; +tr_address const tr_inaddr_any = { TR_AF_INET, { { { { INADDR_ANY } } } } }; char* tr_net_strerror(char* buf, size_t buflen, int err) { @@ -279,7 +273,7 @@ struct tr_peer_socket tr_netOpenPeerSocket(tr_session* session, tr_address const { TR_ASSERT(tr_address_is_valid(addr)); - struct tr_peer_socket ret = TR_PEER_SOCKET_INIT; + auto ret = tr_peer_socket{}; static int const domains[NUM_TR_AF_INET_TYPES] = { AF_INET, AF_INET6 }; tr_socket_t s; @@ -307,7 +301,7 @@ struct tr_peer_socket tr_netOpenPeerSocket(tr_session* session, tr_address const { int n = 8192; - if (setsockopt(s, SOL_SOCKET, SO_RCVBUF, (void const*)&n, sizeof(n)) == -1) + if (setsockopt(s, SOL_SOCKET, SO_RCVBUF, reinterpret_cast(&n), sizeof(n)) == -1) { tr_logAddInfo( "Unable to set SO_RCVBUF on socket %" PRIdMAX ": %s", @@ -380,7 +374,7 @@ struct tr_peer_socket tr_netOpenPeerUTPSocket(tr_session* session, tr_address co { TR_UNUSED(clientIsSeed); - struct tr_peer_socket ret = TR_PEER_SOCKET_INIT; + auto ret = tr_peer_socket{}; if (tr_address_is_valid_for_peers(addr, port)) { @@ -423,13 +417,13 @@ static tr_socket_t tr_netBindTCPImpl(tr_address const* addr, tr_port port, bool } optval = 1; - (void)setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, (void const*)&optval, sizeof(optval)); - (void)setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (void const*)&optval, sizeof(optval)); + (void)setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, reinterpret_cast(&optval), sizeof(optval)); + (void)setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, reinterpret_cast(&optval), sizeof(optval)); #ifdef IPV6_V6ONLY if ((addr->type == TR_AF_INET6) && - (setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, (void const*)&optval, sizeof(optval)) == -1) && + (setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, reinterpret_cast(&optval), sizeof(optval)) == -1) && (sockerrno != ENOPROTOOPT)) // if the kernel doesn't support it, ignore it { *errOut = sockerrno; @@ -489,7 +483,7 @@ static tr_socket_t tr_netBindTCPImpl(tr_address const* addr, tr_port port, bool #endif optval = 5; - (void)setsockopt(fd, SOL_TCP, TCP_FASTOPEN, (void const*)&optval, sizeof(optval)); + (void)setsockopt(fd, SOL_TCP, TCP_FASTOPEN, reinterpret_cast(&optval), sizeof(optval)); #endif @@ -756,7 +750,7 @@ static bool isMartianAddr(struct tr_address const* a) { TR_ASSERT(tr_address_is_valid(a)); - static unsigned char const zeroes[16] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + static unsigned char const zeroes[16] = {}; switch (a->type) { @@ -786,13 +780,15 @@ bool tr_address_is_valid_for_peers(tr_address const* addr, tr_port port) struct tr_peer_socket tr_peer_socket_tcp_create(tr_socket_t const handle) { TR_ASSERT(handle != TR_BAD_SOCKET); - struct tr_peer_socket const ret = { .type = TR_PEER_SOCKET_TYPE_TCP, .handle.tcp = handle }; - return ret; + + return { TR_PEER_SOCKET_TYPE_TCP, { handle } }; } struct tr_peer_socket tr_peer_socket_utp_create(struct UTPSocket* const handle) { TR_ASSERT(handle != NULL); - struct tr_peer_socket const ret = { .type = TR_PEER_SOCKET_TYPE_UTP, .handle.utp = handle }; + + auto ret = tr_peer_socket{ TR_PEER_SOCKET_TYPE_UTP, {} }; + ret.handle.utp = handle; return ret; } diff --git a/libtransmission/peer-common.h b/libtransmission/peer-common.h index 71d45aa69..266b8eb5b 100644 --- a/libtransmission/peer-common.h +++ b/libtransmission/peer-common.h @@ -66,8 +66,6 @@ typedef struct tr_port port; /* for GOT_PORT */ } tr_peer_event; -extern tr_peer_event const TR_PEER_EVENT_INIT; - typedef void (*tr_peer_callback)(struct tr_peer* peer, tr_peer_event const* event, void* client_data); /*** @@ -150,8 +148,6 @@ typedef struct tr_swarm_stats int peerFromCount[TR_PEER_FROM__MAX]; } tr_swarm_stats; -extern tr_swarm_stats const TR_SWARM_STATS_INIT; - void tr_swarmGetStats(struct tr_swarm const* swarm, tr_swarm_stats* setme); void tr_swarmIncrementActivePeers(struct tr_swarm* swarm, tr_direction direction, bool is_active); diff --git a/libtransmission/peer-io.c b/libtransmission/peer-io.cc similarity index 95% rename from libtransmission/peer-io.c rename to libtransmission/peer-io.cc index bf0800c74..83d9c5c3b 100644 --- a/libtransmission/peer-io.c +++ b/libtransmission/peer-io.cc @@ -94,12 +94,6 @@ struct tr_datatype static struct tr_datatype* datatype_pool = NULL; -static struct tr_datatype const TR_DATATYPE_INIT = { - .next = NULL, - .length = 0, - .isPieceData = false, -}; - static struct tr_datatype* datatype_new(void) { struct tr_datatype* ret; @@ -114,7 +108,7 @@ static struct tr_datatype* datatype_new(void) datatype_pool = datatype_pool->next; } - *ret = TR_DATATYPE_INIT; + *ret = {}; return ret; } @@ -272,7 +266,7 @@ static void event_read_cb(evutil_socket_t fd, short event, void* vio) { TR_UNUSED(event); - tr_peerIo* io = vio; + auto* io = static_cast(vio); TR_ASSERT(tr_isPeerIo(io)); TR_ASSERT(io->socket.type == TR_PEER_SOCKET_TYPE_TCP); @@ -365,7 +359,7 @@ static void event_write_cb(evutil_socket_t fd, short event, void* vio) { TR_UNUSED(event); - tr_peerIo* io = vio; + auto* io = static_cast(vio); TR_ASSERT(tr_isPeerIo(io)); TR_ASSERT(io->socket.type == TR_PEER_SOCKET_TYPE_TCP); @@ -458,9 +452,9 @@ static void maybeSetCongestionAlgorithm(tr_socket_t socket, char const* algorith #ifdef WITH_UTP /* UTP callbacks */ -static void utp_on_read(void* closure, unsigned char const* buf, size_t buflen) +static void utp_on_read(void* vio, unsigned char const* buf, size_t buflen) { - tr_peerIo* io = closure; + auto* io = static_cast(vio); TR_ASSERT(tr_isPeerIo(io)); @@ -477,9 +471,9 @@ static void utp_on_read(void* closure, unsigned char const* buf, size_t buflen) canReadWrapper(io); } -static void utp_on_write(void* closure, unsigned char* buf, size_t buflen) +static void utp_on_write(void* vio, unsigned char* buf, size_t buflen) { - tr_peerIo* io = closure; + auto* io = static_cast(vio); TR_ASSERT(tr_isPeerIo(io)); @@ -495,9 +489,9 @@ static void utp_on_write(void* closure, unsigned char* buf, size_t buflen) didWriteWrapper(io, buflen); } -static size_t utp_get_rb_size(void* closure) +static size_t utp_get_rb_size(void* vio) { - tr_peerIo const* const io = closure; + auto const* const io = static_cast(vio); TR_ASSERT(tr_isPeerIo(io)); @@ -519,9 +513,9 @@ static void utp_on_writable(tr_peerIo* io) tr_peerIoSetEnabled(io, TR_UP, n != 0 && evbuffer_get_length(io->outbuf) != 0); } -static void utp_on_state_change(void* closure, int state) +static void utp_on_state_change(void* vio, int state) { - tr_peerIo* io = closure; + auto* io = static_cast(vio); TR_ASSERT(tr_isPeerIo(io)); @@ -557,9 +551,9 @@ static void utp_on_state_change(void* closure, int state) } } -static void utp_on_error(void* closure, int errcode) +static void utp_on_error(void* vio, int errcode) { - tr_peerIo* io = closure; + auto* io = static_cast(vio); TR_ASSERT(tr_isPeerIo(io)); @@ -572,11 +566,11 @@ static void utp_on_error(void* closure, int errcode) } } -static void utp_on_overhead(void* closure, uint8_t /* bool */ send, size_t count, int type) +static void utp_on_overhead(void* vio, bool send, size_t count, int type) { TR_UNUSED(type); - tr_peerIo* io = closure; + auto* io = static_cast(vio); TR_ASSERT(tr_isPeerIo(io)); @@ -585,13 +579,8 @@ static void utp_on_overhead(void* closure, uint8_t /* bool */ send, size_t count tr_bandwidthUsed(&io->bandwidth, send ? TR_UP : TR_DOWN, count, false, tr_time_msec()); } -static struct UTPFunctionTable utp_function_table = { - .on_read = utp_on_read, - .on_write = utp_on_write, - .get_rb_size = utp_get_rb_size, - .on_state = utp_on_state_change, - .on_error = utp_on_error, - .on_overhead = utp_on_overhead, +static auto utp_function_table = UTPFunctionTable{ + utp_on_read, utp_on_write, utp_get_rb_size, utp_on_state_change, utp_on_error, utp_on_overhead, }; /* Dummy UTP callbacks. */ @@ -637,7 +626,7 @@ static void dummy_on_error(void* closure, int errcode) TR_UNUSED(errcode); } -static void dummy_on_overhead(void* closure, uint8_t /* bool */ send, size_t count, int type) +static void dummy_on_overhead(void* closure, bool send, size_t count, int type) { TR_UNUSED(closure); TR_UNUSED(send); @@ -645,13 +634,8 @@ static void dummy_on_overhead(void* closure, uint8_t /* bool */ send, size_t cou TR_UNUSED(type); } -static struct UTPFunctionTable dummy_utp_function_table = { - .on_read = dummy_read, - .on_write = dummy_write, - .get_rb_size = dummy_get_rb_size, - .on_state = dummy_on_state_change, - .on_error = dummy_on_error, - .on_overhead = dummy_on_overhead, +static auto dummy_utp_function_table = UTPFunctionTable{ + dummy_read, dummy_write, dummy_get_rb_size, dummy_on_state_change, dummy_on_error, dummy_on_overhead, }; #endif /* #ifdef WITH_UTP */ @@ -758,7 +742,7 @@ tr_peerIo* tr_peerIoNewOutgoing( TR_ASSERT(tr_address_is_valid(addr)); TR_ASSERT(torrentHash != NULL); - struct tr_peer_socket socket = TR_PEER_SOCKET_INIT; + auto socket = tr_peer_socket{}; if (utp) { @@ -911,7 +895,7 @@ static void io_close_socket(tr_peerIo* io) TR_ASSERT_MSG(false, "unsupported peer socket type %d", io->socket.type); } - io->socket = TR_PEER_SOCKET_INIT; + io->socket = {}; if (io->event_read != NULL) { @@ -928,7 +912,7 @@ static void io_close_socket(tr_peerIo* io) static void io_dtor(void* vio) { - tr_peerIo* io = vio; + auto* io = static_cast(vio); TR_ASSERT(tr_isPeerIo(io)); TR_ASSERT(tr_amInEventThread(io->session)); diff --git a/libtransmission/peer-mgr.c b/libtransmission/peer-mgr.cc similarity index 95% rename from libtransmission/peer-mgr.c rename to libtransmission/peer-mgr.cc index d7c257854..0f14233db 100644 --- a/libtransmission/peer-mgr.c +++ b/libtransmission/peer-mgr.cc @@ -82,23 +82,6 @@ enum CANCEL_HISTORY_SEC = 60 }; -tr_peer_event const TR_PEER_EVENT_INIT = { - .eventType = TR_PEER_CLIENT_GOT_BLOCK, - .pieceIndex = 0, - .bitfield = NULL, - .offset = 0, - .length = 0, - .err = 0, - .port = 0, -}; - -tr_swarm_stats const TR_SWARM_STATS_INIT = { - .activePeerCount = { 0, 0 }, - .activeWebseedCount = 0, - .peerCount = 0, - .peerFromCount = { 0, 0, 0, 0, 0, 0, 0 }, -}; - /** *** **/ @@ -339,14 +322,16 @@ static inline bool swarmIsLocked(tr_swarm const* swarm) static int handshakeCompareToAddr(void const* va, void const* vb) { - tr_handshake const* a = va; + auto const* const a = static_cast(va); + auto const* const b = static_cast(vb); - return tr_address_compare(tr_handshakeGetAddr(a, NULL), vb); + return tr_address_compare(tr_handshakeGetAddr(a, nullptr), b); } -static int handshakeCompare(void const* a, void const* b) +static int handshakeCompare(void const* va, void const* vb) { - return handshakeCompareToAddr(a, tr_handshakeGetAddr(b, NULL)); + auto const* const b = static_cast(vb); + return handshakeCompareToAddr(va, tr_handshakeGetAddr(b, nullptr)); } static inline tr_handshake* getExistingHandshake(tr_ptrArray* handshakes, tr_address const* addr) @@ -356,19 +341,20 @@ static inline tr_handshake* getExistingHandshake(tr_ptrArray* handshakes, tr_add return NULL; } - return tr_ptrArrayFindSorted(handshakes, addr, handshakeCompareToAddr); + return static_cast(tr_ptrArrayFindSorted(handshakes, addr, handshakeCompareToAddr)); } static int comparePeerAtomToAddress(void const* va, void const* vb) { - struct peer_atom const* a = va; + auto const* const a = static_cast(va); + auto const* const b = static_cast(vb); - return tr_address_compare(&a->addr, vb); + return tr_address_compare(&a->addr, b); } static int compareAtomsByAddress(void const* va, void const* vb) { - struct peer_atom const* b = vb; + auto const* const b = static_cast(vb); TR_ASSERT(tr_isAtom(b)); @@ -391,15 +377,17 @@ static tr_swarm* getExistingSwarm(tr_peerMgr* manager, uint8_t const* hash) return tor == NULL ? NULL : tor->swarm; } -static int peerCompare(void const* a, void const* b) +static int peerCompare(void const* va, void const* vb) { + auto const* const a = static_cast(va); + auto const* const b = static_cast(vb); return tr_address_compare(tr_peerAddress(a), tr_peerAddress(b)); } static struct peer_atom* getExistingAtom(tr_swarm const* cswarm, tr_address const* addr) { tr_swarm* swarm = (tr_swarm*)cswarm; - return tr_ptrArrayFindSorted(&swarm->pool, addr, comparePeerAtomToAddress); + return static_cast(tr_ptrArrayFindSorted(&swarm->pool, addr, comparePeerAtomToAddress)); } static bool peerIsInUse(tr_swarm const* cs, struct peer_atom const* atom) @@ -440,7 +428,7 @@ static void replicationNew(tr_swarm* s) for (int peer_i = 0; peer_i < n; ++peer_i) { - tr_peer const* const peer = tr_ptrArrayNth(&s->peers, peer_i); + auto const* const peer = static_cast(tr_ptrArrayNth(&s->peers, peer_i)); if (tr_bitfieldHas(&peer->have, piece_i)) { @@ -454,7 +442,7 @@ static void replicationNew(tr_swarm* s) static void swarmFree(void* vs) { - tr_swarm* s = vs; + auto* s = static_cast(vs); TR_ASSERT(s != NULL); TR_ASSERT(!s->isRunning); @@ -466,7 +454,7 @@ static void swarmFree(void* vs) tr_ptrArrayDestruct(&s->pool, (PtrArrayForeachFunc)tr_free); tr_ptrArrayDestruct(&s->outgoingHandshakes, NULL); tr_ptrArrayDestruct(&s->peers, NULL); - s->stats = TR_SWARM_STATS_INIT; + s->stats = {}; replicationFree(s); @@ -483,7 +471,7 @@ static void rebuildWebseedArray(tr_swarm* s, tr_torrent* tor) /* clear the array */ tr_ptrArrayDestruct(&s->webseeds, (PtrArrayForeachFunc)tr_peerFree); - s->webseeds = TR_PTR_ARRAY_INIT; + s->webseeds = {}; s->stats.activeWebseedCount = 0; /* repopulate it */ @@ -501,10 +489,10 @@ static tr_swarm* swarmNew(tr_peerMgr* manager, tr_torrent* tor) s = tr_new0(tr_swarm, 1); s->manager = manager; s->tor = tor; - s->pool = TR_PTR_ARRAY_INIT; - s->peers = TR_PTR_ARRAY_INIT; - s->webseeds = TR_PTR_ARRAY_INIT; - s->outgoingHandshakes = TR_PTR_ARRAY_INIT; + s->pool = {}; + s->peers = {}; + s->webseeds = {}; + s->outgoingHandshakes = {}; rebuildWebseedArray(s, tor); @@ -517,7 +505,7 @@ tr_peerMgr* tr_peerMgrNew(tr_session* session) { tr_peerMgr* m = tr_new0(tr_peerMgr, 1); m->session = session; - m->incomingHandshakes = TR_PTR_ARRAY_INIT; + m->incomingHandshakes = {}; ensureMgrTimersExist(m); return m; } @@ -549,7 +537,7 @@ void tr_peerMgrFree(tr_peerMgr* manager) * the item from manager->handshakes, so this is a little roundabout... */ while (!tr_ptrArrayEmpty(&manager->incomingHandshakes)) { - tr_handshakeAbort(tr_ptrArrayNth(&manager->incomingHandshakes, 0)); + tr_handshakeAbort(static_cast(tr_ptrArrayNth(&manager->incomingHandshakes, 0))); } tr_ptrArrayDestruct(&manager->incomingHandshakes, NULL); @@ -575,7 +563,7 @@ void tr_peerMgrOnBlocklistChanged(tr_peerMgr* mgr) for (int i = 0, n = tr_ptrArraySize(&s->pool); i < n; ++i) { - struct peer_atom* atom = tr_ptrArrayNth(&s->pool, i); + auto* const atom = static_cast(tr_ptrArrayNth(&s->pool, i)); atom->blocklisted = -1; } } @@ -662,8 +650,8 @@ void tr_peerMgrSetUtpFailed(tr_torrent* tor, tr_address const* addr, bool failed static int compareReqByBlock(void const* va, void const* vb) { - struct block_request const* a = va; - struct block_request const* b = vb; + auto const* const a = static_cast(va); + auto const* const b = static_cast(vb); /* primary key: block */ if (a->block < b->block) @@ -730,7 +718,8 @@ static struct block_request* requestListLookup(tr_swarm* s, tr_block_index_t blo key.block = block; key.peer = (tr_peer*)peer; - return bsearch(&key, s->requests, s->requestCount, sizeof(struct block_request), compareReqByBlock); + return static_cast( + bsearch(&key, s->requests, s->requestCount, sizeof(struct block_request), compareReqByBlock)); } /** @@ -794,7 +783,7 @@ static int countActiveWebseeds(tr_swarm* s) for (int i = 0, n = tr_ptrArraySize(&s->webseeds); i < n; ++i) { - if (tr_peerIsTransferringPieces(tr_ptrArrayNth(&s->webseeds, i), now, TR_DOWN, NULL)) + if (tr_peerIsTransferringPieces(static_cast(tr_ptrArrayNth(&s->webseeds, i)), now, TR_DOWN, NULL)) { ++activeCount; } @@ -827,7 +816,7 @@ static void updateEndgame(tr_swarm* s) /* add the active bittorrent peers... */ for (int i = 0, n = tr_ptrArraySize(&s->peers); i < n; ++i) { - tr_peer const* p = tr_ptrArrayNth(&s->peers, i); + auto const* const p = static_cast(tr_ptrArrayNth(&s->peers, i)); if (p->pendingReqsToPeer > 0) { @@ -873,8 +862,8 @@ static void setComparePieceByWeightTorrent(tr_swarm* s) * and that partially-complete pieces come before empty ones. */ static int comparePieceByWeight(void const* va, void const* vb) { - struct weighted_piece const* a = va; - struct weighted_piece const* b = vb; + auto const* const a = static_cast(va); + auto const* const b = static_cast(vb); int ia; int ib; int missing; @@ -945,8 +934,8 @@ static int comparePieceByWeight(void const* va, void const* vb) static int comparePieceByIndex(void const* va, void const* vb) { - struct weighted_piece const* a = va; - struct weighted_piece const* b = vb; + auto const* const a = static_cast(va); + auto const* const b = static_cast(vb); if (a->index < b->index) { @@ -1356,7 +1345,7 @@ void tr_peerMgrGetNextRequests( { tr_block_index_t first; tr_block_index_t last; - tr_ptrArray peerArr = TR_PTR_ARRAY_INIT; + tr_ptrArray peerArr = {}; tr_torGetPieceBlockRange(tor, p->index, &first, &last); @@ -1490,7 +1479,7 @@ static void refillUpkeep(evutil_socket_t fd, short what, void* vmgr) tr_torrent* tor; int cancel_buflen = 0; struct block_request* cancel = NULL; - tr_peerMgr* mgr = vmgr; + auto* mgr = static_cast(vmgr); managerLock(mgr); now = tr_time(); @@ -1684,13 +1673,11 @@ static void peerDeclinedAllRequests(tr_swarm* s, tr_peer const* peer) static void cancelAllRequestsForBlock(tr_swarm* s, tr_block_index_t block, tr_peer* no_notify) { - int peerCount; - tr_peer** peers; - tr_ptrArray peerArr; - - peerArr = TR_PTR_ARRAY_INIT; + auto peerArr = tr_ptrArray{}; getBlockRequestPeers(s, block, &peerArr); - peers = (tr_peer**)tr_ptrArrayPeek(&peerArr, &peerCount); + + int peerCount; + tr_peer** peers = (tr_peer**)tr_ptrArrayPeek(&peerArr, &peerCount); for (int i = 0; i < peerCount; ++i) { @@ -1716,7 +1703,7 @@ void tr_peerMgrPieceCompleted(tr_torrent* tor, tr_piece_index_t p) /* walk through our peers */ for (int i = 0, n = tr_ptrArraySize(&s->peers); i < n; ++i) { - tr_peer* peer = tr_ptrArrayNth(&s->peers, i); + auto* peer = static_cast(tr_ptrArrayNth(&s->peers, i)); /* notify the peer that we now have this piece */ tr_peerMsgsHave(PEER_MSGS(peer), p); @@ -1741,7 +1728,7 @@ static void peerCallbackFunc(tr_peer* peer, tr_peer_event const* e, void* vs) { TR_ASSERT(peer != NULL); - tr_swarm* s = vs; + auto* s = static_cast(vs); swarmLock(s); @@ -2014,7 +2001,7 @@ static bool myHandshakeDoneCB( bool success = false; tr_port port; tr_address const* addr; - tr_peerMgr* manager = vmanager; + auto* manager = static_cast(vmanager); tr_swarm* s = tr_peerIoHasTorrentHash(io) ? getExistingSwarm(manager, tr_peerIoGetTorrentHash(io)) : NULL; if (tr_peerIoIsIncoming(io)) @@ -2225,7 +2212,7 @@ tr_pex* tr_peerMgrCompactToPex( size_t* pexCount) { size_t n = compactLen / 6; - uint8_t const* walk = compact; + auto const* walk = static_cast(compact); tr_pex* pex = tr_new0(tr_pex, n); for (size_t i = 0; i < n; ++i) @@ -2254,7 +2241,7 @@ tr_pex* tr_peerMgrCompact6ToPex( size_t* pexCount) { size_t n = compactLen / 18; - uint8_t const* walk = compact; + auto const* walk = static_cast(compact); tr_pex* pex = tr_new0(tr_pex, n); for (size_t i = 0; i < n; ++i) @@ -2286,7 +2273,7 @@ void tr_peerMgrGotBadPiece(tr_torrent* tor, tr_piece_index_t pieceIndex) for (int i = 0, n = tr_ptrArraySize(&s->peers); i != n; ++i) { - tr_peer* peer = tr_ptrArrayNth(&s->peers, i); + auto* const peer = static_cast(tr_ptrArrayNth(&s->peers, i)); if (tr_bitfieldHas(&peer->blame, pieceIndex)) { @@ -2305,8 +2292,8 @@ void tr_peerMgrGotBadPiece(tr_torrent* tor, tr_piece_index_t pieceIndex) int tr_pexCompare(void const* va, void const* vb) { - tr_pex const* a = va; - tr_pex const* b = vb; + auto const* const a = static_cast(va); + auto const* const b = static_cast(vb); TR_ASSERT(tr_isPex(a)); TR_ASSERT(tr_isPex(b)); @@ -2528,7 +2515,7 @@ static void stopSwarm(tr_swarm* swarm) * which removes the handshake from t->outgoingHandshakes... */ while (!tr_ptrArrayEmpty(&swarm->outgoingHandshakes)) { - tr_handshakeAbort(tr_ptrArrayNth(&swarm->outgoingHandshakes, 0)); + tr_handshakeAbort(static_cast(tr_ptrArrayNth(&swarm->outgoingHandshakes, 0))); } } @@ -2782,8 +2769,9 @@ double* tr_peerMgrWebSpeeds_KBps(tr_torrent const* tor) for (unsigned int i = 0; i < n; ++i) { unsigned int Bps = 0; + auto const* const peer = static_cast(tr_ptrArrayNth(&s->webseeds, i)); - if (tr_peerIsTransferringPieces(tr_ptrArrayNth(&s->webseeds, i), now, TR_DOWN, &Bps)) + if (tr_peerIsTransferringPieces(peer, now, TR_DOWN, &Bps)) { ret[i] = Bps / (double)tr_speed_K; } @@ -2924,7 +2912,7 @@ void tr_peerMgrClearInterest(tr_torrent* tor) for (int i = 0; i < peerCount; ++i) { - tr_peerMsgsSetInterested(tr_ptrArrayNth(&s->peers, i), false); + tr_peerMsgsSetInterested(static_cast(tr_ptrArrayNth(&s->peers, i)), false); } } @@ -2967,8 +2955,8 @@ struct tr_rechoke_info static int compare_rechoke_info(void const* va, void const* vb) { - struct tr_rechoke_info const* a = va; - struct tr_rechoke_info const* b = vb; + auto const* const a = static_cast(va); + auto const* const b = static_cast(vb); if (a->rechoke_state != b->rechoke_state) { @@ -3021,7 +3009,7 @@ static void rechokeDownloads(tr_swarm* s) */ for (int i = 0; i < peerCount; ++i) { - tr_peer const* peer = tr_ptrArrayNth(&s->peers, i); + auto const* const peer = static_cast(tr_ptrArrayNth(&s->peers, i)); int const b = tr_historyGet(&peer->blocksSentToClient, now, CANCEL_HISTORY_SEC); int const c = tr_historyGet(&peer->cancelsSentToPeer, now, CANCEL_HISTORY_SEC); @@ -3096,7 +3084,7 @@ static void rechokeDownloads(tr_swarm* s) /* decide WHICH peers to be interested in (based on their cancel-to-block ratio) */ for (int i = 0; i < peerCount; ++i) { - tr_peer* peer = tr_ptrArrayNth(&s->peers, i); + auto* const peer = static_cast(tr_ptrArrayNth(&s->peers, i)); if (!isPeerInteresting(s->tor, piece_is_interesting, peer)) { @@ -3178,8 +3166,8 @@ struct ChokeData static int compareChoke(void const* va, void const* vb) { - struct ChokeData const* a = va; - struct ChokeData const* b = vb; + auto const* const a = static_cast(va); + auto const* const b = static_cast(vb); if (a->rate != b->rate) /* prefer higher overall speeds */ { @@ -3335,8 +3323,7 @@ static void rechokeUploads(tr_swarm* s, uint64_t const now) if (s->optimistic == NULL && !isMaxedOut && checkedChokeCount < size) { int n; - struct ChokeData* c; - tr_ptrArray randPool = TR_PTR_ARRAY_INIT; + auto randPool = tr_ptrArray{}; for (int i = checkedChokeCount; i < size; ++i) { @@ -3354,7 +3341,7 @@ static void rechokeUploads(tr_swarm* s, uint64_t const now) if ((n = tr_ptrArraySize(&randPool)) != 0) { - c = tr_ptrArrayNth(&randPool, tr_rand_int_weak(n)); + auto* c = static_cast(tr_ptrArrayNth(&randPool, tr_rand_int_weak(n))); c->isChoked = false; s->optimistic = c->msgs; s->optimisticUnchokeTimeScaler = OPTIMISTIC_UNCHOKE_MULTIPLIER; @@ -3378,7 +3365,7 @@ static void rechokePulse(evutil_socket_t fd, short what, void* vmgr) TR_UNUSED(what); tr_torrent* tor = NULL; - tr_peerMgr* mgr = vmgr; + auto* mgr = static_cast(vmgr); uint64_t const now = tr_time_msec(); managerLock(mgr); @@ -3587,7 +3574,7 @@ static void removeAllPeers(tr_swarm* s) { while (!tr_ptrArrayEmpty(&s->peers)) { - removePeer(s, tr_ptrArrayNth(&s->peers, 0)); + removePeer(s, static_cast(tr_ptrArrayNth(&s->peers, 0))); } TR_ASSERT(s->stats.peerCount == 0); @@ -3623,8 +3610,8 @@ struct peer_liveliness static int comparePeerLiveliness(void const* va, void const* vb) { - struct peer_liveliness const* a = va; - struct peer_liveliness const* b = vb; + auto const* const a = static_cast(va); + auto const* const b = static_cast(vb); if (a->doPurge != b->doPurge) { @@ -3705,7 +3692,7 @@ static void enforceTorrentPeerLimit(tr_swarm* s, uint64_t now) if (n > max) { void const* const base = tr_ptrArrayBase(&s->peers); - tr_peer** const peers = tr_memdup(base, n * sizeof(tr_peer*)); + auto** const peers = static_cast(tr_memdup(base, n * sizeof(tr_peer*))); sortPeersByLiveliness(peers, NULL, n, now); while (n > max) @@ -3745,7 +3732,7 @@ static void enforceSessionPeerLimit(tr_session* session, uint64_t now) for (int i = 0, tn = tr_ptrArraySize(&s->peers); i < tn; ++i) { - peers[n] = tr_ptrArrayNth(&s->peers, i); + peers[n] = static_cast(tr_ptrArrayNth(&s->peers, i)); swarms[n] = s; ++n; } @@ -3774,7 +3761,7 @@ static void reconnectPulse(evutil_socket_t fd, short what, void* vmgr) TR_UNUSED(what); tr_torrent* tor; - tr_peerMgr* mgr = vmgr; + auto* mgr = static_cast(vmgr); time_t const now_sec = tr_time(); uint64_t const now_msec = tr_time_msec(); @@ -3832,14 +3819,14 @@ static void pumpAllPeers(tr_peerMgr* mgr) for (int j = 0, n = tr_ptrArraySize(&s->peers); j < n; ++j) { - tr_peerMsgsPulse(tr_ptrArrayNth(&s->peers, j)); + tr_peerMsgsPulse(static_cast(tr_ptrArrayNth(&s->peers, j))); } } } static void queuePulseForeach(void* vtor) { - tr_torrent* tor = vtor; + auto* tor = static_cast(vtor); tr_torrentStartNow(tor); @@ -3856,7 +3843,7 @@ static void queuePulse(tr_session* session, tr_direction dir) if (tr_sessionGetQueueEnabled(session, dir)) { - tr_ptrArray torrents = TR_PTR_ARRAY_INIT; + auto torrents = tr_ptrArray{}; tr_sessionGetNextQueuedTorrents(session, dir, tr_sessionCountQueueFreeSlots(session, dir), &torrents); @@ -3871,8 +3858,7 @@ static void bandwidthPulse(evutil_socket_t fd, short what, void* vmgr) TR_UNUSED(fd); TR_UNUSED(what); - tr_torrent* tor; - tr_peerMgr* mgr = vmgr; + auto* mgr = static_cast(vmgr); tr_session* session = mgr->session; managerLock(mgr); @@ -3883,8 +3869,7 @@ static void bandwidthPulse(evutil_socket_t fd, short what, void* vmgr) tr_bandwidthAllocate(&session->bandwidth, TR_DOWN, BANDWIDTH_PERIOD_MSEC); /* torrent upkeep */ - tor = NULL; - + tr_torrent* tor = NULL; while ((tor = tr_torrentNext(session, tor)) != NULL) { /* possibly stop torrents that have seeded enough */ @@ -3984,10 +3969,10 @@ static void atomPulse(evutil_socket_t fd, short what, void* vmgr) TR_UNUSED(fd); TR_UNUSED(what); - tr_torrent* tor = NULL; - tr_peerMgr* mgr = vmgr; + auto* mgr = static_cast(vmgr); managerLock(mgr); + tr_torrent* tor = NULL; while ((tor = tr_torrentNext(mgr->session, tor)) != NULL) { int atomCount; @@ -4038,7 +4023,7 @@ static void atomPulse(evutil_socket_t fd, short what, void* vmgr) /* rebuild Torrent.pool with what's left */ tr_ptrArrayDestruct(&s->pool, NULL); - s->pool = TR_PTR_ARRAY_INIT; + s->pool = {}; qsort(keep, keepCount, sizeof(struct peer_atom*), compareAtomPtrsByAddress); for (i = 0; i < keepCount; ++i) @@ -4181,8 +4166,8 @@ static uint64_t getPeerCandidateScore(tr_torrent const* tor, struct peer_atom co static int comparePeerCandidates(void const* va, void const* vb) { int ret; - struct peer_candidate const* a = va; - struct peer_candidate const* b = vb; + auto const* const a = static_cast(va); + auto const* const b = static_cast(vb); if (a->score < b->score) { diff --git a/libtransmission/peer-msgs.c b/libtransmission/peer-msgs.cc similarity index 97% rename from libtransmission/peer-msgs.c rename to libtransmission/peer-msgs.cc index 667f3fc70..f61b4c75e 100644 --- a/libtransmission/peer-msgs.c +++ b/libtransmission/peer-msgs.cc @@ -457,7 +457,7 @@ static void publish(tr_peerMsgs* msgs, tr_peer_event* e) static void fireError(tr_peerMsgs* msgs, int err) { - tr_peer_event e = TR_PEER_EVENT_INIT; + auto e = tr_peer_event{}; e.eventType = TR_PEER_ERROR; e.err = err; publish(msgs, &e); @@ -465,7 +465,7 @@ static void fireError(tr_peerMsgs* msgs, int err) static void fireGotBlock(tr_peerMsgs* msgs, struct peer_request const* req) { - tr_peer_event e = TR_PEER_EVENT_INIT; + auto e = tr_peer_event{}; e.eventType = TR_PEER_CLIENT_GOT_BLOCK; e.pieceIndex = req->index; e.offset = req->offset; @@ -475,7 +475,7 @@ static void fireGotBlock(tr_peerMsgs* msgs, struct peer_request const* req) static void fireGotRej(tr_peerMsgs* msgs, struct peer_request const* req) { - tr_peer_event e = TR_PEER_EVENT_INIT; + auto e = tr_peer_event{}; e.eventType = TR_PEER_CLIENT_GOT_REJ; e.pieceIndex = req->index; e.offset = req->offset; @@ -485,28 +485,28 @@ static void fireGotRej(tr_peerMsgs* msgs, struct peer_request const* req) static void fireGotChoke(tr_peerMsgs* msgs) { - tr_peer_event e = TR_PEER_EVENT_INIT; + auto e = tr_peer_event{}; e.eventType = TR_PEER_CLIENT_GOT_CHOKE; publish(msgs, &e); } static void fireClientGotHaveAll(tr_peerMsgs* msgs) { - tr_peer_event e = TR_PEER_EVENT_INIT; + auto e = tr_peer_event{}; e.eventType = TR_PEER_CLIENT_GOT_HAVE_ALL; publish(msgs, &e); } static void fireClientGotHaveNone(tr_peerMsgs* msgs) { - tr_peer_event e = TR_PEER_EVENT_INIT; + auto e = tr_peer_event{}; e.eventType = TR_PEER_CLIENT_GOT_HAVE_NONE; publish(msgs, &e); } static void fireClientGotPieceData(tr_peerMsgs* msgs, uint32_t length) { - tr_peer_event e = TR_PEER_EVENT_INIT; + auto e = tr_peer_event{}; e.length = length; e.eventType = TR_PEER_CLIENT_GOT_PIECE_DATA; publish(msgs, &e); @@ -514,7 +514,7 @@ static void fireClientGotPieceData(tr_peerMsgs* msgs, uint32_t length) static void firePeerGotPieceData(tr_peerMsgs* msgs, uint32_t length) { - tr_peer_event e = TR_PEER_EVENT_INIT; + auto e = tr_peer_event{}; e.length = length; e.eventType = TR_PEER_PEER_GOT_PIECE_DATA; publish(msgs, &e); @@ -522,7 +522,7 @@ static void firePeerGotPieceData(tr_peerMsgs* msgs, uint32_t length) static void fireClientGotSuggest(tr_peerMsgs* msgs, uint32_t pieceIndex) { - tr_peer_event e = TR_PEER_EVENT_INIT; + auto e = tr_peer_event{}; e.eventType = TR_PEER_CLIENT_GOT_SUGGEST; e.pieceIndex = pieceIndex; publish(msgs, &e); @@ -530,7 +530,7 @@ static void fireClientGotSuggest(tr_peerMsgs* msgs, uint32_t pieceIndex) static void fireClientGotPort(tr_peerMsgs* msgs, tr_port port) { - tr_peer_event e = TR_PEER_EVENT_INIT; + auto e = tr_peer_event{}; e.eventType = TR_PEER_CLIENT_GOT_PORT; e.port = port; publish(msgs, &e); @@ -538,7 +538,7 @@ static void fireClientGotPort(tr_peerMsgs* msgs, tr_port port) static void fireClientGotAllowedFast(tr_peerMsgs* msgs, uint32_t pieceIndex) { - tr_peer_event e = TR_PEER_EVENT_INIT; + auto e = tr_peer_event{}; e.eventType = TR_PEER_CLIENT_GOT_ALLOWED_FAST; e.pieceIndex = pieceIndex; publish(msgs, &e); @@ -546,7 +546,7 @@ static void fireClientGotAllowedFast(tr_peerMsgs* msgs, uint32_t pieceIndex) static void fireClientGotBitfield(tr_peerMsgs* msgs, tr_bitfield* bitfield) { - tr_peer_event e = TR_PEER_EVENT_INIT; + auto e = tr_peer_event{}; e.eventType = TR_PEER_CLIENT_GOT_BITFIELD; e.bitfield = bitfield; publish(msgs, &e); @@ -554,7 +554,7 @@ static void fireClientGotBitfield(tr_peerMsgs* msgs, tr_bitfield* bitfield) static void fireClientGotHave(tr_peerMsgs* msgs, tr_piece_index_t index) { - tr_peer_event e = TR_PEER_EVENT_INIT; + auto e = tr_peer_event{}; e.eventType = TR_PEER_CLIENT_GOT_HAVE; e.pieceIndex = index; publish(msgs, &e); @@ -1235,7 +1235,7 @@ static void parseLtep(tr_peerMsgs* msgs, uint32_t msglen, struct evbuffer* inbuf } } -static int readBtLength(tr_peerMsgs* msgs, struct evbuffer* inbuf, size_t inlen) +static ReadState readBtLength(tr_peerMsgs* msgs, struct evbuffer* inbuf, size_t inlen) { uint32_t len; @@ -1259,9 +1259,9 @@ static int readBtLength(tr_peerMsgs* msgs, struct evbuffer* inbuf, size_t inlen) return READ_NOW; } -static int readBtMessage(tr_peerMsgs*, struct evbuffer*, size_t); +static ReadState readBtMessage(tr_peerMsgs*, struct evbuffer*, size_t); -static int readBtId(tr_peerMsgs* msgs, struct evbuffer* inbuf, size_t inlen) +static ReadState readBtId(tr_peerMsgs* msgs, struct evbuffer* inbuf, size_t inlen) { uint8_t id; @@ -1410,7 +1410,7 @@ static bool messageLengthIsCorrect(tr_peerMsgs const* msg, uint8_t id, uint32_t static int clientGotBlock(tr_peerMsgs* msgs, struct evbuffer* block, struct peer_request const* req); -static int readBtPiece(tr_peerMsgs* msgs, struct evbuffer* inbuf, size_t inlen, size_t* setme_piece_bytes_read) +static ReadState readBtPiece(tr_peerMsgs* msgs, struct evbuffer* inbuf, size_t inlen, size_t* setme_piece_bytes_read) { TR_ASSERT(evbuffer_get_length(inbuf) >= inlen); @@ -1480,7 +1480,7 @@ static int readBtPiece(tr_peerMsgs* msgs, struct evbuffer* inbuf, size_t inlen, static void updateDesiredRequestCount(tr_peerMsgs* msgs); -static int readBtMessage(tr_peerMsgs* msgs, struct evbuffer* inbuf, size_t inlen) +static ReadState readBtMessage(tr_peerMsgs* msgs, struct evbuffer* inbuf, size_t inlen) { uint8_t const id = msgs->incoming.id; #ifdef TR_ENABLE_ASSERTS @@ -1788,7 +1788,7 @@ static void peerPulse(void* vmsgs); static void didWrite(tr_peerIo* io, size_t bytesWritten, bool wasPieceData, void* vmsgs) { - tr_peerMsgs* msgs = vmsgs; + auto* msgs = static_cast(vmsgs); if (wasPieceData) { @@ -1804,7 +1804,7 @@ static void didWrite(tr_peerIo* io, size_t bytesWritten, bool wasPieceData, void static ReadState canRead(tr_peerIo* io, void* vmsgs, size_t* piece) { ReadState ret; - tr_peerMsgs* msgs = vmsgs; + auto* msgs = static_cast(vmsgs); struct evbuffer* in = tr_peerIoGetReadBuffer(io); size_t const inlen = evbuffer_get_length(in); @@ -1999,11 +1999,10 @@ static size_t fillOutputBuffer(tr_peerMsgs* msgs, time_t now) if (tr_peerIoGetWriteBufferSpace(msgs->io, now) >= METADATA_PIECE_SIZE && popNextMetadataRequest(msgs, &piece)) { - char* data; size_t dataLen; bool ok = false; - data = tr_torrentGetMetadataPiece(msgs->torrent, piece, &dataLen); + auto* data = static_cast(tr_torrentGetMetadataPiece(msgs->torrent, piece, &dataLen)); if (data != NULL) { @@ -2089,7 +2088,7 @@ static size_t fillOutputBuffer(tr_peerMsgs* msgs, time_t now) req.index, req.offset, req.length, - iovec[0].iov_base) != 0; + static_cast(iovec[0].iov_base)) != 0; iovec[0].iov_len = req.length; evbuffer_commit_space(out, iovec, 1); @@ -2160,7 +2159,7 @@ static size_t fillOutputBuffer(tr_peerMsgs* msgs, time_t now) static void peerPulse(void* vmsgs) { - tr_peerMsgs* msgs = vmsgs; + auto* msgs = static_cast(vmsgs); time_t const now = tr_time(); if (tr_isPeerIo(msgs->io)) @@ -2189,19 +2188,21 @@ void tr_peerMsgsPulse(tr_peerMsgs* msgs) static void gotError(tr_peerIo* io, short what, void* vmsgs) { + auto* msgs = static_cast(vmsgs); + TR_UNUSED(io); if ((what & BEV_EVENT_TIMEOUT) != 0) { - dbgmsg(vmsgs, "libevent got a timeout, what=%hd", what); + dbgmsg(msgs, "libevent got a timeout, what=%hd", what); } if ((what & (BEV_EVENT_EOF | BEV_EVENT_ERROR)) != 0) { - dbgmsg(vmsgs, "libevent got an error! what=%hd, errno=%d (%s)", what, errno, tr_strerror(errno)); + dbgmsg(msgs, "libevent got an error! what=%hd, errno=%d (%s)", what, errno, tr_strerror(errno)); } - fireError(vmsgs, ENOTCONN); + fireError(msgs, ENOTCONN); } static void sendBitfield(tr_peerMsgs* msgs) @@ -2262,8 +2263,8 @@ typedef struct static void pexAddedCb(void const* vpex, void* userData) { - PexDiffs* diffs = userData; - tr_pex const* pex = vpex; + auto* diffs = static_cast(userData); + auto const* pex = static_cast(vpex); if (diffs->addedCount < MAX_PEX_ADDED) { @@ -2274,8 +2275,8 @@ static void pexAddedCb(void const* vpex, void* userData) static inline void pexDroppedCb(void const* vpex, void* userData) { - PexDiffs* diffs = userData; - tr_pex const* pex = vpex; + auto* diffs = static_cast(userData); + auto const* pex = static_cast(vpex); if (diffs->droppedCount < MAX_PEX_DROPPED) { @@ -2285,8 +2286,8 @@ static inline void pexDroppedCb(void const* vpex, void* userData) static inline void pexElementCb(void const* vpex, void* userData) { - PexDiffs* diffs = userData; - tr_pex const* pex = vpex; + auto* diffs = static_cast(userData); + auto const* pex = static_cast(vpex); diffs->elements[diffs->elementCount++] = *pex; } @@ -2318,8 +2319,8 @@ static void tr_set_compare( tr_set_func in_both_cb, void* userData) { - uint8_t const* a = va; - uint8_t const* b = vb; + auto* a = static_cast(va); + auto* b = static_cast(vb); uint8_t const* aend = a + elementSize * aCount; uint8_t const* bend = b + elementSize * bCount; @@ -2568,7 +2569,7 @@ static void pexPulse(evutil_socket_t fd, short what, void* vmsgs) TR_UNUSED(fd); TR_UNUSED(what); - struct tr_peerMsgs* msgs = vmsgs; + auto* msgs = static_cast(vmsgs); sendPex(msgs); @@ -2638,8 +2639,8 @@ static void peermsgs_destruct(tr_peer* peer) } static struct tr_peer_virtual_funcs const my_funcs = { - .destruct = peermsgs_destruct, - .is_transferring_pieces = peermsgs_is_transferring_pieces, + peermsgs_destruct, + peermsgs_is_transferring_pieces, }; /*** @@ -2713,7 +2714,8 @@ bool tr_isPeerMsgs(void const* msgs) tr_peerMsgs* tr_peerMsgsCast(void* vm) { - return tr_isPeerMsgs(vm) ? vm : NULL; + auto* m = static_cast(vm); + return tr_isPeerMsgs(m) ? m : NULL; } tr_peerMsgs* tr_peerMsgsNew(struct tr_torrent* torrent, struct tr_peerIo* io, tr_peer_callback callback, void* callbackData) diff --git a/libtransmission/peer-socket.h b/libtransmission/peer-socket.h index a665e6de5..d6487ea1b 100644 --- a/libtransmission/peer-socket.h +++ b/libtransmission/peer-socket.h @@ -37,8 +37,6 @@ struct tr_peer_socket union tr_peer_socket_handle handle; }; -#define TR_PEER_SOCKET_INIT ((struct tr_peer_socket){ .type = TR_PEER_SOCKET_TYPE_NONE }) - struct tr_peer_socket tr_peer_socket_tcp_create(tr_socket_t const handle); struct tr_peer_socket tr_peer_socket_utp_create(struct UTPSocket* const handle); diff --git a/libtransmission/platform-quota.c b/libtransmission/platform-quota.cc similarity index 99% rename from libtransmission/platform-quota.c rename to libtransmission/platform-quota.cc index 9b6a7599f..ea047f0d6 100644 --- a/libtransmission/platform-quota.c +++ b/libtransmission/platform-quota.cc @@ -263,7 +263,10 @@ static char const* getblkdev(char const* path) #if defined(__NetBSD__) && __NetBSD_Version__ >= 600000000 +extern "C" +{ #include +} static int64_t getquota(char const* device) { diff --git a/libtransmission/platform.c b/libtransmission/platform.cc similarity index 91% rename from libtransmission/platform.c rename to libtransmission/platform.cc index 3fea3db6e..6000b3017 100644 --- a/libtransmission/platform.c +++ b/libtransmission/platform.cc @@ -99,7 +99,7 @@ static ThreadFuncReturnType ThreadFunc(void* _t) pthread_detach(pthread_self()); #endif - tr_thread* t = _t; + auto* t = static_cast(_t); t->func(t->arg); @@ -115,7 +115,7 @@ static ThreadFuncReturnType ThreadFunc(void* _t) tr_thread* tr_threadNew(void (*func)(void*), void* arg) { - tr_thread* t = tr_new0(tr_thread, 1); + auto* t = static_cast(tr_new0(tr_thread, 1)); t->func = func; t->arg = arg; @@ -263,7 +263,7 @@ static char const* getHomeDir(void) { #ifdef _WIN32 - home = win32_get_known_folder(&FOLDERID_Profile); + home = win32_get_known_folder(FOLDERID_Profile); #else @@ -347,7 +347,7 @@ char const* tr_getDefaultConfigDir(char const* appname) #elif defined(_WIN32) - char* appdata = win32_get_known_folder(&FOLDERID_LocalAppData); + char* appdata = win32_get_known_folder(FOLDERID_LocalAppData); s = tr_buildPath(appdata, appname, NULL); tr_free(appdata); @@ -440,7 +440,7 @@ char const* tr_getDefaultDownloadDir(void) if (user_dir == NULL) { - user_dir = win32_get_known_folder(&FOLDERID_Downloads); + user_dir = win32_get_known_folder(FOLDERID_Downloads); } #endif @@ -497,13 +497,13 @@ char const* tr_getWebClientDir(tr_session const* session) if (!isWebClientDir(s)) { - tr_free(s); + tr_free(const_cast(s)); CFURLRef appURL = CFBundleCopyBundleURL(CFBundleGetMainBundle()); CFStringRef appRef = CFURLCopyFileSystemPath(appURL, kCFURLPOSIXPathStyle); CFIndex const appStringLength = CFStringGetMaximumSizeOfFileSystemRepresentation(appRef); - char* appString = tr_malloc(appStringLength); + char* appString = static_cast(tr_malloc(appStringLength)); bool const success = CFStringGetFileSystemRepresentation(appRef, appString, appStringLength); TR_ASSERT(success); @@ -515,7 +515,7 @@ char const* tr_getWebClientDir(tr_session const* session) if (!isWebClientDir(s)) { - tr_free(s); + tr_free(const_cast(s)); s = NULL; } @@ -529,7 +529,7 @@ char const* tr_getWebClientDir(tr_session const* session) /* Generally, Web interface should be stored in a Web subdir of * calling executable dir. */ - static REFKNOWNFOLDERID known_folder_ids[] = { + static KNOWNFOLDERID const* const known_folder_ids[] = { &FOLDERID_LocalAppData, &FOLDERID_RoamingAppData, &FOLDERID_ProgramData, @@ -537,14 +537,17 @@ char const* tr_getWebClientDir(tr_session const* session) for (size_t i = 0; s == NULL && i < TR_N_ELEMENTS(known_folder_ids); ++i) { - char* dir = win32_get_known_folder(known_folder_ids[i]); - s = tr_buildPath(dir, "Transmission", "Web", NULL); + char* dir = win32_get_known_folder(*known_folder_ids[i]); + char* path = tr_buildPath(dir, "Transmission", "Web", NULL); tr_free(dir); - if (!isWebClientDir(s)) + if (isWebClientDir(path)) { - tr_free(s); - s = NULL; + s = path; + } + else + { + tr_free(path); } } @@ -560,13 +563,16 @@ char const* tr_getWebClientDir(tr_session const* session) if (dir != NULL) { - s = tr_buildPath(dir, "Web", NULL); + char* path = tr_buildPath(dir, "Web", NULL); tr_free(dir); - if (!isWebClientDir(s)) + if (isWebClientDir(path)) { - tr_free(s); - s = NULL; + s = path; + } + else + { + tr_free(path); } } } @@ -627,7 +633,7 @@ char const* tr_getWebClientDir(tr_session const* session) /* walk through the candidates & look for a match */ for (tr_list* l = candidates; l != NULL; l = l->next) { - char* path = tr_buildPath(l->data, "transmission", "public_html", NULL); + char* path = tr_buildPath(static_cast(l->data), "transmission", "public_html", NULL); bool const found = isWebClientDir(path); if (found) @@ -656,7 +662,7 @@ char* tr_getSessionIdDir(void) #else - char* program_data_dir = win32_get_known_folder_ex(&FOLDERID_ProgramData, KF_FLAG_CREATE); + char* program_data_dir = win32_get_known_folder_ex(FOLDERID_ProgramData, KF_FLAG_CREATE); char* result = tr_buildPath(program_data_dir, "Transmission", NULL); tr_free(program_data_dir); tr_sys_dir_create(result, 0, 0, NULL); diff --git a/libtransmission/port-forwarding.c b/libtransmission/port-forwarding.cc similarity index 99% rename from libtransmission/port-forwarding.c rename to libtransmission/port-forwarding.cc index 6e1146117..21a4d794e 100644 --- a/libtransmission/port-forwarding.c +++ b/libtransmission/port-forwarding.cc @@ -148,7 +148,7 @@ static void onTimer(evutil_socket_t fd, short what, void* vshared) TR_UNUSED(fd); TR_UNUSED(what); - tr_shared* s = vshared; + auto* s = static_cast(vshared); TR_ASSERT(s != NULL); TR_ASSERT(s->timer != NULL); diff --git a/libtransmission/ptrarray.c b/libtransmission/ptrarray.cc similarity index 98% rename from libtransmission/ptrarray.c rename to libtransmission/ptrarray.cc index 9dad4c8c0..d87697338 100644 --- a/libtransmission/ptrarray.c +++ b/libtransmission/ptrarray.cc @@ -15,8 +15,6 @@ #define FLOOR 32 -tr_ptrArray const TR_PTR_ARRAY_INIT = TR_PTR_ARRAY_INIT_STATIC; - void tr_ptrArrayDestruct(tr_ptrArray* p, PtrArrayForeachFunc func) { TR_ASSERT(p != NULL); diff --git a/libtransmission/ptrarray.h b/libtransmission/ptrarray.h index 1d25e111d..caff31bbc 100644 --- a/libtransmission/ptrarray.h +++ b/libtransmission/ptrarray.h @@ -34,13 +34,6 @@ typedef tr_voidptr_compare_func PtrArrayCompareFunc; typedef void (*PtrArrayForeachFunc)(void*); -#define TR_PTR_ARRAY_INIT_STATIC \ - { \ - NULL, 0, 0, \ - } - -extern tr_ptrArray const TR_PTR_ARRAY_INIT; - /** @brief Destructor to free a tr_ptrArray's internal memory */ void tr_ptrArrayDestruct(tr_ptrArray*, PtrArrayForeachFunc func); diff --git a/libtransmission/quark.c b/libtransmission/quark.cc similarity index 95% rename from libtransmission/quark.c rename to libtransmission/quark.cc index 58f0d9ceb..bc45457dc 100644 --- a/libtransmission/quark.c +++ b/libtransmission/quark.cc @@ -421,11 +421,10 @@ static struct tr_key_struct const my_static[] = { static int compareKeys(void const* va, void const* vb) { - int ret; - struct tr_key_struct const* a = va; - struct tr_key_struct const* b = vb; + auto const* a = static_cast(va); + auto const* b = static_cast(vb); - ret = memcmp(a->str, b->str, MIN(a->len, b->len)); + int ret = memcmp(a->str, b->str, MIN(a->len, b->len)); if (ret == 0 && a->len != b->len) { @@ -435,7 +434,7 @@ static int compareKeys(void const* va, void const* vb) return ret; } -static tr_ptrArray my_runtime = TR_PTR_ARRAY_INIT_STATIC; +static tr_ptrArray my_runtime = {}; bool tr_quark_lookup(void const* str, size_t len, tr_quark* setme) { @@ -443,11 +442,12 @@ bool tr_quark_lookup(void const* str, size_t len, tr_quark* setme) TR_ASSERT(n_static == TR_N_KEYS); struct tr_key_struct tmp; - tmp.str = str; + tmp.str = static_cast(str); tmp.len = len; /* is it in our static array? */ - struct tr_key_struct const* const match = bsearch(&tmp, my_static, n_static, sizeof(struct tr_key_struct), compareKeys); + auto const* match = static_cast( + bsearch(&tmp, my_static, n_static, sizeof(struct tr_key_struct), compareKeys)); bool success = false; if (match != NULL) @@ -496,7 +496,7 @@ tr_quark tr_quark_new(void const* str, size_t len) { if (len == TR_BAD_SIZE) { - len = strlen(str); + len = strlen(static_cast(str)); } if (!tr_quark_lookup(str, len, &ret)) @@ -518,7 +518,7 @@ char const* tr_quark_get_string(tr_quark q, size_t* len) } else { - tmp = tr_ptrArrayNth(&my_runtime, q - TR_N_KEYS); + tmp = static_cast(tr_ptrArrayNth(&my_runtime, q - TR_N_KEYS)); } if (len != NULL) diff --git a/libtransmission/resume.c b/libtransmission/resume.cc similarity index 99% rename from libtransmission/resume.c rename to libtransmission/resume.cc index 15102d1bb..7d825c378 100644 --- a/libtransmission/resume.c +++ b/libtransmission/resume.cc @@ -345,7 +345,7 @@ static uint64_t loadRatioLimits(tr_variant* dict, tr_torrent* tor) if (tr_variantDictFindInt(d, TR_KEY_ratio_mode, &i)) { - tr_torrentSetRatioMode(tor, i); + tr_torrentSetRatioMode(tor, tr_ratiolimit(i)); } ret = TR_FR_RATIOLIMIT; @@ -371,7 +371,7 @@ static uint64_t loadIdleLimits(tr_variant* dict, tr_torrent* tor) if (tr_variantDictFindInt(d, TR_KEY_idle_mode, &i)) { - tr_torrentSetIdleMode(tor, i); + tr_torrentSetIdleMode(tor, tr_idlelimit(i)); } ret = TR_FR_IDLELIMIT; @@ -482,7 +482,7 @@ static void bitfieldToBenc(tr_bitfield const* b, tr_variant* benc) else { size_t byte_count = 0; - uint8_t* raw = tr_bitfieldGetRaw(b, &byte_count); + auto* raw = static_cast(tr_bitfieldGetRaw(b, &byte_count)); tr_variantInitRaw(benc, raw, byte_count); tr_free(raw); } @@ -588,7 +588,7 @@ static uint64_t loadProgress(tr_variant* dict, tr_torrent* tor) uint8_t const* raw; size_t rawlen; tr_variant* l; - struct tr_bitfield blocks = TR_BITFIELD_INIT; + struct tr_bitfield blocks = {}; if (tr_variantDictFindList(prog, TR_KEY_time_checked, &l)) { @@ -992,7 +992,7 @@ static uint64_t loadFromFile(tr_torrent* tor, uint64_t fieldsToLoad, bool* didRe return fieldsLoaded; } -static uint64_t setFromCtor(tr_torrent* tor, uint64_t fields, tr_ctor const* ctor, int mode) +static uint64_t setFromCtor(tr_torrent* tor, uint64_t fields, tr_ctor const* ctor, tr_ctorMode mode) { uint64_t ret = 0; diff --git a/libtransmission/rpc-server.c b/libtransmission/rpc-server.cc similarity index 96% rename from libtransmission/rpc-server.c rename to libtransmission/rpc-server.cc index 45bb989a2..892d413a5 100644 --- a/libtransmission/rpc-server.c +++ b/libtransmission/rpc-server.cc @@ -173,7 +173,7 @@ static void handle_upload(struct evhttp_request* req, struct tr_rpc_server* serv { int n; bool hasSessionId = false; - tr_ptrArray parts = TR_PTR_ARRAY_INIT; + auto parts = tr_ptrArray{}; char const* query = strchr(req->uri, '?'); bool const paused = query != NULL && strstr(query + 1, "paused=true") != NULL; @@ -184,7 +184,7 @@ static void handle_upload(struct evhttp_request* req, struct tr_rpc_server* serv /* first look for the session id */ for (int i = 0; i < n; ++i) { - struct tr_mimepart const* p = tr_ptrArrayNth(&parts, i); + auto const* const p = static_cast(tr_ptrArrayNth(&parts, i)); if (tr_strcasestr(p->headers, TR_RPC_SESSION_ID_HEADER) != NULL) { @@ -208,7 +208,7 @@ static void handle_upload(struct evhttp_request* req, struct tr_rpc_server* serv { for (int i = 0; i < n; ++i) { - struct tr_mimepart const* p = tr_ptrArrayNth(&parts, i); + auto const* const p = static_cast(tr_ptrArrayNth(&parts, i)); size_t body_len = p->body_len; tr_variant top; tr_variant* args; @@ -233,7 +233,7 @@ static void handle_upload(struct evhttp_request* req, struct tr_rpc_server* serv } else if (tr_variantFromBenc(&test, body, body_len) == 0) { - char* b64 = tr_base64_encode(body, body_len, NULL); + auto* b64 = static_cast(tr_base64_encode(body, body_len, NULL)); tr_variantDictAddStr(args, TR_KEY_metainfo, b64); tr_free(b64); have_source = true; @@ -335,14 +335,14 @@ static void add_response( deflateInit2(&server->stream, compressionLevel, Z_DEFLATED, 15 + 16, 8, Z_DEFAULT_STRATEGY); } - server->stream.next_in = content_ptr; + server->stream.next_in = static_cast(content_ptr); server->stream.avail_in = content_len; /* allocate space for the raw data and call deflate() just once -- * we won't use the deflated data if it's longer than the raw data, * so it's okay to let deflate() run out of output buffer space */ evbuffer_reserve_space(out, content_len, iovec, 1); - server->stream.next_out = iovec[0].iov_base; + server->stream.next_out = static_cast(iovec[0].iov_base); server->stream.avail_out = iovec[0].iov_len; state = deflate(&server->stream, Z_FINISH); @@ -493,7 +493,7 @@ static void rpc_response_func(tr_session* session, tr_variant* response, void* u { TR_UNUSED(session); - struct rpc_response_data* data = user_data; + auto* data = static_cast(user_data); struct evbuffer* response_buf = tr_variantToBuf(response, TR_VARIANT_FMT_JSON_LEAN); struct evbuffer* buf = evbuffer_new(); @@ -562,7 +562,7 @@ static bool isAddressAllowed(tr_rpc_server const* server, char const* address) for (tr_list* l = server->whitelist; l != NULL; l = l->next) { - if (tr_wildmat(address, l->data)) + if (tr_wildmat(address, static_cast(l->data))) { return true; } @@ -621,7 +621,7 @@ static bool isHostnameAllowed(tr_rpc_server const* server, struct evhttp_request /* Otherwise, hostname must be whitelisted. */ for (tr_list* l = server->hostWhitelist; l != NULL; l = l->next) { - if (tr_wildmat(hostname, l->data)) + if (tr_wildmat(hostname, static_cast(l->data))) { tr_free(hostname); return true; @@ -642,7 +642,7 @@ static bool test_session_id(struct tr_rpc_server* server, struct evhttp_request* static void handle_request(struct evhttp_request* req, void* arg) { - struct tr_rpc_server* server = arg; + auto* server = static_cast(arg); if (req != NULL && req->evcon != NULL) { @@ -674,7 +674,7 @@ static void handle_request(struct evhttp_request* req, void* arg) if (auth != NULL && evutil_ascii_strncasecmp(auth, "basic ", 6) == 0) { - char* p = tr_base64_decode_str(auth + 6, NULL); + auto* p = static_cast(tr_base64_decode_str(auth + 6, NULL)); if (p != NULL) { @@ -827,7 +827,7 @@ static void rpc_server_start_retry_cancel(tr_rpc_server* server) static void startServer(void* vserver) { - tr_rpc_server* server = vserver; + auto* server = static_cast(vserver); if (server->httpd != NULL) { @@ -892,7 +892,7 @@ static void stopServer(tr_rpc_server* server) static void onEnabledChanged(void* vserver) { - tr_rpc_server* server = vserver; + auto* server = static_cast(vserver); if (!server->isEnabled) { @@ -918,7 +918,7 @@ bool tr_rpcIsEnabled(tr_rpc_server const* server) static void restartServer(void* vserver) { - tr_rpc_server* server = vserver; + auto* server = static_cast(vserver); if (server->isEnabled) { @@ -1122,25 +1122,25 @@ void tr_rpcSetAntiBruteForceThreshold(tr_rpc_server* server, int badRequests) static void closeServer(void* vserver) { void* tmp; - tr_rpc_server* s = vserver; + auto* server = static_cast(vserver); - stopServer(s); + stopServer(server); - while ((tmp = tr_list_pop_front(&s->whitelist)) != NULL) + while ((tmp = tr_list_pop_front(&server->whitelist)) != NULL) { tr_free(tmp); } - if (s->isStreamInitialized) + if (server->isStreamInitialized) { - deflateEnd(&s->stream); + deflateEnd(&server->stream); } - tr_free(s->url); - tr_free(s->whitelistStr); - tr_free(s->username); - tr_free(s->password); - tr_free(s); + tr_free(server->url); + tr_free(server->whitelistStr); + tr_free(server->username); + tr_free(server->password); + tr_free(server); } void tr_rpcClose(tr_rpc_server** ps) @@ -1157,14 +1157,13 @@ static void missing_settings_key(tr_quark const q) tr_rpc_server* tr_rpcInit(tr_session* session, tr_variant* settings) { - tr_rpc_server* s; bool boolVal; int64_t i; char const* str; tr_quark key; tr_address address; - s = tr_new0(tr_rpc_server, 1); + tr_rpc_server* s = tr_new0(tr_rpc_server, 1); s->session = session; key = TR_KEY_rpc_enabled; diff --git a/libtransmission/rpcimpl.c b/libtransmission/rpcimpl.cc similarity index 98% rename from libtransmission/rpcimpl.c rename to libtransmission/rpcimpl.cc index 553312862..3ebede212 100644 --- a/libtransmission/rpcimpl.c +++ b/libtransmission/rpcimpl.cc @@ -59,9 +59,9 @@ typedef enum **** ***/ -static tr_rpc_callback_status notify(tr_session* session, int type, tr_torrent* tor) +static tr_rpc_callback_status notify(tr_session* session, tr_rpc_callback_type type, tr_torrent* tor) { - tr_rpc_callback_status status = 0; + tr_rpc_callback_status status = TR_RPC_OK; if (session->rpc_func != NULL) { @@ -799,7 +799,7 @@ static void initField( { size_t byte_count = 0; void* bytes = tr_torrentCreatePieceBitfield(tor, &byte_count); - char* enc = tr_base64_encode(bytes, byte_count, NULL); + auto* enc = static_cast(tr_base64_encode(bytes, byte_count, NULL)); tr_variantInitStr(initme, enc != NULL ? enc : "", TR_BAD_SIZE); tr_free(enc); tr_free(bytes); @@ -1075,7 +1075,7 @@ static char const* setLabels(tr_torrent* tor, tr_variant* list) { size_t const n = tr_variantListSize(list); char const* errmsg = NULL; - tr_ptrArray labels = TR_PTR_ARRAY_INIT; + auto labels = tr_ptrArray{}; int labelcount = 0; for (size_t i = 0; i < n; ++i) { @@ -1606,7 +1606,7 @@ static char const* torrentSetLocation( static void torrentRenamePathDone(tr_torrent* tor, char const* oldpath, char const* newname, int error, void* user_data) { char const* result; - struct tr_rpc_idle_data* data = user_data; + auto* data = static_cast(user_data); tr_variantDictAddInt(data->args_out, TR_KEY_id, tr_torrentId(tor)); tr_variantDictAddStr(data->args_out, TR_KEY_path, oldpath); @@ -1673,7 +1673,7 @@ static void portTested( TR_UNUSED(did_timeout); char result[1024]; - struct tr_rpc_idle_data* data = user_data; + auto* data = static_cast(user_data); if (response_code != 200) { @@ -1723,7 +1723,7 @@ static void gotNewBlocklist( TR_UNUSED(did_timeout); char result[1024]; - struct tr_rpc_idle_data* data = user_data; + auto* data = static_cast(user_data); *result = '\0'; @@ -1742,7 +1742,7 @@ static void gotNewBlocklist( z_stream stream; char const* configDir = tr_sessionGetConfigDir(session); size_t const buflen = 1024 * 128; /* 128 KiB buffer */ - uint8_t* const buf = tr_malloc(buflen); + auto* const buf = static_cast(tr_malloc(buflen)); tr_error* error = NULL; /* this is an odd Magic Number required by zlib to enable gz support. @@ -1752,7 +1752,7 @@ static void gotNewBlocklist( stream.zalloc = (alloc_func)Z_NULL; stream.zfree = (free_func)Z_NULL; stream.opaque = (voidpf)Z_NULL; - stream.next_in = response; + stream.next_in = static_cast(response); stream.avail_in = response_byte_count; inflateInit2(&stream, windowBits); @@ -1767,7 +1767,7 @@ static void gotNewBlocklist( for (;;) { - stream.next_out = (void*)buf; + stream.next_out = static_cast(buf); stream.avail_out = buflen; err = inflate(&stream, Z_NO_FLUSH); @@ -1907,7 +1907,7 @@ static void gotMetadataFromURL( TR_UNUSED(did_connect); TR_UNUSED(did_timeout); - struct add_torrent_idle_data* data = user_data; + auto* data = static_cast(user_data); dbgmsg( "torrentAdd: HTTP response code was %ld (%s); response length was %zu bytes", @@ -2079,7 +2079,7 @@ static char const* torrentAdd( if (fname == NULL) { size_t len; - char* metainfo = tr_base64_decode_str(metainfo_base64, &len); + auto* metainfo = static_cast(tr_base64_decode_str(metainfo_base64, &len)); tr_ctorSetMetainfo(ctor, (uint8_t*)metainfo, len); tr_free(metainfo); } @@ -2165,7 +2165,7 @@ static char const* sessionSet( if (tr_variantDictFindInt(args_in, TR_KEY_alt_speed_time_day, &i)) { - tr_sessionSetAltSpeedDay(session, i); + tr_sessionSetAltSpeedDay(session, tr_sched_day(i)); } if (tr_variantDictFindBool(args_in, TR_KEY_alt_speed_time_enabled, &boolVal)) @@ -2382,9 +2382,8 @@ static char const* sessionStats( int running = 0; int total = 0; - tr_variant* d; - tr_session_stats currentStats = TR_SESSION_STATS_INIT; - tr_session_stats cumulativeStats = TR_SESSION_STATS_INIT; + auto currentStats = tr_session_stats{}; + auto cumulativeStats = tr_session_stats{}; tr_torrent* tor = NULL; while ((tor = tr_torrentNext(session, tor)) != NULL) @@ -2406,7 +2405,7 @@ static char const* sessionStats( tr_variantDictAddInt(args_out, TR_KEY_torrentCount, total); tr_variantDictAddReal(args_out, TR_KEY_uploadSpeed, tr_sessionGetPieceSpeed_Bps(session, TR_UP)); - d = tr_variantDictAddDict(args_out, TR_KEY_cumulative_stats, 5); + tr_variant* d = tr_variantDictAddDict(args_out, TR_KEY_cumulative_stats, 5); tr_variantDictAddInt(d, TR_KEY_downloadedBytes, cumulativeStats.downloadedBytes); tr_variantDictAddInt(d, TR_KEY_filesAdded, cumulativeStats.filesAdded); tr_variantDictAddInt(d, TR_KEY_secondsActive, cumulativeStats.secondsActive); diff --git a/libtransmission/session-id.c b/libtransmission/session-id.cc similarity index 100% rename from libtransmission/session-id.c rename to libtransmission/session-id.cc diff --git a/libtransmission/session.c b/libtransmission/session.cc similarity index 96% rename from libtransmission/session.c rename to libtransmission/session.cc index 726792535..d3d00ce6a 100644 --- a/libtransmission/session.c +++ b/libtransmission/session.cc @@ -171,7 +171,7 @@ static void accept_incoming_peer(evutil_socket_t fd, short what, void* vsession) tr_socket_t clientSocket; tr_port clientPort; tr_address clientAddr; - tr_session* session = vsession; + auto* session = static_cast(vsession); clientSocket = tr_netAccept(session, fd, &clientAddr, &clientPort); @@ -585,8 +585,8 @@ static void onSaveTimer(evutil_socket_t fd, short what, void* vsession) TR_UNUSED(fd); TR_UNUSED(what); - tr_torrent* tor = NULL; - tr_session* session = vsession; + tr_torrent* tor = nullptr; + auto* session = static_cast(vsession); if (tr_cacheFlushDone(session->cache) != 0) { @@ -636,16 +636,16 @@ tr_session* tr_sessionInit(char const* configDir, bool messageQueuingEnabled, tr session->cache = tr_cacheNew(1024 * 1024 * 2); session->magicNumber = SESSION_MAGIC_NUMBER; session->session_id = tr_session_id_new(); - session->torrentsSortedByHash = TR_PTR_ARRAY_INIT; - session->torrentsSortedByHashString = TR_PTR_ARRAY_INIT; - session->torrentsSortedById = TR_PTR_ARRAY_INIT; + session->torrentsSortedByHash = {}; + session->torrentsSortedByHashString = {}; + session->torrentsSortedById = {}; tr_bandwidthConstruct(&session->bandwidth, session, NULL); tr_variantInitList(&session->removedTorrents, 0); /* nice to start logging at the very beginning */ if (tr_variantDictFindInt(clientSettings, TR_KEY_message_level, &i)) { - tr_logSetLevel(i); + tr_logSetLevel(tr_log_level(i)); } /* start the libtransmission thread */ @@ -676,7 +676,7 @@ static void onNowTimer(evutil_socket_t fd, short what, void* vsession) TR_UNUSED(fd); TR_UNUSED(what); - tr_session* session = vsession; + auto* session = static_cast(vsession); TR_ASSERT(tr_isSession(session)); TR_ASSERT(session->nowTimer != NULL); @@ -741,7 +741,7 @@ static void loadBlocklists(tr_session* session); static void tr_sessionInitImpl(void* vdata) { - struct init_data* data = vdata; + auto* data = static_cast(vdata); tr_variant const* const clientSettings = data->clientSettings; tr_session* session = data->session; @@ -816,7 +816,7 @@ static void setPeerPort(tr_session* session, tr_port port); static void sessionSetImpl(void* vdata) { - struct init_data* data = vdata; + auto* data = static_cast(vdata); tr_session* session = data->session; tr_variant* settings = data->clientSettings; @@ -833,7 +833,7 @@ static void sessionSetImpl(void* vdata) if (tr_variantDictFindInt(settings, TR_KEY_message_level, &i)) { - tr_logSetLevel(i); + tr_logSetLevel(tr_log_level(i)); } #ifndef _WIN32 @@ -879,7 +879,7 @@ static void sessionSetImpl(void* vdata) if (tr_variantDictFindInt(settings, TR_KEY_encryption, &i)) { - tr_sessionSetEncryption(session, i); + tr_sessionSetEncryption(session, tr_encryption_mode(i)); } if (tr_variantDictFindStr(settings, TR_KEY_peer_socket_tos, &str, NULL)) @@ -960,7 +960,7 @@ static void sessionSetImpl(void* vdata) if (tr_variantDictFindInt(settings, TR_KEY_preallocation, &i)) { - session->preallocationMode = i; + session->preallocationMode = tr_preallocation_mode(i); } if (tr_variantDictFindStr(settings, TR_KEY_download_dir, &str, NULL)) @@ -1002,7 +1002,7 @@ static void sessionSetImpl(void* vdata) } b.socket = TR_BAD_SOCKET; - session->bind_ipv4 = tr_memdup(&b, sizeof(struct tr_bindinfo)); + session->bind_ipv4 = static_cast(tr_memdup(&b, sizeof(struct tr_bindinfo))); if (!tr_variantDictFindStr(settings, TR_KEY_bind_address_ipv6, &str, NULL) || !tr_address_from_string(&b.addr, str) || b.addr.type != TR_AF_INET6) @@ -1011,7 +1011,7 @@ static void sessionSetImpl(void* vdata) } b.socket = TR_BAD_SOCKET; - session->bind_ipv6 = tr_memdup(&b, sizeof(struct tr_bindinfo)); + session->bind_ipv6 = static_cast(tr_memdup(&b, sizeof(struct tr_bindinfo))); /* incoming peer port */ if (tr_variantDictFindInt(settings, TR_KEY_peer_port_random_low, &i)) @@ -1121,7 +1121,7 @@ static void sessionSetImpl(void* vdata) if (tr_variantDictFindInt(settings, TR_KEY_alt_speed_time_day, &i)) { - turtle->days = i; + turtle->days = tr_sched_day(i); } if (tr_variantDictFindBool(settings, TR_KEY_alt_speed_time_enabled, &boolVal)) @@ -1319,8 +1319,9 @@ bool tr_sessionIsLocked(tr_session const* session) **** Peer Port ***/ -static void peerPortChanged(void* session) +static void peerPortChanged(void* vsession) { + auto* session = static_cast(vsession); TR_ASSERT(tr_isSession(session)); tr_torrent* tor = NULL; @@ -1382,7 +1383,7 @@ tr_port_forwarding tr_sessionGetPortForwarding(tr_session const* session) { TR_ASSERT(tr_isSession(session)); - return tr_sharedTraversalStatus(session->shared); + return tr_port_forwarding(tr_sharedTraversalStatus(session->shared)); } /*** @@ -1534,7 +1535,7 @@ static void turtleUpdateTable(struct tr_turtle_info* t) static void altSpeedToggled(void* vsession) { - tr_session* session = vsession; + auto* session = static_cast(vsession); TR_ASSERT(tr_isSession(session)); @@ -2012,7 +2013,7 @@ static void sessionCloseImplWaitForIdleUdp(evutil_socket_t fd, short what, void* TR_UNUSED(fd); TR_UNUSED(what); - tr_session* session = vsession; + auto* session = static_cast(vsession); TR_ASSERT(tr_isSession(session)); @@ -2051,7 +2052,7 @@ static void sessionCloseImplFinish(tr_session* session) static void sessionCloseImpl(void* vsession) { - tr_session* session = vsession; + auto* session = static_cast(vsession); TR_ASSERT(tr_isSession(session)); @@ -2165,8 +2166,7 @@ struct sessionLoadTorrentsData static void sessionLoadTorrents(void* vdata) { - struct sessionLoadTorrentsData* data = vdata; - + auto* data = static_cast(vdata); TR_ASSERT(tr_isSession(data->session)); int i; @@ -2281,9 +2281,9 @@ bool tr_sessionIsDHTEnabled(tr_session const* session) return session->isDHTEnabled; } -static void toggleDHTImpl(void* data) +static void toggleDHTImpl(void* vsession) { - tr_session* session = data; + auto* session = static_cast(vsession); TR_ASSERT(tr_isSession(session)); @@ -2317,9 +2317,9 @@ bool tr_sessionIsUTPEnabled(tr_session const* session) #endif } -static void toggle_utp(void* data) +static void toggle_utp(void* vsession) { - tr_session* session = data; + auto* session = static_cast(vsession); TR_ASSERT(tr_isSession(session)); @@ -2345,9 +2345,9 @@ void tr_sessionSetUTPEnabled(tr_session* session, bool enabled) **** ***/ -static void toggleLPDImpl(void* data) +static void toggleLPDImpl(void* vsession) { - tr_session* session = data; + auto* session = static_cast(vsession); TR_ASSERT(tr_isSession(session)); @@ -2416,7 +2416,7 @@ struct port_forwarding_data static void setPortForwardingEnabled(void* vdata) { - struct port_forwarding_data* data = vdata; + auto* data = static_cast(vdata); tr_sharedTraversalEnable(data->shared, data->enabled); tr_free(data); } @@ -2455,7 +2455,7 @@ static void loadBlocklists(tr_session* session) char* dirname; char const* name; tr_list* blocklists = NULL; - tr_ptrArray loadme = TR_PTR_ARRAY_INIT; + auto loadme = tr_ptrArray{}; bool const isEnabled = session->isBlocklistEnabled; /* walk the blocklist directory... */ @@ -2587,7 +2587,8 @@ int tr_blocklistGetRuleCount(tr_session const* session) for (tr_list* l = session->blocklists; l != NULL; l = l->next) { - n += tr_blocklistFileGetRuleCount(l->data); + auto const* blocklistFile = static_cast(l->data); + n += tr_blocklistFileGetRuleCount(blocklistFile); } return n; @@ -2608,7 +2609,8 @@ void tr_blocklistSetEnabled(tr_session* session, bool isEnabled) for (tr_list* l = session->blocklists; l != NULL; l = l->next) { - tr_blocklistFileSetEnabled(l->data, isEnabled); + auto* blocklistFile = static_cast(l->data); + tr_blocklistFileSetEnabled(blocklistFile, isEnabled); } } @@ -2628,9 +2630,10 @@ int tr_blocklistSetContent(tr_session* session, char const* contentFilename) for (tr_list* l = session->blocklists; b == NULL && l != NULL; l = l->next) { - if (tr_stringEndsWith(tr_blocklistFileGetFilename(l->data), defaultName)) + auto const* blocklistFile = static_cast(l->data); + if (tr_stringEndsWith(tr_blocklistFileGetFilename(blocklistFile), defaultName)) { - b = l->data; + b = static_cast(l->data); } } @@ -2653,7 +2656,7 @@ bool tr_sessionIsAddressBlocked(tr_session const* session, tr_address const* add for (tr_list* l = session->blocklists; l != NULL; l = l->next) { - if (tr_blocklistFileHasAddress(l->data, addr)) + if (tr_blocklistFileHasAddress(static_cast(l->data), addr)) { return true; } @@ -3022,8 +3025,8 @@ struct TorrentAndPosition static int compareTorrentAndPositions(void const* va, void const* vb) { int ret; - struct TorrentAndPosition const* a = va; - struct TorrentAndPosition const* b = vb; + auto const* a = static_cast(va); + auto const* b = static_cast(vb); if (a->position > b->position) { @@ -3136,22 +3139,22 @@ int tr_sessionCountQueueFreeSlots(tr_session* session, tr_direction dir) static int compareTorrentsById(void const* va, void const* vb) { - tr_torrent const* const a = va; - tr_torrent const* const b = vb; + auto const* const a = static_cast(va); + auto const* const b = static_cast(vb); return a->uniqueId - b->uniqueId; } static int compareTorrentsByHashString(void const* va, void const* vb) { - tr_torrent const* const a = va; - tr_torrent const* const b = vb; + auto const* const a = static_cast(va); + auto const* const b = static_cast(vb); return evutil_ascii_strcasecmp(a->info.hashString, b->info.hashString); } static int compareTorrentsByHash(void const* va, void const* vb) { - tr_torrent const* const a = va; - tr_torrent const* const b = vb; + auto const* const a = static_cast(va); + auto const* const b = static_cast(vb); return memcmp(a->info.hash, b->info.hash, SHA_DIGEST_LENGTH); } diff --git a/libtransmission/stats.c b/libtransmission/stats.cc similarity index 95% rename from libtransmission/stats.c rename to libtransmission/stats.cc index d0c720247..2361b5b53 100644 --- a/libtransmission/stats.c +++ b/libtransmission/stats.cc @@ -18,15 +18,6 @@ **** ***/ -struct tr_session_stats const TR_SESSION_STATS_INIT = { - .ratio = 0.0F, - .uploadedBytes = 0, - .downloadedBytes = 0, - .filesAdded = 0, - .sessionCount = 0, - .secondsActive = 0, -}; - /** @brief Opaque, per-session data structure for bandwidth use statistics */ struct tr_stats_handle { @@ -145,7 +136,7 @@ void tr_statsSaveDirty(tr_session* session) if (h != NULL && h->isDirty) { - tr_session_stats cumulative = TR_SESSION_STATS_INIT; + auto cumulative = tr_session_stats{}; tr_sessionGetCumulativeStats(session, &cumulative); saveCumulativeStats(session, &cumulative); h->isDirty = false; @@ -194,7 +185,7 @@ void tr_sessionGetStats(tr_session const* session, tr_session_stats* setme) void tr_sessionGetCumulativeStats(tr_session const* session, tr_session_stats* setme) { struct tr_stats_handle const* stats = getStats(session); - tr_session_stats current = TR_SESSION_STATS_INIT; + auto current = tr_session_stats{}; if (stats != NULL) { diff --git a/libtransmission/stats.h b/libtransmission/stats.h index 298250a4d..5513c5048 100644 --- a/libtransmission/stats.h +++ b/libtransmission/stats.h @@ -12,8 +12,6 @@ #error only libtransmission should #include this header. #endif -extern struct tr_session_stats const TR_SESSION_STATS_INIT; - void tr_statsInit(tr_session* session); void tr_statsClose(tr_session* session); void tr_statsSaveDirty(tr_session* session); diff --git a/libtransmission/subprocess-posix.c b/libtransmission/subprocess-posix.cc similarity index 100% rename from libtransmission/subprocess-posix.c rename to libtransmission/subprocess-posix.cc diff --git a/libtransmission/subprocess-win32.c b/libtransmission/subprocess-win32.cc similarity index 95% rename from libtransmission/subprocess-win32.c rename to libtransmission/subprocess-win32.cc index 15b32a08b..8b75996b6 100644 --- a/libtransmission/subprocess-win32.c +++ b/libtransmission/subprocess-win32.cc @@ -62,7 +62,7 @@ static bool parse_env_block_part(wchar_t const* part, size_t* full_len, size_t* { TR_ASSERT(part != NULL); - wchar_t* const equals_pos = wcschr(part, L'='); + auto const* const equals_pos = wcschr(part, L'='); if (equals_pos == NULL) { @@ -104,9 +104,11 @@ static int compare_wide_strings_ci(wchar_t const* lhs, size_t lhs_len, wchar_t c return diff; } -static int compare_env_part_names(wchar_t const** lhs, wchar_t const** rhs) +static int compare_env_part_names(void const* vlhs, void const* vrhs) { int ret = 0; + auto const* const* const lhs = reinterpret_cast(vlhs); + auto const* const* const rhs = reinterpret_cast(vrhs); size_t lhs_part_len; size_t lhs_name_len; @@ -395,11 +397,10 @@ bool tr_spawn_async(char* const* cmd, char* const* env, char const* work_dir, tr wchar_t* current_dir = work_dir != NULL ? tr_win32_utf8_to_native(work_dir, -1) : NULL; - STARTUPINFOW si = { - .cb = sizeof(si), - .dwFlags = STARTF_USESHOWWINDOW, - .wShowWindow = SW_HIDE, - }; + auto si = STARTUPINFOW{}; + si.cb = sizeof(si); + si.dwFlags = STARTF_USESHOWWINDOW; + si.wShowWindow = SW_HIDE; PROCESS_INFORMATION pi; diff --git a/libtransmission/torrent-ctor.c b/libtransmission/torrent-ctor.cc similarity index 98% rename from libtransmission/torrent-ctor.c rename to libtransmission/torrent-ctor.cc index 979844f5d..1fe627496 100644 --- a/libtransmission/torrent-ctor.c +++ b/libtransmission/torrent-ctor.cc @@ -221,7 +221,7 @@ void tr_ctorSetFilePriorities(tr_ctor* ctor, tr_file_index_t const* files, tr_fi } tr_free(*myfiles); - *myfiles = tr_memdup(files, sizeof(tr_file_index_t) * fileCount); + *myfiles = static_cast(tr_memdup(files, sizeof(tr_file_index_t) * fileCount)); *mycount = fileCount; } @@ -249,7 +249,7 @@ void tr_ctorSetFilesWanted(tr_ctor* ctor, tr_file_index_t const* files, tr_file_ tr_file_index_t* mycount = wanted ? &ctor->wantSize : &ctor->notWantSize; tr_free(*myfiles); - *myfiles = tr_memdup(files, sizeof(tr_file_index_t) * fileCount); + *myfiles = static_cast(tr_memdup(files, sizeof(tr_file_index_t) * fileCount)); *mycount = fileCount; } diff --git a/libtransmission/torrent-magnet.c b/libtransmission/torrent-magnet.cc similarity index 100% rename from libtransmission/torrent-magnet.c rename to libtransmission/torrent-magnet.cc diff --git a/libtransmission/torrent.c b/libtransmission/torrent.cc similarity index 97% rename from libtransmission/torrent.c rename to libtransmission/torrent.cc index e45cbf644..8d2ca12fe 100644 --- a/libtransmission/torrent.c +++ b/libtransmission/torrent.cc @@ -75,38 +75,40 @@ int tr_torrentId(tr_torrent const* tor) static int compareKeyToTorrentId(void const* va, void const* vb) { - tr_torrent const* const a = va; - int const b = *(int const*)vb; + auto const* const a = static_cast(va); + auto const b = *static_cast(vb); return a->uniqueId - b; } tr_torrent* tr_torrentFindFromId(tr_session* session, int id) { - return tr_ptrArrayFindSorted(&session->torrentsSortedById, &id, compareKeyToTorrentId); + return static_cast(tr_ptrArrayFindSorted(&session->torrentsSortedById, &id, compareKeyToTorrentId)); } static int compareKeyToTorrentHashString(void const* va, void const* vb) { - tr_torrent const* const a = va; - char const* const b = vb; + auto const* const a = static_cast(va); + auto const* const b = static_cast(vb); return evutil_ascii_strcasecmp(a->info.hashString, b); } tr_torrent* tr_torrentFindFromHashString(tr_session* session, char const* str) { - return tr_ptrArrayFindSorted(&session->torrentsSortedByHashString, str, compareKeyToTorrentHashString); + return static_cast( + tr_ptrArrayFindSorted(&session->torrentsSortedByHashString, str, compareKeyToTorrentHashString)); } static int compareKeyToTorrentHash(void const* va, void const* vb) { - tr_torrent const* const a = va; - uint8_t const* const b = vb; + auto const* const a = static_cast(va); + auto const* const b = static_cast(vb); return memcmp(a->info.hash, b, SHA_DIGEST_LENGTH); } tr_torrent* tr_torrentFindFromHash(tr_session* session, uint8_t const* torrentHash) { - return tr_ptrArrayFindSorted(&session->torrentsSortedByHash, torrentHash, compareKeyToTorrentHash); + return static_cast( + tr_ptrArrayFindSorted(&session->torrentsSortedByHash, torrentHash, compareKeyToTorrentHash)); } tr_torrent* tr_torrentFindFromMagnetLink(tr_session* session, char const* magnet) @@ -882,7 +884,7 @@ static void torrentInit(tr_torrent* tor, tr_ctor const* ctor) tor->uniqueId = nextUniqueId++; tor->magicNumber = TORRENT_MAGIC_NUMBER; tor->queuePosition = session->torrentCount; - tor->labels = TR_PTR_ARRAY_INIT; + tor->labels = {}; tr_sha1(tor->obfuscatedHash, "req2", 4, tor->info.hash, SHA_DIGEST_LENGTH, NULL); @@ -1164,7 +1166,7 @@ void tr_torrentChangeMyPort(tr_torrent* tor) static inline void tr_torrentManualUpdateImpl(void* vtor) { - tr_torrent* tor = vtor; + auto* tor = static_cast(vtor); TR_ASSERT(tr_isTorrent(tor)); @@ -1287,7 +1289,7 @@ tr_stat const* tr_torrentStat(tr_torrent* tor) uint16_t seedIdleMinutes; unsigned int pieceUploadSpeed_Bps; unsigned int pieceDownloadSpeed_Bps; - struct tr_swarm_stats swarm_stats; + auto swarm_stats = tr_swarm_stats{}; tor->lastStatTime = tr_time(); @@ -1295,10 +1297,6 @@ tr_stat const* tr_torrentStat(tr_torrent* tor) { tr_swarmGetStats(tor->swarm, &swarm_stats); } - else - { - swarm_stats = TR_SWARM_STATS_INIT; - } s = &tor->stats; s->id = tor->uniqueId; @@ -1677,7 +1675,7 @@ static void torrentSetQueued(tr_torrent* tor, bool queued); static void torrentStartImpl(void* vtor) { - tr_torrent* tor = vtor; + auto* tor = static_cast(vtor); TR_ASSERT(tr_isTorrent(tor)); @@ -1822,7 +1820,7 @@ struct verify_data static void onVerifyDoneThreadFunc(void* vdata) { - struct verify_data* data = vdata; + auto* data = static_cast(vdata); tr_torrent* tor = data->tor; if (!tor->isDeleting) @@ -1849,7 +1847,7 @@ static void onVerifyDoneThreadFunc(void* vdata) static void onVerifyDone(tr_torrent* tor, bool aborted, void* vdata) { - struct verify_data* data = vdata; + auto* data = static_cast(vdata); TR_ASSERT(data->tor == tor); @@ -1865,8 +1863,8 @@ static void onVerifyDone(tr_torrent* tor, bool aborted, void* vdata) static void verifyTorrent(void* vdata) { + auto* data = static_cast(vdata); bool startAfter; - struct verify_data* data = vdata; tr_torrent* tor = data->tor; tr_sessionLock(tor->session); @@ -1903,9 +1901,7 @@ unlock: void tr_torrentVerify(tr_torrent* tor, tr_verify_done_func callback_func, void* callback_data) { - struct verify_data* data; - - data = tr_new(struct verify_data, 1); + struct verify_data* const data = tr_new(struct verify_data, 1); data->tor = tor; data->aborted = false; data->callback_func = callback_func; @@ -1926,7 +1922,7 @@ void tr_torrentSave(tr_torrent* tor) static void stopTorrent(void* vtor) { - tr_torrent* tor = vtor; + auto* tor = static_cast(vtor); TR_ASSERT(tr_isTorrent(tor)); @@ -1979,7 +1975,7 @@ void tr_torrentStop(tr_torrent* tor) static void closeTorrent(void* vtor) { - tr_torrent* tor = vtor; + auto* tor = static_cast(vtor); TR_ASSERT(tr_isTorrent(tor)); @@ -2030,7 +2026,7 @@ static void tr_torrentDeleteLocalData(tr_torrent*, tr_fileFunc); static void removeTorrent(void* vdata) { - struct remove_data* data = vdata; + auto* data = static_cast(vdata); tr_session* session = data->tor->session; tr_sessionLock(session); @@ -2442,7 +2438,7 @@ void tr_torrentSetLabels(tr_torrent* tor, tr_ptrArray* labels) tr_torrentLock(tor); tr_ptrArrayDestruct(&tor->labels, tr_free); - tor->labels = TR_PTR_ARRAY_INIT; + tor->labels = {}; char** l = (char**)tr_ptrArrayBase(labels); int const n = tr_ptrArraySize(labels); for (int i = 0; i < n; i++) @@ -2713,8 +2709,8 @@ bool tr_torrentPieceNeedsCheck(tr_torrent const* tor, tr_piece_index_t p) static int compareTrackerByTier(void const* va, void const* vb) { - tr_tracker_info const* a = va; - tr_tracker_info const* b = vb; + auto const* const a = static_cast(va); + auto const* const b = static_cast(vb); /* sort by tier */ if (a->tier != b->tier) @@ -2734,10 +2730,9 @@ bool tr_torrentSetAnnounceList(tr_torrent* tor, tr_tracker_info const* trackers_ tr_variant metainfo; bool ok = true; - tr_tracker_info* trackers; /* ensure the trackers' tiers are in ascending order */ - trackers = tr_memdup(trackers_in, sizeof(tr_tracker_info) * trackerCount); + auto* trackers = static_cast(tr_memdup(trackers_in, sizeof(tr_tracker_info) * trackerCount)); qsort(trackers, trackerCount, sizeof(tr_tracker_info), compareTrackerByTier); /* look for bad URLs */ @@ -2985,11 +2980,8 @@ static void removeEmptyFoldersAndJunkFiles(char const* folder) */ static void deleteLocalData(tr_torrent* tor, tr_fileFunc func) { - char* base; - tr_sys_dir_t odir; - char* tmpdir = NULL; - tr_ptrArray files = TR_PTR_ARRAY_INIT; - tr_ptrArray folders = TR_PTR_ARRAY_INIT; + auto files = tr_ptrArray{}; + auto folders = tr_ptrArray{}; PtrArrayCompareFunc vstrcmp = (PtrArrayCompareFunc)strcmp; char const* const top = tor->currentDir; @@ -3009,8 +3001,8 @@ static void deleteLocalData(tr_torrent* tor, tr_fileFunc func) **** Move the local data to a new tmpdir ***/ - base = tr_strdup_printf("%s__XXXXXX", tr_torrentName(tor)); - tmpdir = tr_buildPath(top, base, NULL); + char* base = tr_strdup_printf("%s__XXXXXX", tr_torrentName(tor)); + char* tmpdir = tr_buildPath(top, base, NULL); tr_sys_dir_create_temp(tmpdir, NULL); tr_free(base); @@ -3055,6 +3047,7 @@ static void deleteLocalData(tr_torrent* tor, tr_fileFunc func) ***/ /* try deleting the local data's top-level files & folders */ + tr_sys_dir_t odir; if ((odir = tr_sys_dir_open(tmpdir, NULL)) != TR_BAD_SYS_DIR) { char const* name; @@ -3139,7 +3132,7 @@ static void deleteLocalData(tr_torrent* tor, tr_fileFunc func) for (int i = 0, n = tr_ptrArraySize(&folders); i < n; ++i) { - removeEmptyFoldersAndJunkFiles(tr_ptrArrayNth(&folders, i)); + removeEmptyFoldersAndJunkFiles(static_cast(tr_ptrArrayNth(&folders, i))); } /* cleanup */ @@ -3180,7 +3173,7 @@ struct LocationData static void setLocation(void* vdata) { - struct LocationData* data = vdata; + auto* data = static_cast(vdata); tr_torrent* tor = data->tor; TR_ASSERT(tr_isTorrent(tor)); @@ -3492,7 +3485,7 @@ bool tr_torrentFindFile2(tr_torrent const* tor, tr_file_index_t fileNum, char co tr_file const* file; char const* b = NULL; char const* s = NULL; - tr_sys_path_info file_info = { 0 }; + auto file_info = tr_sys_path_info{}; file = &tor->info.files[fileNum]; @@ -3690,7 +3683,7 @@ void tr_torrentSetQueuePosition(tr_torrent* tor, int pos) void tr_torrentsQueueMoveTop(tr_torrent** torrents_in, int n) { - tr_torrent** torrents = tr_memdup(torrents_in, sizeof(tr_torrent*) * n); + auto** torrents = static_cast(tr_memdup(torrents_in, sizeof(tr_torrent*) * n)); qsort(torrents, n, sizeof(tr_torrent*), compareTorrentByQueuePosition); for (int i = n - 1; i >= 0; --i) @@ -3703,9 +3696,7 @@ void tr_torrentsQueueMoveTop(tr_torrent** torrents_in, int n) void tr_torrentsQueueMoveUp(tr_torrent** torrents_in, int n) { - tr_torrent** torrents; - - torrents = tr_memdup(torrents_in, sizeof(tr_torrent*) * n); + auto** torrents = static_cast(tr_memdup(torrents_in, sizeof(tr_torrent*) * n)); qsort(torrents, n, sizeof(tr_torrent*), compareTorrentByQueuePosition); for (int i = 0; i < n; ++i) @@ -3718,9 +3709,7 @@ void tr_torrentsQueueMoveUp(tr_torrent** torrents_in, int n) void tr_torrentsQueueMoveDown(tr_torrent** torrents_in, int n) { - tr_torrent** torrents; - - torrents = tr_memdup(torrents_in, sizeof(tr_torrent*) * n); + auto** torrents = static_cast(tr_memdup(torrents_in, sizeof(tr_torrent*) * n)); qsort(torrents, n, sizeof(tr_torrent*), compareTorrentByQueuePosition); for (int i = n - 1; i >= 0; --i) @@ -3733,9 +3722,7 @@ void tr_torrentsQueueMoveDown(tr_torrent** torrents_in, int n) void tr_torrentsQueueMoveBottom(tr_torrent** torrents_in, int n) { - tr_torrent** torrents; - - torrents = tr_memdup(torrents_in, sizeof(tr_torrent*) * n); + auto** torrents = static_cast(tr_memdup(torrents_in, sizeof(tr_torrent*) * n)); qsort(torrents, n, sizeof(tr_torrent*), compareTorrentByQueuePosition); for (int i = 0; i < n; ++i) @@ -3929,7 +3916,7 @@ struct rename_data static void torrentRenamePath(void* vdata) { - struct rename_data* data = vdata; + auto* data = static_cast(vdata); tr_torrent* const tor = data->tor; TR_ASSERT(tr_isTorrent(tor)); diff --git a/libtransmission/tr-assert.c b/libtransmission/tr-assert.cc similarity index 100% rename from libtransmission/tr-assert.c rename to libtransmission/tr-assert.cc diff --git a/libtransmission/tr-dht.c b/libtransmission/tr-dht.cc similarity index 97% rename from libtransmission/tr-dht.c rename to libtransmission/tr-dht.cc index 6e5d05403..62e8abbdf 100644 --- a/libtransmission/tr-dht.c +++ b/libtransmission/tr-dht.cc @@ -158,7 +158,7 @@ static void bootstrap_from_name(char const* name, tr_port port, int af) static void dht_bootstrap(void* closure) { - struct bootstrap_closure* cl = closure; + auto* cl = static_cast(closure); int num = cl->len / 6; int num6 = cl->len6 / 18; @@ -242,15 +242,13 @@ static void dht_bootstrap(void* closure) for (;;) { char buf[201]; - char* p; - int port = 0; - if (!tr_sys_file_read_line(f, buf, 200, NULL)) { break; } - p = memchr(buf, ' ', strlen(buf)); + auto* p = static_cast(memchr(buf, ' ', strlen(buf))); + int port = 0; if (p != NULL) { @@ -357,12 +355,12 @@ int tr_dhtInit(tr_session* ss) if (ss->udp_socket != TR_BAD_SOCKET && tr_variantDictFindRaw(&benc, TR_KEY_nodes, &raw, &len) && len % 6 == 0) { - nodes = tr_memdup(raw, len); + nodes = static_cast(tr_memdup(raw, len)); } if (ss->udp6_socket != TR_BAD_SOCKET && tr_variantDictFindRaw(&benc, TR_KEY_nodes6, &raw, &len6) && len6 % 18 == 0) { - nodes6 = tr_memdup(raw, len6); + nodes6 = static_cast(tr_memdup(raw, len6)); } tr_variantFree(&benc); @@ -523,7 +521,7 @@ struct getstatus_closure static void getstatus(void* cl) { - struct getstatus_closure* closure = cl; + auto* closure = static_cast(cl); int good; int dubious; int incoming; @@ -552,7 +550,7 @@ static void getstatus(void* cl) int tr_dhtStatus(tr_session* session, int af, int* nodes_return) { - struct getstatus_closure closure = { .af = af, .status = -1, .count = -1 }; + auto closure = getstatus_closure{ af, -1, -1 }; if (!tr_dhtEnabled(session) || (af == AF_INET && session->udp_socket == TR_BAD_SOCKET) || (af == AF_INET6 && session->udp6_socket == TR_BAD_SOCKET)) @@ -800,7 +798,7 @@ void tr_dhtUpkeep(tr_session* session) void tr_dhtCallback(unsigned char* buf, int buflen, struct sockaddr* from, socklen_t fromlen, void* sv) { - TR_ASSERT(tr_isSession(sv)); + TR_ASSERT(tr_isSession(static_cast(sv))); if (sv != session_) { @@ -872,12 +870,12 @@ int dht_random_bytes(void* buf, size_t size) int dht_sendto(int sockfd, void const* buf, int len, int flags, struct sockaddr const* to, int tolen) { - return sendto(sockfd, buf, len, flags, to, tolen); + return sendto(sockfd, static_cast(buf), len, flags, to, tolen); } #if defined(_WIN32) && !defined(__MINGW32__) -int dht_gettimeofday(struct timeval* tv, struct timezone* tz) +extern "C" int dht_gettimeofday(struct timeval* tv, struct timezone* tz) { TR_ASSERT(tz == NULL); diff --git a/libtransmission/tr-getopt.c b/libtransmission/tr-getopt.cc similarity index 100% rename from libtransmission/tr-getopt.c rename to libtransmission/tr-getopt.cc diff --git a/libtransmission/tr-lpd.c b/libtransmission/tr-lpd.cc similarity index 96% rename from libtransmission/tr-lpd.c rename to libtransmission/tr-lpd.cc index 2f6cd7a4a..194dd3615 100644 --- a/libtransmission/tr-lpd.c +++ b/libtransmission/tr-lpd.cc @@ -337,7 +337,7 @@ int tr_lpdInit(tr_session* ss, tr_address* tr_addr) goto fail; } - if (setsockopt(lpd_socket, SOL_SOCKET, SO_REUSEADDR, (void const*)&opt_on, sizeof(opt_on)) == -1) + if (setsockopt(lpd_socket, SOL_SOCKET, SO_REUSEADDR, reinterpret_cast(&opt_on), sizeof(opt_on)) == -1) { goto fail; } @@ -361,12 +361,14 @@ int tr_lpdInit(tr_session* ss, tr_address* tr_addr) mcastReq.imr_multiaddr = lpd_mcastAddr.sin_addr; mcastReq.imr_interface.s_addr = htonl(INADDR_ANY); - if (setsockopt(lpd_socket, IPPROTO_IP, IP_ADD_MEMBERSHIP, (void const*)&mcastReq, sizeof(mcastReq)) == -1) + if (setsockopt(lpd_socket, IPPROTO_IP, IP_ADD_MEMBERSHIP, reinterpret_cast(&mcastReq), sizeof(mcastReq)) == + -1) { goto fail; } - if (setsockopt(lpd_socket, IPPROTO_IP, IP_MULTICAST_LOOP, (void const*)&opt_off, sizeof(opt_off)) == -1) + if (setsockopt(lpd_socket, IPPROTO_IP, IP_MULTICAST_LOOP, reinterpret_cast(&opt_off), sizeof(opt_off)) == + -1) { goto fail; } @@ -389,12 +391,13 @@ int tr_lpdInit(tr_session* ss, tr_address* tr_addr) } /* configure outbound multicast TTL */ - if (setsockopt(lpd_socket2, IPPROTO_IP, IP_MULTICAST_TTL, (void const*)&scope, sizeof(scope)) == -1) + if (setsockopt(lpd_socket2, IPPROTO_IP, IP_MULTICAST_TTL, reinterpret_cast(&scope), sizeof(scope)) == -1) { goto fail; } - if (setsockopt(lpd_socket2, IPPROTO_IP, IP_MULTICAST_LOOP, (void const*)&opt_off, sizeof(opt_off)) == -1) + if (setsockopt(lpd_socket2, IPPROTO_IP, IP_MULTICAST_LOOP, reinterpret_cast(&opt_off), sizeof(opt_off)) == + -1) { goto fail; } @@ -508,13 +511,7 @@ bool tr_lpdSendAnnounce(tr_torrent const* t) /* destination address info has already been set up in tr_lpdInit(), * so we refrain from preparing another sockaddr_in here */ - int res = sendto( - lpd_socket2, - (void const*)query, - len, - 0, - (struct sockaddr const*)&lpd_mcastAddr, - sizeof(lpd_mcastAddr)); + int res = sendto(lpd_socket2, query, len, 0, (struct sockaddr const*)&lpd_mcastAddr, sizeof(lpd_mcastAddr)); if (res != len) { @@ -549,7 +546,7 @@ static int tr_lpdConsiderAnnounce(tr_pex* peer, char const* const msg) maxHashLen = SIZEOF_HASH_STRING }; - struct lpd_protocolVersion ver = { .major = -1, .minor = -1 }; + auto ver = lpd_protocolVersion{ -1, -1 }; char value[maxValueLen] = { 0 }; char hashString[maxHashLen] = { 0 }; int res = 0; @@ -727,7 +724,7 @@ static void event_callback(evutil_socket_t s, short type, void* user_data) /* process local announcement from foreign peer */ int res = recvfrom( lpd_socket, - (void*)foreignMsg, + foreignMsg, lpd_maxDatagramLength, 0, (struct sockaddr*)&foreignAddr, @@ -741,10 +738,7 @@ static void event_callback(evutil_socket_t s, short type, void* user_data) if (res > 0 && res <= lpd_maxDatagramLength) { - struct tr_pex foreignPeer = { - .port = 0, /* the peer-to-peer port is yet unknown */ - .flags = 0, - }; + auto foreignPeer = tr_pex{}; /* be paranoid enough about zero terminating the foreign string */ foreignMsg[res] = '\0'; diff --git a/libtransmission/tr-udp.c b/libtransmission/tr-udp.cc similarity index 91% rename from libtransmission/tr-udp.c rename to libtransmission/tr-udp.cc index 17d569d3c..efe621a2b 100644 --- a/libtransmission/tr-udp.c +++ b/libtransmission/tr-udp.cc @@ -62,7 +62,7 @@ static void set_socket_buffers(tr_socket_t fd, bool large) char err_buf[512]; size = large ? RECV_BUFFER_SIZE : SMALL_BUFFER_SIZE; - rc = setsockopt(fd, SOL_SOCKET, SO_RCVBUF, (void const*)&size, sizeof(size)); + rc = setsockopt(fd, SOL_SOCKET, SO_RCVBUF, reinterpret_cast(&size), sizeof(size)); if (rc < 0) { @@ -70,7 +70,7 @@ static void set_socket_buffers(tr_socket_t fd, bool large) } size = large ? SEND_BUFFER_SIZE : SMALL_BUFFER_SIZE; - rc = setsockopt(fd, SOL_SOCKET, SO_SNDBUF, (void const*)&size, sizeof(size)); + rc = setsockopt(fd, SOL_SOCKET, SO_SNDBUF, reinterpret_cast(&size), sizeof(size)); if (rc < 0) { @@ -79,14 +79,14 @@ static void set_socket_buffers(tr_socket_t fd, bool large) if (large) { - rc = getsockopt(fd, SOL_SOCKET, SO_RCVBUF, (void*)&rbuf, &rbuf_len); + rc = getsockopt(fd, SOL_SOCKET, SO_RCVBUF, reinterpret_cast(&rbuf), &rbuf_len); if (rc < 0) { rbuf = 0; } - rc = getsockopt(fd, SOL_SOCKET, SO_SNDBUF, (void*)&sbuf, &sbuf_len); + rc = getsockopt(fd, SOL_SOCKET, SO_SNDBUF, reinterpret_cast(&sbuf), &sbuf_len); if (rc < 0) { @@ -167,7 +167,7 @@ static void rebind_ipv6(tr_session* ss, bool force) #ifdef IPV6_V6ONLY /* Since we always open an IPv4 socket on the same port, this shouldn't matter. But I'm superstitious. */ - (void)setsockopt(s, IPPROTO_IPV6, IPV6_V6ONLY, (void const*)&one, sizeof(one)); + (void)setsockopt(s, IPPROTO_IPV6, IPV6_V6ONLY, reinterpret_cast(&one), sizeof(one)); #endif memset(&sin6, 0, sizeof(sin6)); @@ -212,7 +212,7 @@ static void rebind_ipv6(tr_session* ss, bool force) if (ss->udp6_bound == NULL) { - ss->udp6_bound = malloc(16); + ss->udp6_bound = static_cast(malloc(16)); } if (ss->udp6_bound != NULL) @@ -239,21 +239,21 @@ FAIL: } } -static void event_callback(evutil_socket_t s, short type, void* sv) +static void event_callback(evutil_socket_t s, short type, void* vsession) { TR_UNUSED(type); - TR_ASSERT(tr_isSession(sv)); + TR_ASSERT(tr_isSession(static_cast(vsession))); TR_ASSERT(type == EV_READ); int rc; socklen_t fromlen; unsigned char buf[4096]; struct sockaddr_storage from; - tr_session* ss = sv; + auto* session = static_cast(vsession); fromlen = sizeof(from); - rc = recvfrom(s, (void*)buf, 4096 - 1, 0, (struct sockaddr*)&from, &fromlen); + rc = recvfrom(s, reinterpret_cast(buf), 4096 - 1, 0, (struct sockaddr*)&from, &fromlen); /* Since most packets we receive here are µTP, make quick inline checks for the other protocols. The logic is as follows: @@ -266,15 +266,15 @@ static void event_callback(evutil_socket_t s, short type, void* sv) { if (buf[0] == 'd') { - if (tr_sessionAllowsDHT(ss)) + if (tr_sessionAllowsDHT(session)) { buf[rc] = '\0'; /* required by the DHT code */ - tr_dhtCallback(buf, rc, (struct sockaddr*)&from, fromlen, sv); + tr_dhtCallback(buf, rc, (struct sockaddr*)&from, fromlen, vsession); } } else if (rc >= 8 && buf[0] == 0 && buf[1] == 0 && buf[2] == 0 && buf[3] <= 3) { - rc = tau_handle_message(ss, buf, rc); + rc = tau_handle_message(session, buf, rc); if (rc == 0) { @@ -283,9 +283,9 @@ static void event_callback(evutil_socket_t s, short type, void* sv) } else { - if (tr_sessionIsUTPEnabled(ss)) + if (tr_sessionIsUTPEnabled(session)) { - rc = tr_utpPacket(buf, rc, (struct sockaddr*)&from, fromlen, ss); + rc = tr_utpPacket(buf, rc, (struct sockaddr*)&from, fromlen, session); if (rc == 0) { diff --git a/libtransmission/tr-utp.c b/libtransmission/tr-utp.cc similarity index 89% rename from libtransmission/tr-utp.c rename to libtransmission/tr-utp.cc index 9432e6142..798113db7 100644 --- a/libtransmission/tr-utp.c +++ b/libtransmission/tr-utp.cc @@ -104,16 +104,16 @@ void tr_utpSendTo(void* closure, unsigned char const* buf, size_t buflen, struct #define UTP_INTERVAL_US 50000 -static void incoming(void* closure, struct UTPSocket* s) +static void incoming(void* vsession, struct UTPSocket* s) { - tr_session* ss = closure; + auto* session = static_cast(vsession); struct sockaddr_storage from_storage; struct sockaddr* from = (struct sockaddr*)&from_storage; socklen_t fromlen = sizeof(from_storage); tr_address addr; tr_port port; - if (!tr_sessionIsUTPEnabled(ss)) + if (!tr_sessionIsUTPEnabled(session)) { UTP_Close(s); return; @@ -128,20 +128,20 @@ static void incoming(void* closure, struct UTPSocket* s) return; } - tr_peerMgrAddIncoming(ss->peerMgr, &addr, port, tr_peer_socket_utp_create(s)); + tr_peerMgrAddIncoming(session->peerMgr, &addr, port, tr_peer_socket_utp_create(s)); } void tr_utpSendTo(void* closure, unsigned char const* buf, size_t buflen, struct sockaddr const* to, socklen_t tolen) { - tr_session const* const ss = closure; + auto const* const ss = static_cast(closure); if (to->sa_family == AF_INET && ss->udp_socket != TR_BAD_SOCKET) { - sendto(ss->udp_socket, (void const*)buf, buflen, 0, to, tolen); + sendto(ss->udp_socket, reinterpret_cast(buf), buflen, 0, to, tolen); } else if (to->sa_family == AF_INET6 && ss->udp6_socket != TR_BAD_SOCKET) { - sendto(ss->udp6_socket, (void const*)buf, buflen, 0, to, tolen); + sendto(ss->udp6_socket, reinterpret_cast(buf), buflen, 0, to, tolen); } } @@ -169,14 +169,14 @@ static void reset_timer(tr_session* ss) tr_timerAdd(ss->utp_timer, sec, usec); } -static void timer_callback(evutil_socket_t s, short type, void* closure) +static void timer_callback(evutil_socket_t s, short type, void* vsession) { TR_UNUSED(s); TR_UNUSED(type); - tr_session* ss = closure; + auto* session = static_cast(vsession); UTP_CheckTimeouts(); - reset_timer(ss); + reset_timer(session); } int tr_utpPacket(unsigned char const* buf, size_t buflen, struct sockaddr const* from, socklen_t fromlen, tr_session* ss) diff --git a/libtransmission/trevent.c b/libtransmission/trevent.cc similarity index 97% rename from libtransmission/trevent.c rename to libtransmission/trevent.cc index 16a20e83e..6b52091e9 100644 --- a/libtransmission/trevent.c +++ b/libtransmission/trevent.cc @@ -104,7 +104,7 @@ static int pgpipe(tr_pipe_end_t handles[2]) static int piperead(tr_pipe_end_t s, void* buf, int len) { - int ret = recv(s, buf, len, 0); + int ret = recv(s, static_cast(buf), len, 0); if (ret == -1) { @@ -169,15 +169,14 @@ struct tr_run_data static void readFromPipe(evutil_socket_t fd, short eventType, void* veh) { - char ch; - int ret; - tr_event_handle* eh = veh; + auto* eh = static_cast(veh); dbgmsg("readFromPipe: eventType is %hd", eventType); /* read the command type */ - ch = '\0'; + char ch = '\0'; + int ret; do { ret = piperead(fd, &ch, 1); @@ -233,8 +232,7 @@ static void logFunc(int severity, char const* message) static void libeventThreadFunc(void* veh) { - struct event_base* base; - tr_event_handle* eh = veh; + auto* eh = static_cast(veh); #ifndef _WIN32 /* Don't exit when writing on a broken socket */ @@ -242,7 +240,7 @@ static void libeventThreadFunc(void* veh) #endif /* create the libevent bases */ - base = event_base_new(); + struct event_base* base = event_base_new(); /* set the struct's fields */ eh->base = base; diff --git a/libtransmission/upnp.c b/libtransmission/upnp.cc similarity index 98% rename from libtransmission/upnp.c rename to libtransmission/upnp.cc index 58ef2bbea..65af4ae5d 100644 --- a/libtransmission/upnp.c +++ b/libtransmission/upnp.cc @@ -223,9 +223,9 @@ enum UPNP_IGD_INVALID = 3 }; -int tr_upnpPulse(tr_upnp* handle, tr_port port, bool isEnabled, bool doPortCheck) +tr_port_forwarding tr_upnpPulse(tr_upnp* handle, tr_port port, bool isEnabled, bool doPortCheck) { - int ret; + tr_port_forwarding ret; if (isEnabled && handle->state == TR_UPNP_DISCOVER) { diff --git a/libtransmission/upnp.h b/libtransmission/upnp.h index 7fefe6afc..ffb6404a2 100644 --- a/libtransmission/upnp.h +++ b/libtransmission/upnp.h @@ -23,6 +23,6 @@ tr_upnp* tr_upnpInit(void); void tr_upnpClose(tr_upnp*); -int tr_upnpPulse(tr_upnp*, tr_port port, bool isEnabled, bool doPortCheck); +tr_port_forwarding tr_upnpPulse(tr_upnp*, tr_port port, bool isEnabled, bool doPortCheck); /* @} */ diff --git a/libtransmission/utils.c b/libtransmission/utils.cc similarity index 95% rename from libtransmission/utils.c rename to libtransmission/utils.cc index 9ad21bbd0..d12d3834c 100644 --- a/libtransmission/utils.c +++ b/libtransmission/utils.cc @@ -276,7 +276,6 @@ void tr_timerAddMsec(struct event* timer, int msec) uint8_t* tr_loadFile(char const* path, size_t* size, tr_error** error) { - uint8_t* buf; tr_sys_path_info info; tr_sys_file_t fd; tr_error* my_error = NULL; @@ -313,7 +312,7 @@ uint8_t* tr_loadFile(char const* path, size_t* size, tr_error** error) return NULL; } - buf = tr_malloc(info.size + 1); + auto* buf = static_cast(tr_malloc(info.size + 1)); if (!tr_sys_file_read(fd, buf, info.size, NULL, &my_error)) { @@ -426,7 +425,7 @@ char* evbuffer_free_to_str(struct evbuffer* buf, size_t* result_len) char* tr_strdup(void const* in) { - return tr_strndup(in, in != NULL ? strlen(in) : 0); + return tr_strndup(in, in != NULL ? strlen(static_cast(in)) : 0); } char* tr_strndup(void const* in, size_t len) @@ -439,7 +438,7 @@ char* tr_strndup(void const* in, size_t len) } else if (in != NULL) { - out = tr_malloc(len + 1); + out = static_cast(tr_malloc(len + 1)); if (out != NULL) { @@ -455,7 +454,7 @@ char const* tr_memmem(char const* haystack, size_t haystacklen, char const* need { #ifdef HAVE_MEMMEM - return memmem(haystack, haystacklen, needle, needlelen); + return static_cast(memmem(haystack, haystacklen, needle, needlelen)); #else @@ -709,11 +708,10 @@ void tr_wait_msec(long int msec) int tr_snprintf(void* buf, size_t buflen, char const* fmt, ...) { - int len; va_list args; va_start(args, fmt); - len = evutil_vsnprintf(buf, buflen, fmt, args); + int len = evutil_vsnprintf(static_cast(buf), buflen, fmt, args); va_end(args); return len; } @@ -723,8 +721,11 @@ int tr_snprintf(void* buf, size_t buflen, char const* fmt, ...) * will be copied. Always NUL terminates (unless siz == 0). * Returns strlen (src); if retval >= siz, truncation occurred. */ -size_t tr_strlcpy(void* dst, void const* src, size_t siz) +size_t tr_strlcpy(void* vdst, void const* vsrc, size_t siz) { + auto* dst = static_cast(vdst); + auto const* const src = static_cast(vsrc); + TR_ASSERT(dst != NULL); TR_ASSERT(src != NULL); @@ -734,8 +735,8 @@ size_t tr_strlcpy(void* dst, void const* src, size_t siz) #else - char* d = dst; - char const* s = src; + auto* d = dst; + auto* s = src; size_t n = siz; /* Copy as many bytes as will fit */ @@ -796,8 +797,8 @@ void tr_binary_to_hex(void const* vinput, void* voutput, size_t byte_length) { static char const hex[] = "0123456789abcdef"; - uint8_t const* input = vinput; - char* output = voutput; + auto const* input = static_cast(vinput); + auto* output = static_cast(voutput); /* go from back to front to allow for in-place conversion */ input += byte_length; @@ -817,8 +818,8 @@ void tr_hex_to_binary(void const* vinput, void* voutput, size_t byte_length) { static char const hex[] = "0123456789abcdef"; - uint8_t const* input = (uint8_t const*)vinput; - uint8_t* output = voutput; + auto const* input = static_cast(vinput); + auto* output = static_cast(voutput); for (size_t i = 0; i < byte_length; ++i) { @@ -966,7 +967,7 @@ bool tr_urlParse(char const* url, size_t url_len, char** setme_scheme, char** se url_len -= scheme_len + 3; char const* authority = url; - char const* authority_end = memchr(authority, '/', url_len); + auto const* authority_end = static_cast(memchr(authority, '/', url_len)); if (authority_end == NULL) { @@ -983,7 +984,7 @@ bool tr_urlParse(char const* url, size_t url_len, char** setme_scheme, char** se url += authority_len; url_len -= authority_len; - char const* host_end = memchr(authority, ':', authority_len); + auto const* host_end = static_cast(memchr(authority, ':', authority_len)); size_t const host_len = host_end != NULL ? (size_t)(host_end - authority) : authority_len; @@ -1030,7 +1031,7 @@ bool tr_urlParse(char const* url, size_t url_len, char** setme_scheme, char** se void tr_removeElementFromArray(void* array, size_t index_to_remove, size_t sizeof_element, size_t nmemb) { - char* a = array; + auto* a = static_cast(array); memmove( a + sizeof_element * index_to_remove, @@ -1047,7 +1048,7 @@ int tr_lowerBound( bool* exact_match) { size_t first = 0; - char const* cbase = base; + auto const* cbase = static_cast(base); bool exact = false; while (nmemb != 0) @@ -1086,9 +1087,9 @@ int tr_lowerBound( #define SWAP(a, b, size) \ do \ { \ - register size_t __size = (size); \ - register char* __a = (a); \ - register char* __b = (b); \ + size_t __size = (size); \ + char* __a = (a); \ + char* __b = (b); \ if (__a != __b) \ { \ do \ @@ -1169,7 +1170,7 @@ static void quickfindFirstK(char* base, size_t left, size_t right, size_t size, #ifdef TR_ENABLE_ASSERTS -static void checkBestScoresComeFirst(char* base, size_t nmemb, size_t size, tr_voidptr_compare_func compar, size_t k) +static void checkBestScoresComeFirst(char const* base, size_t nmemb, size_t size, tr_voidptr_compare_func compar, size_t k) { size_t worstFirstPos = 0; @@ -1198,10 +1199,10 @@ void tr_quickfindFirstK(void* base, size_t nmemb, size_t size, tr_voidptr_compar { if (k < nmemb) { - quickfindFirstK(base, 0, nmemb - 1, size, compar, k); + quickfindFirstK(static_cast(base), 0, nmemb - 1, size, compar, k); #ifdef TR_ENABLE_ASSERTS - checkBestScoresComeFirst(base, nmemb, size, compar, k); + checkBestScoresComeFirst(static_cast(base), nmemb, size, compar, k); #endif } } @@ -1242,9 +1243,9 @@ static char* to_utf8(char const* in, size_t inlen) for (size_t i = 0; ret == NULL && i < TR_N_ELEMENTS(encodings); ++i) { #ifdef ICONV_SECOND_ARGUMENT_IS_CONST - char const* inbuf = in; + auto const* inbuf = in; #else - char* inbuf = (char*)in; + auto* inbuf = const_cast(in); #endif char* outbuf = out; size_t inbytesleft = inlen; @@ -1626,7 +1627,7 @@ int* tr_parseNumberRange(char const* str_in, size_t len, int* setmeCount) for (tr_list* l = ranges; l != NULL; l = l->next) { - struct number_range const* r = l->data; + auto const* r = static_cast(l->data); n += r->high + 1 - r->low; } @@ -1641,7 +1642,7 @@ int* tr_parseNumberRange(char const* str_in, size_t len, int* setmeCount) { for (tr_list* l = ranges; l != NULL; l = l->next) { - struct number_range const* r = l->data; + auto const* r = static_cast(l->data); for (int i = r->low; i <= r->high; ++i) { @@ -2008,7 +2009,7 @@ char* tr_formatter_mem_B(char* buf, size_t bytes_per_second, size_t buflen) void tr_formatter_get_units(void* vdict) { tr_variant* l; - tr_variant* dict = vdict; + auto* dict = static_cast(vdict); tr_variantDictReserve(dict, 6); @@ -2151,8 +2152,8 @@ void tr_net_init(void) static int compareSuffix(void const* va, void const* vb) { - char const* suffix = va; - struct mime_type_suffix const* entry = vb; + auto const* suffix = static_cast(va); + auto const* entry = static_cast(vb); return tr_strcmp0(suffix, entry->suffix); } @@ -2175,12 +2176,12 @@ char const* tr_get_mime_type_for_filename(char const* filename) *out = '\0'; - info = bsearch( + info = static_cast(bsearch( lowercase_suffix, mime_type_suffixes, TR_N_ELEMENTS(mime_type_suffixes), sizeof(*mime_type_suffixes), - compareSuffix); + compareSuffix)); } } diff --git a/libtransmission/variant-benc.c b/libtransmission/variant-benc.cc similarity index 77% rename from libtransmission/variant-benc.c rename to libtransmission/variant-benc.cc index 020ca384f..5fb668d8b 100644 --- a/libtransmission/variant-benc.c +++ b/libtransmission/variant-benc.cc @@ -41,10 +41,6 @@ int tr_bencParseInt(void const* vbuf, void const* vbufend, uint8_t const** setme { uint8_t const* const buf = (uint8_t const*)vbuf; uint8_t const* const bufend = (uint8_t const*)vbufend; - char* endptr; - void const* begin; - void const* end; - int64_t val; if (buf >= bufend) { @@ -56,8 +52,8 @@ int tr_bencParseInt(void const* vbuf, void const* vbufend, uint8_t const** setme return EILSEQ; } - begin = buf + 1; - end = memchr(begin, 'e', (bufend - buf) - 1); + void const* begin = buf + 1; + void const* end = memchr(begin, 'e', (bufend - buf) - 1); if (end == NULL) { @@ -65,7 +61,8 @@ int tr_bencParseInt(void const* vbuf, void const* vbufend, uint8_t const** setme } errno = 0; - val = evutil_strtoll(begin, &endptr, 10); + char* endptr; + int64_t val = evutil_strtoll(static_cast(begin), &endptr, 10); if (errno != 0 || endptr != end) /* incomplete parse */ { @@ -98,51 +95,32 @@ int tr_bencParseStr( uint8_t const* const buf = (uint8_t const*)vbuf; uint8_t const* const bufend = (uint8_t const*)vbufend; - void const* end; - size_t len; - char* ulend; - uint8_t const* strbegin; - uint8_t const* strend; - - if (buf >= bufend) + if ((buf < bufend) && isdigit(*buf)) { - goto ERR; + void const* end = memchr(buf, ':', bufend - buf); + + if (end != NULL) + { + errno = 0; + char* ulend; + size_t len = strtoul((char const*)buf, &ulend, 10); + + if (errno == 0 && ulend == end && len <= MAX_BENC_STR_LENGTH) + { + uint8_t const* strbegin = (uint8_t const*)end + 1; + uint8_t const* strend = strbegin + len; + + if (strbegin <= strend && strend <= bufend) + { + *setme_end = (uint8_t const*)end + 1 + len; + *setme_str = (uint8_t const*)end + 1; + *setme_strlen = len; + return 0; + } + } + } } - if (!isdigit(*buf)) - { - goto ERR; - } - - end = memchr(buf, ':', bufend - buf); - - if (end == NULL) - { - goto ERR; - } - - errno = 0; - len = strtoul((char const*)buf, &ulend, 10); - - if (errno != 0 || ulend != end || len > MAX_BENC_STR_LENGTH) - { - goto ERR; - } - - strbegin = (uint8_t const*)end + 1; - strend = strbegin + len; - - if (strend < strbegin || strend > bufend) - { - goto ERR; - } - - *setme_end = (uint8_t const*)end + 1 + len; - *setme_str = (uint8_t const*)end + 1; - *setme_strlen = len; - return 0; - -ERR: *setme_end = NULL; *setme_str = NULL; *setme_strlen = 0; @@ -159,7 +137,7 @@ static tr_variant* get_node(tr_ptrArray* stack, tr_quark* key, tr_variant* top, } else { - tr_variant* parent = tr_ptrArrayBack(stack); + auto* parent = static_cast(tr_ptrArrayBack(stack)); if (tr_variantIsList(parent)) { @@ -187,9 +165,9 @@ static tr_variant* get_node(tr_ptrArray* stack, tr_quark* key, tr_variant* top, int tr_variantParseBenc(void const* buf_in, void const* bufend_in, tr_variant* top, char const** setme_end) { int err = 0; - uint8_t const* buf = buf_in; - uint8_t const* bufend = bufend_in; - tr_ptrArray stack = TR_PTR_ARRAY_INIT; + auto const* buf = static_cast(buf_in); + auto const* const bufend = static_cast(bufend_in); + auto stack = tr_ptrArray{}; tr_quark key = 0; if ((buf_in == NULL) || (bufend_in == NULL) || (top == NULL)) @@ -286,7 +264,7 @@ int tr_variantParseBenc(void const* buf_in, void const* bufend_in, tr_variant* t buf = end; - if (key == 0 && !tr_ptrArrayEmpty(&stack) && tr_variantIsDict(tr_ptrArrayBack(&stack))) + if (key == 0 && !tr_ptrArrayEmpty(&stack) && tr_variantIsDict(static_cast(tr_ptrArrayBack(&stack)))) { key = tr_quark_new(str, str_len); } @@ -332,13 +310,15 @@ int tr_variantParseBenc(void const* buf_in, void const* bufend_in, tr_variant* t ***** ****/ -static void saveIntFunc(tr_variant const* val, void* evbuf) +static void saveIntFunc(tr_variant const* val, void* vevbuf) { + auto* evbuf = static_cast(vevbuf); evbuffer_add_printf(evbuf, "i%" PRId64 "e", val->val.i); } -static void saveBoolFunc(tr_variant const* val, void* evbuf) +static void saveBoolFunc(tr_variant const* val, void* vevbuf) { + auto* evbuf = static_cast(vevbuf); if (val->val.b) { evbuffer_add(evbuf, "i1e", 3); @@ -349,17 +329,17 @@ static void saveBoolFunc(tr_variant const* val, void* evbuf) } } -static void saveRealFunc(tr_variant const* val, void* evbuf) +static void saveRealFunc(tr_variant const* val, void* vevbuf) { - int len; char buf[128]; + int const len = tr_snprintf(buf, sizeof(buf), "%f", val->val.d); - len = tr_snprintf(buf, sizeof(buf), "%f", val->val.d); + auto* evbuf = static_cast(vevbuf); evbuffer_add_printf(evbuf, "%d:", len); evbuffer_add(evbuf, buf, len); } -static void saveStringFunc(tr_variant const* v, void* evbuf) +static void saveStringFunc(tr_variant const* v, void* vevbuf) { size_t len; char const* str; @@ -369,28 +349,32 @@ static void saveStringFunc(tr_variant const* v, void* evbuf) str = NULL; } + auto* evbuf = static_cast(vevbuf); evbuffer_add_printf(evbuf, "%zu:", len); evbuffer_add(evbuf, str, len); } -static void saveDictBeginFunc(tr_variant const* val, void* evbuf) +static void saveDictBeginFunc(tr_variant const* val, void* vevbuf) { TR_UNUSED(val); + auto* evbuf = static_cast(vevbuf); evbuffer_add(evbuf, "d", 1); } -static void saveListBeginFunc(tr_variant const* val, void* evbuf) +static void saveListBeginFunc(tr_variant const* val, void* vevbuf) { TR_UNUSED(val); + auto* evbuf = static_cast(vevbuf); evbuffer_add(evbuf, "l", 1); } -static void saveContainerEndFunc(tr_variant const* val, void* evbuf) +static void saveContainerEndFunc(tr_variant const* val, void* vevbuf) { TR_UNUSED(val); + auto* evbuf = static_cast(vevbuf); evbuffer_add(evbuf, "e", 1); } diff --git a/libtransmission/variant-json.c b/libtransmission/variant-json.cc similarity index 93% rename from libtransmission/variant-json.c rename to libtransmission/variant-json.cc index b6e2aac2b..c3c07e468 100644 --- a/libtransmission/variant-json.c +++ b/libtransmission/variant-json.cc @@ -52,12 +52,11 @@ struct json_wrapper_data static tr_variant* get_node(struct jsonsl_st* jsn) { - tr_variant* parent; + auto* data = static_cast(jsn->data); + + auto* parent = static_cast(tr_ptrArrayEmpty(&data->stack) ? NULL : tr_ptrArrayBack(&data->stack)); + tr_variant* node = NULL; - struct json_wrapper_data* data = jsn->data; - - parent = tr_ptrArrayEmpty(&data->stack) ? NULL : tr_ptrArrayBack(&data->stack); - if (parent == NULL) { node = data->top; @@ -81,7 +80,7 @@ static void error_handler(jsonsl_t jsn, jsonsl_error_t error, struct jsonsl_stat { TR_UNUSED(state); - struct json_wrapper_data* data = jsn->data; + auto* data = static_cast(jsn->data); if (data->source != NULL) { @@ -112,7 +111,7 @@ static void action_callback_PUSH(jsonsl_t jsn, jsonsl_action_t action, struct js TR_UNUSED(buf); tr_variant* node; - struct json_wrapper_data* data = jsn->data; + auto* data = static_cast(jsn->data); if ((state->type == JSONSL_T_LIST) || (state->type == JSONSL_T_OBJECT)) { @@ -248,7 +247,7 @@ static char* extract_escaped_string(char const* in, size_t in_len, size_t* len, UTF8* str8_walk = str8_buf; UTF8* str8_end = str8_buf + 8; - if (ConvertUTF32toUTF8(&str32_walk, str32_end, &str8_walk, str8_end, 0) == 0) + if (ConvertUTF32toUTF8(&str32_walk, str32_end, &str8_walk, str8_end, {}) == 0) { evbuffer_add(buf, str8_buf, str8_walk - str8_buf); unescaped = true; @@ -310,7 +309,7 @@ static void action_callback_POP(jsonsl_t jsn, jsonsl_action_t action, struct jso TR_UNUSED(action); TR_UNUSED(buf); - struct json_wrapper_data* data = jsn->data; + auto* data = static_cast(jsn->data); if (state->type == JSONSL_T_STRING) { @@ -327,7 +326,7 @@ static void action_callback_POP(jsonsl_t jsn, jsonsl_action_t action, struct jso else if (state->type == JSONSL_T_LIST || state->type == JSONSL_T_OBJECT) { int const depth = tr_ptrArraySize(&data->stack); - tr_variant const* v = tr_ptrArrayPop(&data->stack); + auto* v = static_cast(tr_ptrArrayPop(&data->stack)); if (depth < MAX_DEPTH) { data->preallocGuess[depth] = v->val.l.count; @@ -378,7 +377,7 @@ int tr_jsonParse(char const* source, void const* vbuf, size_t len, tr_variant* s data.has_content = false; data.key = NULL; data.top = setme_variant; - data.stack = TR_PTR_ARRAY_INIT; + data.stack = {}; data.source = source; data.keybuf = evbuffer_new(); data.strbuf = evbuffer_new(); @@ -388,7 +387,7 @@ int tr_jsonParse(char const* source, void const* vbuf, size_t len, tr_variant* s } /* parse it */ - jsonsl_feed(jsn, vbuf, len); + jsonsl_feed(jsn, static_cast(vbuf), len); /* EINVAL if there was no content */ if (data.error == 0 && !data.has_content) @@ -449,7 +448,7 @@ static void jsonChildFunc(struct jsonWalk* data) { if (data->parents != NULL && data->parents->data != NULL) { - struct ParentState* pstate = data->parents->data; + auto* pstate = static_cast(data->parents->data); switch (pstate->variantType) { @@ -519,14 +518,14 @@ static void jsonPopParent(struct jsonWalk* data) static void jsonIntFunc(tr_variant const* val, void* vdata) { - struct jsonWalk* data = vdata; + auto* data = static_cast(vdata); evbuffer_add_printf(data->out, "%" PRId64, val->val.i); jsonChildFunc(data); } static void jsonBoolFunc(tr_variant const* val, void* vdata) { - struct jsonWalk* data = vdata; + auto* data = static_cast(vdata); if (val->val.b) { @@ -542,7 +541,7 @@ static void jsonBoolFunc(tr_variant const* val, void* vdata) static void jsonRealFunc(tr_variant const* val, void* vdata) { - struct jsonWalk* data = vdata; + auto* data = static_cast(vdata); if (fabs(val->val.d - (int)val->val.d) < 0.00001) { @@ -558,23 +557,20 @@ static void jsonRealFunc(tr_variant const* val, void* vdata) static void jsonStringFunc(tr_variant const* val, void* vdata) { - char* out; - char* outwalk; struct evbuffer_iovec vec[1]; - struct jsonWalk* const data = vdata; - unsigned char const* it; + auto* data = static_cast(vdata); char const* str = NULL; size_t len = 0; (void)tr_variantGetStr(val, &str, &len); - it = (unsigned char const*)str; + auto const* it = reinterpret_cast(str); unsigned char const* const end = it + len; evbuffer_reserve_space(data->out, len * 4, vec, 1); - out = vec[0].iov_base; + auto* out = static_cast(vec[0].iov_base); char const* const outend = out + vec[0].iov_len; - outwalk = out; + char* outwalk = out; *outwalk++ = '"'; for (; it != end; ++it) @@ -626,7 +622,7 @@ static void jsonStringFunc(tr_variant const* val, void* vdata) UTF8 const* tmp = it; UTF32 buf[1] = { 0 }; UTF32* u32 = buf; - ConversionResult result = ConvertUTF8toUTF32(&tmp, end, &u32, buf + 1, 0); + ConversionResult result = ConvertUTF8toUTF32(&tmp, end, &u32, buf + 1, {}); if ((result == conversionOK || result == targetExhausted) && tmp != it) { @@ -648,7 +644,7 @@ static void jsonStringFunc(tr_variant const* val, void* vdata) static void jsonDictBeginFunc(tr_variant const* val, void* vdata) { - struct jsonWalk* data = vdata; + auto* data = static_cast(vdata); jsonPushParent(data, val); evbuffer_add(data->out, "{", 1); @@ -662,7 +658,7 @@ static void jsonDictBeginFunc(tr_variant const* val, void* vdata) static void jsonListBeginFunc(tr_variant const* val, void* vdata) { size_t const nChildren = tr_variantListSize(val); - struct jsonWalk* data = vdata; + auto* data = static_cast(vdata); jsonPushParent(data, val); evbuffer_add(data->out, "[", 1); @@ -675,7 +671,7 @@ static void jsonListBeginFunc(tr_variant const* val, void* vdata) static void jsonContainerEndFunc(tr_variant const* val, void* vdata) { - struct jsonWalk* data = vdata; + auto* data = static_cast(vdata); bool emptyContainer = false; jsonPopParent(data); diff --git a/libtransmission/variant.c b/libtransmission/variant.cc similarity index 98% rename from libtransmission/variant.c rename to libtransmission/variant.cc index 1f82f4cf1..04dd3ef8e 100644 --- a/libtransmission/variant.c +++ b/libtransmission/variant.cc @@ -129,11 +129,11 @@ void tr_variantInit(tr_variant* v, char type) **** ***/ -static struct tr_variant_string const STRING_INIT = { - .type = TR_STRING_TYPE_QUARK, - .quark = TR_KEY_NONE, - .len = 0, - .str.str = "", +static auto constexpr STRING_INIT = tr_variant_string{ + TR_STRING_TYPE_QUARK, + TR_KEY_NONE, + 0, + {}, }; static void tr_variant_string_clear(struct tr_variant_string* str) @@ -455,7 +455,7 @@ bool tr_variantDictFindRaw(tr_variant* dict, tr_quark const key, uint8_t const** void tr_variantInitRaw(tr_variant* v, void const* src, size_t byteCount) { tr_variantInit(v, TR_VARIANT_TYPE_STR); - tr_variant_string_set_string(&v->val.s, src, byteCount); + tr_variant_string_set_string(&v->val.s, static_cast(src), byteCount); } void tr_variantInitQuark(tr_variant* v, tr_quark const q) @@ -467,7 +467,7 @@ void tr_variantInitQuark(tr_variant* v, tr_quark const q) void tr_variantInitStr(tr_variant* v, void const* str, size_t len) { tr_variantInit(v, TR_VARIANT_TYPE_STR); - tr_variant_string_set_string(&v->val.s, str, len); + tr_variant_string_set_string(&v->val.s, static_cast(str), len); } void tr_variantInitBool(tr_variant* v, bool value) @@ -745,8 +745,8 @@ struct KeyIndex static int compareKeyIndex(void const* va, void const* vb) { - struct KeyIndex const* a = va; - struct KeyIndex const* b = vb; + auto const* const a = static_cast(va); + auto const* const b = static_cast(vb); return strcmp(a->keystr, b->keystr); } diff --git a/libtransmission/verify.c b/libtransmission/verify.cc similarity index 94% rename from libtransmission/verify.c rename to libtransmission/verify.cc index 2a1d94215..a345a79bb 100644 --- a/libtransmission/verify.c +++ b/libtransmission/verify.cc @@ -43,7 +43,7 @@ static bool verifyTorrent(tr_torrent* tor, bool* stopFlag) tr_piece_index_t pieceIndex = 0; time_t const begin = tr_time(); size_t const buflen = 1024 * 128; // 128 KiB buffer - uint8_t* const buffer = tr_malloc(buflen); + auto* const buffer = static_cast(tr_malloc(buflen)); tr_sha1_ctx_t sha = tr_sha1_init(); @@ -203,11 +203,10 @@ static void verifyThreadFunc(void* user_data) { bool changed = false; tr_torrent* tor; - struct verify_node* node; tr_lockLock(getVerifyLock()); stopCurrent = false; - node = verifyList != NULL ? verifyList->data : NULL; + auto* node = static_cast(verifyList != NULL ? verifyList->data : NULL); if (node == NULL) { @@ -244,8 +243,8 @@ static void verifyThreadFunc(void* user_data) static int compareVerifyByPriorityAndSize(void const* va, void const* vb) { - struct verify_node const* a = va; - struct verify_node const* b = vb; + auto const* a = static_cast(va); + auto const* b = static_cast(vb); /* higher priority comes before lower priority */ tr_priority_t const pa = tr_torrentGetPriority(a->torrent); @@ -295,8 +294,8 @@ void tr_verifyAdd(tr_torrent* tor, tr_verify_done_func callback_func, void* call static int compareVerifyByTorrent(void const* va, void const* vb) { - struct verify_node const* a = va; - tr_torrent const* b = vb; + auto const* const a = static_cast(va); + auto const* const b = static_cast(vb); return a->torrent - b; } @@ -320,7 +319,7 @@ void tr_verifyRemove(tr_torrent* tor) } else { - struct verify_node* node = tr_list_remove(&verifyList, tor, compareVerifyByTorrent); + auto* node = static_cast(tr_list_remove(&verifyList, tor, compareVerifyByTorrent)); tr_torrentSetVerifyState(tor, TR_VERIFY_NONE); diff --git a/libtransmission/watchdir-generic.c b/libtransmission/watchdir-generic.cc similarity index 93% rename from libtransmission/watchdir-generic.c rename to libtransmission/watchdir-generic.cc index c6e5e350c..fa5d0d08a 100644 --- a/libtransmission/watchdir-generic.c +++ b/libtransmission/watchdir-generic.cc @@ -42,8 +42,8 @@ typedef struct tr_watchdir_generic #define BACKEND_UPCAST(b) ((tr_watchdir_generic*)(b)) -/* Non-static and mutable for unit tests */ -struct timeval tr_watchdir_generic_interval = { .tv_sec = 10, .tv_usec = 0 }; +/* Non-static and mutable for unit tests. default to 10 sec. */ +auto tr_watchdir_generic_interval = timeval{ 10, 0 }; /*** **** @@ -54,7 +54,7 @@ static void tr_watchdir_generic_on_event(evutil_socket_t fd, short type, void* c TR_UNUSED(fd); TR_UNUSED(type); - tr_watchdir_t const handle = context; + auto const handle = static_cast(context); tr_watchdir_generic* const backend = BACKEND_UPCAST(tr_watchdir_get_backend(handle)); tr_watchdir_scan(handle, &backend->dir_entries); diff --git a/libtransmission/watchdir-inotify.c b/libtransmission/watchdir-inotify.cc similarity index 97% rename from libtransmission/watchdir-inotify.c rename to libtransmission/watchdir-inotify.cc index e89221029..e977992cc 100644 --- a/libtransmission/watchdir-inotify.c +++ b/libtransmission/watchdir-inotify.cc @@ -60,7 +60,7 @@ static void tr_watchdir_inotify_on_first_scan(evutil_socket_t fd, short type, vo TR_UNUSED(fd); TR_UNUSED(type); - tr_watchdir_t const handle = context; + auto const handle = static_cast(context); tr_watchdir_scan(handle, NULL); } @@ -69,7 +69,7 @@ static void tr_watchdir_inotify_on_event(struct bufferevent* event, void* contex { TR_ASSERT(context != NULL); - tr_watchdir_t const handle = context; + auto const handle = static_cast(context); #ifdef TR_ENABLE_ASSERTS tr_watchdir_inotify const* const backend = BACKEND_UPCAST(tr_watchdir_get_backend(handle)); #endif diff --git a/libtransmission/watchdir-kqueue.c b/libtransmission/watchdir-kqueue.cc similarity index 97% rename from libtransmission/watchdir-kqueue.c rename to libtransmission/watchdir-kqueue.cc index cdad8b6c2..30b2d26b4 100644 --- a/libtransmission/watchdir-kqueue.c +++ b/libtransmission/watchdir-kqueue.cc @@ -66,10 +66,10 @@ static void tr_watchdir_kqueue_on_event(evutil_socket_t fd, short type, void* co TR_UNUSED(fd); TR_UNUSED(type); - tr_watchdir_t const handle = context; + auto const handle = static_cast(context); tr_watchdir_kqueue* const backend = BACKEND_UPCAST(tr_watchdir_get_backend(handle)); struct kevent ke; - struct timespec const ts = { .tv_sec = 0, .tv_nsec = 0 }; + auto ts = timespec{}; if (kevent(backend->kq, NULL, 0, &ke, 1, &ts) == -1) { diff --git a/libtransmission/watchdir-win32.c b/libtransmission/watchdir-win32.cc similarity index 96% rename from libtransmission/watchdir-win32.c rename to libtransmission/watchdir-win32.cc index 73d4fc290..aac615cf3 100644 --- a/libtransmission/watchdir-win32.c +++ b/libtransmission/watchdir-win32.cc @@ -103,7 +103,7 @@ static BOOL tr_get_overlapped_result_ex( static unsigned int __stdcall tr_watchdir_win32_thread(void* context) { - tr_watchdir_t const handle = context; + auto const handle = static_cast(context); tr_watchdir_win32* const backend = BACKEND_UPCAST(tr_watchdir_get_backend(handle)); DWORD bytes_transferred; @@ -148,17 +148,17 @@ static void tr_watchdir_win32_on_first_scan(evutil_socket_t fd, short type, void TR_UNUSED(fd); TR_UNUSED(type); - tr_watchdir_t const handle = context; + auto const handle = static_cast(context); tr_watchdir_scan(handle, NULL); } static void tr_watchdir_win32_on_event(struct bufferevent* event, void* context) { - tr_watchdir_t const handle = context; + auto const handle = static_cast(context); size_t nread; size_t name_size = MAX_PATH * sizeof(WCHAR); - char* buffer = tr_malloc(sizeof(FILE_NOTIFY_INFORMATION) + name_size); + auto* buffer = static_cast(tr_malloc(sizeof(FILE_NOTIFY_INFORMATION) + name_size)); PFILE_NOTIFY_INFORMATION ev = (PFILE_NOTIFY_INFORMATION)buffer; size_t const header_size = offsetof(FILE_NOTIFY_INFORMATION, FileName); @@ -187,7 +187,7 @@ static void tr_watchdir_win32_on_event(struct bufferevent* event, void* context) if (nleft > name_size) { name_size = nleft; - buffer = tr_realloc(buffer, sizeof(FILE_NOTIFY_INFORMATION) + name_size); + buffer = static_cast(tr_realloc(buffer, sizeof(FILE_NOTIFY_INFORMATION) + name_size)); ev = (PFILE_NOTIFY_INFORMATION)buffer; } diff --git a/libtransmission/watchdir.c b/libtransmission/watchdir.cc similarity index 93% rename from libtransmission/watchdir.c rename to libtransmission/watchdir.cc index ff2599801..5163998ac 100644 --- a/libtransmission/watchdir.c +++ b/libtransmission/watchdir.cc @@ -55,7 +55,7 @@ struct tr_watchdir static bool is_regular_file(char const* dir, char const* name) { char* const path = tr_buildPath(dir, name, NULL); - tr_sys_path_info path_info = { 0 }; + auto path_info = tr_sys_path_info{}; tr_error* error = NULL; bool const ret = tr_sys_path_get_info(path, 0, &path_info, &error) && (path_info.type == TR_SYS_PATH_IS_FILE); @@ -117,15 +117,15 @@ typedef struct tr_watchdir_retry { tr_watchdir_t handle; char* name; - unsigned int counter; + size_t counter; struct event* timer; struct timeval interval; } tr_watchdir_retry; /* Non-static and mutable for unit tests */ -unsigned int tr_watchdir_retry_limit = 3; -struct timeval tr_watchdir_retry_start_interval = { .tv_sec = 1, .tv_usec = 0 }; -struct timeval tr_watchdir_retry_max_interval = { .tv_sec = 10, .tv_usec = 0 }; +auto tr_watchdir_retry_limit = size_t{ 3 }; +auto tr_watchdir_retry_start_interval = timeval{ 1, 0 }; +auto tr_watchdir_retry_max_interval = timeval{ 10, 0 }; #define tr_watchdir_retries_init(r) (void)0 #define tr_watchdir_retries_destroy(r) tr_ptrArrayDestruct((r), (PtrArrayForeachFunc)&tr_watchdir_retry_free) @@ -147,7 +147,7 @@ static void tr_watchdir_on_retry_timer(evutil_socket_t fd, short type, void* con TR_ASSERT(context != NULL); - tr_watchdir_retry* const retry = context; + auto* const retry = static_cast(context); tr_watchdir_t const handle = retry->handle; if (tr_watchdir_process_impl(handle, retry->name) == TR_WATCHDIR_RETRY) @@ -313,10 +313,9 @@ void tr_watchdir_process(tr_watchdir_t handle, char const* name) { TR_ASSERT(handle != NULL); - tr_watchdir_retry const search_key = { .name = (char*)name }; - tr_watchdir_retry* existing_retry; - - if ((existing_retry = tr_watchdir_retries_find(&handle->active_retries, &search_key)) != NULL) + auto const search_key = tr_watchdir_retry{ {}, const_cast(name), {}, {}, {} }; + auto* existing_retry = static_cast(tr_watchdir_retries_find(&handle->active_retries, &search_key)); + if (existing_retry != nullptr) { tr_watchdir_retry_restart(existing_retry); return; @@ -333,7 +332,7 @@ void tr_watchdir_scan(tr_watchdir_t handle, tr_ptrArray* dir_entries) { tr_sys_dir_t dir; char const* name; - tr_ptrArray new_dir_entries = TR_PTR_ARRAY_INIT_STATIC; + auto new_dir_entries = tr_ptrArray{}; PtrArrayCompareFunc const name_compare_func = (PtrArrayCompareFunc)&strcmp; tr_error* error = NULL; diff --git a/libtransmission/web.c b/libtransmission/web.cc similarity index 97% rename from libtransmission/web.c rename to libtransmission/web.cc index 4ef55ef38..3695328c3 100644 --- a/libtransmission/web.c +++ b/libtransmission/web.cc @@ -108,7 +108,7 @@ struct tr_web static size_t writeFunc(void* ptr, size_t size, size_t nmemb, void* vtask) { size_t const byteCount = size * nmemb; - struct tr_web_task* task = vtask; + auto* task = static_cast(vtask); /* webseed downloads should be speed limited */ if (task->torrentId != -1) @@ -133,7 +133,7 @@ static int sockoptfunction(void* vtask, curl_socket_t fd, curlsocktype purpose) { TR_UNUSED(purpose); - struct tr_web_task const* const task = vtask; + auto* task = static_cast(vtask); bool const isScrape = strstr(task->url, "scrape") != NULL; bool const isAnnounce = strstr(task->url, "announce") != NULL; @@ -144,8 +144,8 @@ static int sockoptfunction(void* vtask, curl_socket_t fd, curlsocktype purpose) int const rcvbuf = isScrape ? 4096 : 3072; /* ignore the sockopt() return values -- these are suggestions rather than hard requirements & it's OK for them to fail */ - (void)setsockopt(fd, SOL_SOCKET, SO_SNDBUF, (void const*)&sndbuf, sizeof(sndbuf)); - (void)setsockopt(fd, SOL_SOCKET, SO_RCVBUF, (void const*)&rcvbuf, sizeof(rcvbuf)); + (void)setsockopt(fd, SOL_SOCKET, SO_SNDBUF, reinterpret_cast(&sndbuf), sizeof(sndbuf)); + (void)setsockopt(fd, SOL_SOCKET, SO_RCVBUF, reinterpret_cast(&rcvbuf), sizeof(rcvbuf)); } /* return nonzero if this function encountered an error */ @@ -319,7 +319,7 @@ static CURL* createEasy(tr_session* s, struct tr_web* web, struct tr_web_task* t static void task_finish_func(void* vtask) { - struct tr_web_task* task = vtask; + auto* task = static_cast(vtask); dbgmsg("finished web task %p; got %ld", (void*)task, task->code); if (task->done_func != NULL) @@ -419,8 +419,8 @@ static void tr_webThreadFunc(void* vsession) CURLM* multi; struct tr_web* web; int taskCount = 0; - tr_session* session = vsession; uint32_t repeats = 0; + auto* session = static_cast(vsession); /* try to enable ssl for https support; but if that fails, * try a plain vanilla init */ diff --git a/libtransmission/webseed.c b/libtransmission/webseed.cc similarity index 96% rename from libtransmission/webseed.c rename to libtransmission/webseed.cc index 8b14f755a..db84bdc39 100644 --- a/libtransmission/webseed.c +++ b/libtransmission/webseed.cc @@ -84,7 +84,7 @@ static void publish(tr_webseed* w, tr_peer_event* e) static void fire_client_got_rejs(tr_torrent* tor, tr_webseed* w, tr_block_index_t block, tr_block_index_t count) { - tr_peer_event e = TR_PEER_EVENT_INIT; + auto e = tr_peer_event{}; e.eventType = TR_PEER_CLIENT_GOT_REJ; tr_torrentGetBlockLocation(tor, block, &e.pieceIndex, &e.offset, &e.length); @@ -102,7 +102,7 @@ static void fire_client_got_rejs(tr_torrent* tor, tr_webseed* w, tr_block_index_ static void fire_client_got_blocks(tr_torrent* tor, tr_webseed* w, tr_block_index_t block, tr_block_index_t count) { - tr_peer_event e = TR_PEER_EVENT_INIT; + auto e = tr_peer_event{}; e.eventType = TR_PEER_CLIENT_GOT_BLOCK; tr_torrentGetBlockLocation(tor, block, &e.pieceIndex, &e.offset, &e.length); @@ -120,7 +120,7 @@ static void fire_client_got_blocks(tr_torrent* tor, tr_webseed* w, tr_block_inde static void fire_client_got_piece_data(tr_webseed* w, uint32_t length) { - tr_peer_event e = TR_PEER_EVENT_INIT; + auto e = tr_peer_event{}; e.eventType = TR_PEER_CLIENT_GOT_PIECE_DATA; e.length = length; publish(w, &e); @@ -144,7 +144,7 @@ struct write_block_data static void write_block_func(void* vdata) { - struct write_block_data* data = vdata; + auto* data = static_cast(vdata); struct tr_webseed* w = data->webseed; struct evbuffer* buf = data->content; struct tr_torrent* tor; @@ -190,7 +190,7 @@ struct connection_succeeded_data static void connection_succeeded(void* vdata) { - struct connection_succeeded_data* data = vdata; + auto* data = static_cast(vdata); struct tr_webseed* w = data->webseed; if (++w->active_transfers >= w->retry_challenge && w->retry_challenge != 0) @@ -226,7 +226,7 @@ static void connection_succeeded(void* vdata) static void on_content_changed(struct evbuffer* buf, struct evbuffer_cb_info const* info, void* vtask) { size_t const n_added = info->n_added; - struct tr_webseed_task* task = vtask; + auto* task = static_cast(vtask); tr_session* session = task->session; tr_sessionLock(session); @@ -370,9 +370,7 @@ static void web_response_func( TR_UNUSED(response); TR_UNUSED(response_byte_count); - tr_webseed* w; - tr_torrent* tor; - struct tr_webseed_task* t = vtask; + auto* t = static_cast(vtask); bool const success = response_code == 206; if (t->dead) @@ -382,8 +380,8 @@ static void web_response_func( return; } - w = t->webseed; - tor = tr_torrentFindFromId(session, w->torrent_id); + tr_webseed* w = t->webseed; + tr_torrent* tor = tr_torrentFindFromId(session, w->torrent_id); if (tor != NULL) { @@ -512,7 +510,7 @@ static void webseed_timer_func(evutil_socket_t fd, short what, void* vw) TR_UNUSED(fd); TR_UNUSED(what); - tr_webseed* w = vw; + auto* w = static_cast(vw); if (w->retry_tickcount != 0) { @@ -555,7 +553,7 @@ static void webseed_destruct(tr_peer* peer) /* flag all the pending tasks as dead */ for (tr_list* l = w->tasks; l != NULL; l = l->next) { - struct tr_webseed_task* task = l->data; + auto* task = static_cast(l->data); task->dead = true; } @@ -585,8 +583,8 @@ static void webseed_destruct(tr_peer* peer) } static struct tr_peer_virtual_funcs const my_funcs = { - .destruct = webseed_destruct, - .is_transferring_pieces = webseed_is_transferring_pieces, + webseed_destruct, + webseed_is_transferring_pieces, }; /*** diff --git a/tests/libtransmission/watchdir-test.cc b/tests/libtransmission/watchdir-test.cc index ba5c83a5a..f294099a3 100644 --- a/tests/libtransmission/watchdir-test.cc +++ b/tests/libtransmission/watchdir-test.cc @@ -23,13 +23,10 @@ **** ***/ -extern "C" -{ - extern struct timeval tr_watchdir_generic_interval; - extern unsigned int tr_watchdir_retry_limit; - extern struct timeval tr_watchdir_retry_start_interval; - extern struct timeval tr_watchdir_retry_max_interval; -} +extern struct timeval tr_watchdir_generic_interval; +extern size_t tr_watchdir_retry_limit; +extern struct timeval tr_watchdir_retry_start_interval; +extern struct timeval tr_watchdir_retry_max_interval; namespace {