ALT Linux Bugzilla
– Attachment 3322 Details for
Bug 18861
новая версия ctorrent
New bug
|
Search
|
[?]
|
Help
Register
|
Log In
[x]
|
Forgot Password
Login:
[x]
|
EN
|
RU
[patch]
Multitracker patch from previos version
ctorrent-dnh3.3.2-multitracker.patch (text/plain), 2.54 KB, created by
Andrew Clark
on 2009-02-17 22:31:19 MSK
(
hide
)
Description:
Multitracker patch from previos version
Filename:
MIME Type:
Creator:
Andrew Clark
Created:
2009-02-17 22:31:19 MSK
Size:
2.54 KB
patch
obsolete
>--- ctorrent-dnh3.3.2/btcontent.cpp 2008-06-15 04:00:19 +0400 >+++ ctorrent-build/btcontent.cpp 2009-02-03 22:29:34 +0300 >@@ -103,6 +103,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); >@@ -123,9 +126,57 @@ > // Entries in dictionary must be sorted by key! > > // 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; >+ } > // comment > if( arg_comment ){ > if( bencode_str("comment", fp) != 1 ) goto err; >@@ -172,6 +223,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 18861
:
3320
|
3321
| 3322 |
3323