On Sat, Dec 06, 2014 at 09:56:02PM -0600, Andrew Reis wrote:
> make[1]: Entering directory `/root/lftp-4.6.0/src'
[snip]
> In file included from Torrent.cc:34:
>
> Torrent.h: In member function `void TorrentPiece::set_downloader(unsigned
> int,
>
> const TorrentPeer*, const TorrentPeer*, unsigned int)':
>
> Torrent.h:116: variable-sized object of type `const TorrentPeer*[blk_count]'
>
> may not be initialized
This is apparently an error, I chalk the lack of 'error:' qualifier up
to this being a horribly ancient compiler.
It appears that the compiler does not implement C++03
value-initialization of newed arrays, which the lftp source code does
with the trailing empty parentheses on line 116. They should mean that
the elements of the array are value-initialized, which for pointer types
is initializing to a null pointer.
The solution is simple, explicitly clear the storage. As for whether
upstream wants to have such filthy hacks in their codebase, that's up to
them. The patch below should get your build to finish, it did on my
newly set up RH9 virtual machine.
[zao@localhost zao]$ diff -u {orig,reis}/lftp-4.6.0/src/Torrent.h
--- orig/lftp-4.6.0/src/Torrent.h 2014-09-26 10:07:36.000000000 +0200
+++ reis/lftp-4.6.0/src/Torrent.h 2014-12-30 04:16:37.000000000 +0100
@@ -113,7 +113,8 @@
if(!downloader) {
if(o || !n)
return;
- downloader=new const TorrentPeer*[blk_count]();
+ downloader=new const TorrentPeer*[blk_count];
+ memset(downloader.get_non_const(),0,blk_count*sizeof(const
TorrentPeer*));
}
const TorrentPeer*& d=downloader[block];
if(d==o) {
[zao@localhost zao]$
> _______________________________________________
> lftp-devel mailing list
> [email protected]
> http://univ.uniyar.ac.ru/mailman/listinfo/lftp-devel
--
Lars Viklund | [email protected]
_______________________________________________
lftp-devel mailing list
[email protected]
http://univ.uniyar.ac.ru/mailman/listinfo/lftp-devel