ALT Linux Bugzilla
– Attachment 2404 Details for
Bug 13930
FR: create multitracker torrents
New bug
|
Search
|
[?]
|
Help
Register
|
Log In
[x]
|
Forgot Password
Login:
[x]
|
EN
|
RU
[patch]
Comment patch
ctorrent-comment-2.patch (text/plain), 4.54 KB, created by
Egor Vyscrebentsov
on 2008-01-31 17:23:04 MSK
(
hide
)
Description:
Comment patch
Filename:
MIME Type:
Creator:
Egor Vyscrebentsov
Created:
2008-01-31 17:23:04 MSK
Size:
4.54 KB
patch
obsolete
>diff -ur ctorrent-dnh3.2/btconfig.cpp ctorrent-build/btconfig.cpp >--- ctorrent-dnh3.2/btconfig.cpp 2007-08-22 13:54:56 +0400 >+++ ctorrent-build/btconfig.cpp 2008-01-08 20:05:40 +0300 >@@ -38,6 +38,7 @@ > > size_t arg_piece_length = 262144; > char *arg_announce = (char*) 0; >+char *arg_comment = (char *) 0; > > char *arg_ctcs = (char*) 0; > char *arg_completion_exit = (char*) 0; >diff -ur ctorrent-dnh3.2/btconfig.h ctorrent-build/btconfig.h >--- ctorrent-dnh3.2/btconfig.h 2007-08-22 13:54:56 +0400 >+++ ctorrent-build/btconfig.h 2008-01-08 20:05:14 +0300 >@@ -52,6 +52,7 @@ > > extern size_t arg_piece_length; > extern char *arg_announce; >+extern char *arg_comment; > > extern char *arg_ctcs; > extern char *arg_completion_exit; >diff -ur ctorrent-dnh3.2/btcontent.cpp ctorrent-build/btcontent.cpp >--- ctorrent-dnh3.2/btcontent.cpp 2008-01-08 00:56:59 +0300 >+++ ctorrent-build/btcontent.cpp 2008-01-08 20:34:29 +0300 >@@ -73,6 +73,7 @@ > btContent::btContent() > { > m_announce = global_piece_buffer = (char*) 0; >+ m_comment = (char *) 0; > m_hash_table = (unsigned char *) 0; > pBF = (BitField*) 0; > pBMasterFilter = (BitField*) 0; >@@ -163,6 +164,12 @@ > if (bencode_str(m_ann1, fp) != 1) goto err; > if (fwrite("ee", strlen("ee"), 1, fp) != 1) goto err; > } >+ >+ if (m_comment) { >+ if (bencode_str("comments", fp) != 1) goto err; >+ if (bencode_str(m_comment, fp) != 1) goto err; >+ } >+ > // create date > if( bencode_str("creation date", fp) != 1 ) goto err; > if( bencode_int(m_create_date, fp) != 1 ) goto err; >@@ -195,7 +202,7 @@ > return -1; > } > >-int btContent::InitialFromFS(const char *pathname, char *ann_url, size_t piece_length) >+int btContent::InitialFromFS(const char *pathname, char *ann_url, char *comment, size_t piece_length) > { > size_t n, percent; > >@@ -211,6 +218,7 @@ > m_piece_length = 262144; > > m_announce = ann_url; >+ m_comment = comment; > m_create_date = time((time_t*) 0); > > if(m_btfiles.BuildFromFS(pathname) < 0) return -1; >@@ -248,6 +256,9 @@ > { > CONSOLE.Print("META INFO"); > CONSOLE.Print("Announce: %s", m_announce); >+ if (m_comment) { >+ CONSOLE.Print("Comments: %s", m_comment); >+ } > if( m_create_date ){ > char s[42]; > #ifdef HAVE_CTIME_R_3 >@@ -290,6 +301,16 @@ > memcpy(m_announce, s, r); > m_announce[r] = '\0'; > >+ // comments >+ if (meta_str("comments", &s, &r)) { >+ if (r > MAXPATHLEN) { >+ ERR_RETURN(); >+ } >+ m_comment = new char [r + 1]; >+ memcpy(m_comment, s, r); >+ m_comment[r] = '\0'; >+ } >+ > // infohash > if( !(r = meta_pos("info")) ) ERR_RETURN(); > if( !(q = decode_dict(b + r, flen - r, (char *) 0)) ) ERR_RETURN(); >diff -ur ctorrent-dnh3.2/btcontent.h ctorrent-build/btcontent.h >--- ctorrent-dnh3.2/btcontent.h 2007-08-22 13:54:56 +0400 >+++ ctorrent-build/btcontent.h 2008-01-08 20:06:59 +0300 >@@ -47,6 +47,7 @@ > { > //METAINFO³ÉÔ± > char *m_announce; >+ char *m_comment; > unsigned char *m_hash_table; > unsigned char m_shake_buffer[68]; > >@@ -105,7 +106,7 @@ > int FlushFailed() const { return m_flush_failed ? 1 : 0 ; } > > int CreateMetainfoFile(const char *mifn); >- int InitialFromFS(const char *pathname, char *ann_url, size_t piece_length); >+ int InitialFromFS(const char *pathname, char *ann_url, char *comment, size_t piece_length); > int InitialFromMI(const char *metainfo_fname,const char *saveas); > > int CheckNextPiece(); >diff -ur ctorrent-dnh3.2/ctorrent.cpp ctorrent-build/ctorrent.cpp >--- ctorrent-dnh3.2/ctorrent.cpp 2007-08-22 13:54:56 +0400 >+++ ctorrent-build/ctorrent.cpp 2008-01-08 20:16:36 +0300 >@@ -84,7 +84,7 @@ > CONSOLE.Warning(1, "please use -s to specify a metainfo file name!"); > exit(1); > } >- if( BTCONTENT.InitialFromFS(arg_metainfo_file, arg_announce, >+ if( BTCONTENT.InitialFromFS(arg_metainfo_file, arg_announce, arg_comment, > arg_piece_length) < 0 || > BTCONTENT.CreateMetainfoFile(arg_save_as) < 0 ){ > CONSOLE.Warning(1, "create metainfo failed."); >@@ -137,7 +137,7 @@ > int c, l; > char *s; > while( (c=getopt(argc,argv, >- "aA:b:cC:dD:e:E:fi:l:M:m:n:P:p:s:S:tTu:U:vxX:z:hH")) >+ "aA:b:cC:dD:e:E:fi:l:M:m:n:o:P:p:s:S:tTu:U:vxX:z:hH")) > != -1 ) > switch( c ){ > case 'a': >@@ -264,6 +264,15 @@ > strcpy(arg_announce, optarg); > break; > >+ case 'o': // Comment >+ if (arg_comment) return -1; // specified twice >+ arg_comment = new char[strlen(optarg) + 1]; >+#ifndef WINDOWS >+ if (!arg_comment) return -1; >+#endif >+ strcpy(arg_comment, optarg); >+ break; >+ > case 't': // make Torrent > arg_flg_make_torrent = 1; > break;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 13930
:
2361
|
2403
| 2404