ALT Linux Bugzilla
– Attachment 2361 Details for
Bug 13930
FR: create multitracker torrents
New bug
|
Search
|
[?]
|
Help
Register
|
Log In
[x]
|
Forgot Password
Login:
[x]
|
EN
|
RU
[patch]
Патч, позволяющий создавать мультитрекерные торренты
ctorrent-multitracker.patch (text/plain), 2.65 KB, created by
Egor Vyscrebentsov
on 2008-01-08 01:02:50 MSK
(
hide
)
Description:
Патч, позволяющий создавать мультитрекерные торренты
Filename:
MIME Type:
Creator:
Egor Vyscrebentsov
Created:
2008-01-08 01:02:50 MSK
Size:
2.65 KB
patch
obsolete
>diff -urN ctorrent-dnh3.2.orig/btcontent.cpp ctorrent-dnh3.2/btcontent.cpp >--- ctorrent-dnh3.2.orig/btcontent.cpp 2007-08-22 13:54:56 +0400 >+++ ctorrent-dnh3.2/btcontent.cpp 2008-01-08 00:56:59 +0300 >@@ -91,6 +91,9 @@ > int btContent::CreateMetainfoFile(const char *mifn) > { > FILE *fp; >+ char *m_ann1, *m_ann2, *m_ann3, *m_ann_tmp; >+ int m_announce_count, list_delimiter; >+ > fp = fopen(mifn, "r"); > if( fp ){ > CONSOLE.Warning(1, "error, file \"%s\" already exists.", mifn); >@@ -109,8 +112,57 @@ > if( bencode_begin_dict(fp) != 1 ) goto err; > > // announce >- if( bencode_str("announce", fp) != 1 ) goto err; >- if( bencode_str(m_announce, fp) != 1 ) goto err; >+ if ((strchr(m_announce, '|') == NULL) && (strchr(m_announce, ',') == NULL)) { >+ if (bencode_str("announce", fp) != 1) goto err; >+ if (bencode_str(m_announce, fp) != 1) goto err; >+ } else { >+ CONSOLE.Debug("announce_list detected:\n"); >+ m_ann1 = m_announce; >+ m_ann_tmp = (char *)malloc(strlen(m_announce)); >+ m_announce_count = 0; >+ m_ann2 = strchr(m_ann1, ','); >+ m_ann3 = strchr(m_ann1, '|'); >+ while (m_ann2 || m_ann3) { >+ if (m_ann2 && !m_ann3) { >+ strlcpy(m_ann_tmp, m_ann1, m_ann2 - m_ann1 + 1); >+ m_ann1 = m_ann2 + sizeof(','); >+ list_delimiter = 0; >+ } else { >+ if (!m_ann2 && m_ann3) { >+ strlcpy(m_ann_tmp, m_ann1, m_ann3 - m_ann1 + 1); >+ m_ann1 = m_ann3 + sizeof('|'); >+ list_delimiter = 1; >+ } else { >+ if (m_ann2 < m_ann3) { >+ strlcpy(m_ann_tmp, m_ann1, m_ann2 - m_ann1 + 1); >+ m_ann1 = m_ann2 + sizeof(','); >+ list_delimiter = 0; >+ } else { >+ strlcpy(m_ann_tmp, m_ann1, m_ann3 - m_ann1 + 1); >+ m_ann1 = m_ann3 + sizeof('|'); >+ list_delimiter = 1; >+ } >+ } >+ } >+ if (m_announce_count == 0) { >+ if (bencode_str("announce", fp) != 1) goto err; >+ if (bencode_str(m_ann_tmp, fp) != 1) goto err; >+ if (bencode_str("announce-list", fp) != 1) goto err; >+ if (fwrite("ll", strlen("ll"), 1, fp) != 1) goto err; >+ } >+ m_announce_count++; >+ CONSOLE.Debug(" URL: %s\n", m_ann_tmp); >+ if (bencode_str(m_ann_tmp, fp) != 1) goto err; >+ if (list_delimiter == 1) { >+ if (fwrite("el", strlen("el"), 1, fp) != 1) goto err; >+ } >+ m_ann2 = strchr(m_ann1, ','); >+ m_ann3 = strchr(m_ann1, '|'); >+ } >+ CONSOLE.Debug(" URL: %s\n", m_ann1); >+ if (bencode_str(m_ann1, fp) != 1) goto err; >+ if (fwrite("ee", strlen("ee"), 1, 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; >@@ -137,6 +189,9 @@ > return 0; > err: > if( fp ) fclose(fp); >+ if (m_ann_tmp) { >+ free(m_ann_tmp); >+ } > return -1; > } >
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