Ver código fonte

* AbstractCommand.cc: casted timeout value to long long int.
* ChunkedEncoding.cc: fixed memory leak.
* PeerInteractionCommand.cc: casted timeout value to long long
int.
* SleepCommand.cc: casted timeout value to long long int.
* Data.cc: fixed memory leak.
* Data.cc: fixed toLLInt().
* BitfieldMan.cc: fixed memory leak.
* TorrentMan.cc: initialized storeDir to ".".
* TorrentMan.cc: fixed memory leak.
* TorrentMan.cc: corrected file paths of splitted files.
* PeerAbstractCommand.cc: casted timeout to long long int.
* main.cc: added delete(req) and delete(te->diskWriter).
* RequestSlot.cc: casted timeout value to long long int.
* Request.cc: fixed memory leak.
* PendingMessage.cc: make HAVE messages sent only when peer does
not
have the piece.
* Peer.{h,cc}: added hasPiece(int index).

Tatsuhiro Tsujikawa 19 anos atrás
pai
commit
1fcd640d3b

+ 17 - 0
ChangeLog

@@ -12,6 +12,23 @@
 	to Constructor. Also, moved digest cleanup to Destructor.
 	to Constructor. Also, moved digest cleanup to Destructor.
 	* MetaFileUtil.cc: fixed memory leak
 	* MetaFileUtil.cc: fixed memory leak
 	* replaced std::vector with std::deque.
 	* replaced std::vector with std::deque.
+	* AbstractCommand.cc: casted timeout value to long long int.
+	* ChunkedEncoding.cc: fixed memory leak.
+	* PeerInteractionCommand.cc: casted timeout value to long long int.
+	* SleepCommand.cc: casted timeout value to long long int.
+	* Data.cc: fixed memory leak.
+	* Data.cc: fixed toLLInt().
+	* BitfieldMan.cc: fixed memory leak.
+	* TorrentMan.cc: initialized storeDir to ".".
+	* TorrentMan.cc: fixed memory leak.
+	* TorrentMan.cc: corrected file paths of splitted files.
+	* PeerAbstractCommand.cc: casted timeout to long long int.
+	* main.cc: added delete(req) and delete(te->diskWriter).
+	* RequestSlot.cc: casted timeout value to long long int.
+	* Request.cc: fixed memory leak.
+	* PendingMessage.cc: make HAVE messages sent only when peer does not
+	have the piece.
+	* Peer.{h,cc}: added hasPiece(int index).
 	
 	
 2006-03-22  Tatsuhiro Tsujikawa  <tujikawa at rednoah dot com>
 2006-03-22  Tatsuhiro Tsujikawa  <tujikawa at rednoah dot com>
 
 

+ 57 - 57
po/aria2c.pot

@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: http://aria2.sourceforge.net/\n"
 "Report-Msgid-Bugs-To: http://aria2.sourceforge.net/\n"
-"POT-Creation-Date: 2006-03-22 00:47+0900\n"
+"POT-Creation-Date: 2006-03-23 19:46+0900\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -177,35 +177,35 @@ msgstr ""
 msgid "Got EOF from the server."
 msgid "Got EOF from the server."
 msgstr ""
 msgstr ""
 
 
-#: src/main.cc:58
+#: src/main.cc:60
 #, c-format
 #, c-format
 msgid ""
 msgid ""
 "\n"
 "\n"
 "The download was complete. <%s>\n"
 "The download was complete. <%s>\n"
 msgstr ""
 msgstr ""
 
 
-#: src/main.cc:62
+#: src/main.cc:64
 msgid ""
 msgid ""
 "\n"
 "\n"
 "The download was not complete because of errors. Check the log.\n"
 "The download was not complete because of errors. Check the log.\n"
 msgstr ""
 msgstr ""
 
 
-#: src/main.cc:73 src/main.cc:82
+#: src/main.cc:75 src/main.cc:84
 msgid ""
 msgid ""
 "\n"
 "\n"
 "SIGINT signal received."
 "SIGINT signal received."
 msgstr ""
 msgstr ""
 
 
-#: src/main.cc:104
+#: src/main.cc:106
 #, c-format
 #, c-format
 msgid "Unrecognized URL or unsupported protocol: %s\n"
 msgid "Unrecognized URL or unsupported protocol: %s\n"
 msgstr ""
 msgstr ""
 
 
-#: src/main.cc:110
+#: src/main.cc:112
 msgid " version "
 msgid " version "
 msgstr ""
 msgstr ""
 
 
-#: src/main.cc:114
+#: src/main.cc:116
 msgid ""
 msgid ""
 "This program is free software; you can redistribute it and/or modify\n"
 "This program is free software; you can redistribute it and/or modify\n"
 "it under the terms of the GNU General Public License as published by\n"
 "it under the terms of the GNU General Public License as published by\n"
@@ -222,40 +222,40 @@ msgid ""
 "Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\n"
 "Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\n"
 msgstr ""
 msgstr ""
 
 
-#: src/main.cc:128
+#: src/main.cc:130
 #, c-format
 #, c-format
 msgid "Contact Info: %s\n"
 msgid "Contact Info: %s\n"
 msgstr ""
 msgstr ""
 
 
-#: src/main.cc:134
+#: src/main.cc:136
 #, c-format
 #, c-format
 msgid "Usage: %s [options] URL ...\n"
 msgid "Usage: %s [options] URL ...\n"
 msgstr ""
 msgstr ""
 
 
-#: src/main.cc:136
+#: src/main.cc:138
 msgid "Options:"
 msgid "Options:"
 msgstr ""
 msgstr ""
 
 
-#: src/main.cc:137
+#: src/main.cc:139
 msgid " -d, --dir=DIR                The directory to store downloaded file."
 msgid " -d, --dir=DIR                The directory to store downloaded file."
 msgstr ""
 msgstr ""
 
 
-#: src/main.cc:138
+#: src/main.cc:140
 msgid " -o, --out=FILE               The file name for downloaded file."
 msgid " -o, --out=FILE               The file name for downloaded file."
 msgstr ""
 msgstr ""
 
 
-#: src/main.cc:139
+#: src/main.cc:141
 msgid ""
 msgid ""
 " -l, --log=LOG                The file path to store log. If '-' is "
 " -l, --log=LOG                The file path to store log. If '-' is "
 "specified,\n"
 "specified,\n"
 "                              log is written to stdout."
 "                              log is written to stdout."
 msgstr ""
 msgstr ""
 
 
-#: src/main.cc:141
+#: src/main.cc:143
 msgid " -D, --daemon                 Run as daemon."
 msgid " -D, --daemon                 Run as daemon."
 msgstr ""
 msgstr ""
 
 
-#: src/main.cc:142
+#: src/main.cc:144
 msgid ""
 msgid ""
 " -s, --split=N                Download a file using N connections. N must "
 " -s, --split=N                Download a file using N connections. N must "
 "be\n"
 "be\n"
@@ -265,24 +265,24 @@ msgid ""
 "                              N connections."
 "                              N connections."
 msgstr ""
 msgstr ""
 
 
-#: src/main.cc:146
+#: src/main.cc:148
 msgid ""
 msgid ""
 " --retry-wait=SEC             Set amount of time in second between requests\n"
 " --retry-wait=SEC             Set amount of time in second between requests\n"
 "                              for errors. Specify a value between 0 and 60.\n"
 "                              for errors. Specify a value between 0 and 60.\n"
 "                              Default: 5"
 "                              Default: 5"
 msgstr ""
 msgstr ""
 
 
-#: src/main.cc:149
+#: src/main.cc:151
 msgid " -t, --timeout=SEC            Set timeout in second. Default: 60"
 msgid " -t, --timeout=SEC            Set timeout in second. Default: 60"
 msgstr ""
 msgstr ""
 
 
-#: src/main.cc:150
+#: src/main.cc:152
 msgid ""
 msgid ""
 " -m, --max-tries=N            Set number of tries. 0 means unlimited.\n"
 " -m, --max-tries=N            Set number of tries. 0 means unlimited.\n"
 "                              Default: 5"
 "                              Default: 5"
 msgstr ""
 msgstr ""
 
 
-#: src/main.cc:152
+#: src/main.cc:154
 msgid ""
 msgid ""
 " --min-segment-size=SIZE[K|M] Set minimum segment size. You can append\n"
 " --min-segment-size=SIZE[K|M] Set minimum segment size. You can append\n"
 "                              K or M(1K = 1024, 1M = 1024K). This\n"
 "                              K or M(1K = 1024, 1M = 1024K). This\n"
@@ -290,40 +290,40 @@ msgid ""
 "                              1024."
 "                              1024."
 msgstr ""
 msgstr ""
 
 
-#: src/main.cc:156
+#: src/main.cc:158
 msgid ""
 msgid ""
 " --http-proxy=HOST:PORT       Use HTTP proxy server. This affects to all\n"
 " --http-proxy=HOST:PORT       Use HTTP proxy server. This affects to all\n"
 "                              URLs."
 "                              URLs."
 msgstr ""
 msgstr ""
 
 
-#: src/main.cc:158
+#: src/main.cc:160
 msgid " --http-user=USER             Set HTTP user. This affects to all URLs."
 msgid " --http-user=USER             Set HTTP user. This affects to all URLs."
 msgstr ""
 msgstr ""
 
 
-#: src/main.cc:159
+#: src/main.cc:161
 msgid ""
 msgid ""
 " --http-passwd=PASSWD         Set HTTP password. This affects to all URLs."
 " --http-passwd=PASSWD         Set HTTP password. This affects to all URLs."
 msgstr ""
 msgstr ""
 
 
-#: src/main.cc:160
+#: src/main.cc:162
 msgid ""
 msgid ""
 " --http-proxy-user=USER       Set HTTP proxy user. This affects to all URLs"
 " --http-proxy-user=USER       Set HTTP proxy user. This affects to all URLs"
 msgstr ""
 msgstr ""
 
 
-#: src/main.cc:161
+#: src/main.cc:163
 msgid ""
 msgid ""
 " --http-proxy-passwd=PASSWD   Set HTTP proxy password. This affects to all "
 " --http-proxy-passwd=PASSWD   Set HTTP proxy password. This affects to all "
 "URLs."
 "URLs."
 msgstr ""
 msgstr ""
 
 
-#: src/main.cc:162
+#: src/main.cc:164
 msgid ""
 msgid ""
 " --http-proxy-method=METHOD   Set the method to use in proxy request.\n"
 " --http-proxy-method=METHOD   Set the method to use in proxy request.\n"
 "                              METHOD is either 'get' or 'tunnel'.\n"
 "                              METHOD is either 'get' or 'tunnel'.\n"
 "                              Default: tunnel"
 "                              Default: tunnel"
 msgstr ""
 msgstr ""
 
 
-#: src/main.cc:165
+#: src/main.cc:167
 msgid ""
 msgid ""
 " --http-auth-scheme=SCHEME    Set HTTP authentication scheme. Currently, "
 " --http-auth-scheme=SCHEME    Set HTTP authentication scheme. Currently, "
 "basic\n"
 "basic\n"
@@ -334,23 +334,23 @@ msgid ""
 "                              as well as --http-user and --http-passwd."
 "                              as well as --http-user and --http-passwd."
 msgstr ""
 msgstr ""
 
 
-#: src/main.cc:169
+#: src/main.cc:171
 msgid " --referer=REFERER            Set Referer. This affects to all URLs."
 msgid " --referer=REFERER            Set Referer. This affects to all URLs."
 msgstr ""
 msgstr ""
 
 
-#: src/main.cc:170
+#: src/main.cc:172
 msgid ""
 msgid ""
 " --ftp-user=USER              Set FTP user. This affects to all URLs.\n"
 " --ftp-user=USER              Set FTP user. This affects to all URLs.\n"
 "                              Default: anonymous"
 "                              Default: anonymous"
 msgstr ""
 msgstr ""
 
 
-#: src/main.cc:172
+#: src/main.cc:174
 msgid ""
 msgid ""
 " --ftp-passwd=PASSWD          Set FTP password. This affects to all URLs.\n"
 " --ftp-passwd=PASSWD          Set FTP password. This affects to all URLs.\n"
 "                              Default: ARIA2USER@"
 "                              Default: ARIA2USER@"
 msgstr ""
 msgstr ""
 
 
-#: src/main.cc:174
+#: src/main.cc:176
 msgid ""
 msgid ""
 " --ftp-type=TYPE              Set FTP transfer type. TYPE is either "
 " --ftp-type=TYPE              Set FTP transfer type. TYPE is either "
 "'binary'\n"
 "'binary'\n"
@@ -358,11 +358,11 @@ msgid ""
 "                              Default: binary"
 "                              Default: binary"
 msgstr ""
 msgstr ""
 
 
-#: src/main.cc:177
+#: src/main.cc:179
 msgid " -p, --ftp-pasv               Use passive mode in FTP."
 msgid " -p, --ftp-pasv               Use passive mode in FTP."
 msgstr ""
 msgstr ""
 
 
-#: src/main.cc:178
+#: src/main.cc:180
 msgid ""
 msgid ""
 " --ftp-via-http-proxy=METHOD  Use HTTP proxy in FTP. METHOD is either 'get' "
 " --ftp-via-http-proxy=METHOD  Use HTTP proxy in FTP. METHOD is either 'get' "
 "or\n"
 "or\n"
@@ -370,11 +370,11 @@ msgid ""
 "                              Default: tunnel"
 "                              Default: tunnel"
 msgstr ""
 msgstr ""
 
 
-#: src/main.cc:182
+#: src/main.cc:184
 msgid " --torrent-file=TORRENT_FILE  The file path to .torrent file."
 msgid " --torrent-file=TORRENT_FILE  The file path to .torrent file."
 msgstr ""
 msgstr ""
 
 
-#: src/main.cc:183
+#: src/main.cc:185
 msgid ""
 msgid ""
 " --follow-torrent=true|false  Setting this option to false prevents aria2 "
 " --follow-torrent=true|false  Setting this option to false prevents aria2 "
 "to\n"
 "to\n"
@@ -383,97 +383,97 @@ msgid ""
 "                              Default: true"
 "                              Default: true"
 msgstr ""
 msgstr ""
 
 
-#: src/main.cc:188
+#: src/main.cc:190
 msgid " -v, --version                Print the version number and exit."
 msgid " -v, --version                Print the version number and exit."
 msgstr ""
 msgstr ""
 
 
-#: src/main.cc:189
+#: src/main.cc:191
 msgid " -h, --help                   Print this message and exit."
 msgid " -h, --help                   Print this message and exit."
 msgstr ""
 msgstr ""
 
 
-#: src/main.cc:192
+#: src/main.cc:194
 msgid ""
 msgid ""
 " You can specify multiple URLs. All URLs must point to the same file\n"
 " You can specify multiple URLs. All URLs must point to the same file\n"
 " or downloading fails."
 " or downloading fails."
 msgstr ""
 msgstr ""
 
 
-#: src/main.cc:195
+#: src/main.cc:197
 msgid "Examples:"
 msgid "Examples:"
 msgstr ""
 msgstr ""
 
 
-#: src/main.cc:196
+#: src/main.cc:198
 msgid " Download a file by 1 connection:"
 msgid " Download a file by 1 connection:"
 msgstr ""
 msgstr ""
 
 
-#: src/main.cc:198
+#: src/main.cc:200
 msgid " Download a file by 2 connections:"
 msgid " Download a file by 2 connections:"
 msgstr ""
 msgstr ""
 
 
-#: src/main.cc:200
+#: src/main.cc:202
 msgid " Download a file by 2 connections, each connects to a different server:"
 msgid " Download a file by 2 connections, each connects to a different server:"
 msgstr ""
 msgstr ""
 
 
-#: src/main.cc:202
+#: src/main.cc:204
 msgid " You can mix up different protocols:"
 msgid " You can mix up different protocols:"
 msgstr ""
 msgstr ""
 
 
-#: src/main.cc:205
+#: src/main.cc:207
 msgid " Download a torrent:"
 msgid " Download a torrent:"
 msgstr ""
 msgstr ""
 
 
-#: src/main.cc:207
+#: src/main.cc:209
 msgid " Download a torrent using local .torrent file:"
 msgid " Download a torrent using local .torrent file:"
 msgstr ""
 msgstr ""
 
 
-#: src/main.cc:211
+#: src/main.cc:213
 #, c-format
 #, c-format
 msgid "Reports bugs to %s"
 msgid "Reports bugs to %s"
 msgstr ""
 msgstr ""
 
 
-#: src/main.cc:296
+#: src/main.cc:298
 msgid "unrecognized proxy format"
 msgid "unrecognized proxy format"
 msgstr ""
 msgstr ""
 
 
-#: src/main.cc:322
+#: src/main.cc:324
 msgid "Currently, supported authentication scheme is basic."
 msgid "Currently, supported authentication scheme is basic."
 msgstr ""
 msgstr ""
 
 
-#: src/main.cc:331
+#: src/main.cc:333
 msgid "retry-wait must be between 0 and 60."
 msgid "retry-wait must be between 0 and 60."
 msgstr ""
 msgstr ""
 
 
-#: src/main.cc:348
+#: src/main.cc:350
 msgid "ftp-type must be either 'binary' or 'ascii'."
 msgid "ftp-type must be either 'binary' or 'ascii'."
 msgstr ""
 msgstr ""
 
 
-#: src/main.cc:357
+#: src/main.cc:359
 msgid "ftp-via-http-proxy must be either 'get' or 'tunnel'."
 msgid "ftp-via-http-proxy must be either 'get' or 'tunnel'."
 msgstr ""
 msgstr ""
 
 
-#: src/main.cc:375
+#: src/main.cc:377
 msgid "min-segment-size invalid"
 msgid "min-segment-size invalid"
 msgstr ""
 msgstr ""
 
 
-#: src/main.cc:386
+#: src/main.cc:388
 msgid "http-proxy-method must be either 'get' or 'tunnel'."
 msgid "http-proxy-method must be either 'get' or 'tunnel'."
 msgstr ""
 msgstr ""
 
 
-#: src/main.cc:400
+#: src/main.cc:402
 msgid "follow-torrent must be either 'true' or 'false'."
 msgid "follow-torrent must be either 'true' or 'false'."
 msgstr ""
 msgstr ""
 
 
-#: src/main.cc:426
+#: src/main.cc:428
 msgid "split must be between 1 and 5."
 msgid "split must be between 1 and 5."
 msgstr ""
 msgstr ""
 
 
-#: src/main.cc:436
+#: src/main.cc:438
 msgid "timeout must be between 1 and 600"
 msgid "timeout must be between 1 and 600"
 msgstr ""
 msgstr ""
 
 
-#: src/main.cc:445
+#: src/main.cc:447
 msgid "max-tries invalid"
 msgid "max-tries invalid"
 msgstr ""
 msgstr ""
 
 
-#: src/main.cc:468
+#: src/main.cc:470
 msgid "specify at least one URL"
 msgid "specify at least one URL"
 msgstr ""
 msgstr ""

BIN
po/ja.gmo


+ 57 - 57
po/ja.po

@@ -7,7 +7,7 @@ msgid ""
 msgstr ""
 msgstr ""
 "Project-Id-Version: aria2c 0.2.1\n"
 "Project-Id-Version: aria2c 0.2.1\n"
 "Report-Msgid-Bugs-To: http://aria2.sourceforge.net/\n"
 "Report-Msgid-Bugs-To: http://aria2.sourceforge.net/\n"
-"POT-Creation-Date: 2006-03-22 00:47+0900\n"
+"POT-Creation-Date: 2006-03-23 19:46+0900\n"
 "PO-Revision-Date: 2006-03-22 00:48+0900\n"
 "PO-Revision-Date: 2006-03-22 00:48+0900\n"
 "Last-Translator: Tatsuhiro Tsujikawa <tujikawa@rednoah.com>\n"
 "Last-Translator: Tatsuhiro Tsujikawa <tujikawa@rednoah.com>\n"
 "Language-Team: Japanese <ja@li.org>\n"
 "Language-Team: Japanese <ja@li.org>\n"
@@ -185,7 +185,7 @@ msgstr "
 msgid "Got EOF from the server."
 msgid "Got EOF from the server."
 msgstr "サーバーから EOF を受けとりました."
 msgstr "サーバーから EOF を受けとりました."
 
 
-#: src/main.cc:58
+#: src/main.cc:60
 #, c-format
 #, c-format
 msgid ""
 msgid ""
 "\n"
 "\n"
@@ -194,7 +194,7 @@ msgstr ""
 "\n"
 "\n"
 "<%s> のダウンロードが完了しました.\n"
 "<%s> のダウンロードが完了しました.\n"
 
 
-#: src/main.cc:62
+#: src/main.cc:64
 msgid ""
 msgid ""
 "\n"
 "\n"
 "The download was not complete because of errors. Check the log.\n"
 "The download was not complete because of errors. Check the log.\n"
@@ -202,7 +202,7 @@ msgstr ""
 "\n"
 "\n"
 "ダウンロードはエラーのため完了していません. ログを確認してください.\n"
 "ダウンロードはエラーのため完了していません. ログを確認してください.\n"
 
 
-#: src/main.cc:73 src/main.cc:82
+#: src/main.cc:75 src/main.cc:84
 msgid ""
 msgid ""
 "\n"
 "\n"
 "SIGINT signal received."
 "SIGINT signal received."
@@ -210,18 +210,18 @@ msgstr ""
 "\n"
 "\n"
 "SIGINT シグナルを受け取りました."
 "SIGINT シグナルを受け取りました."
 
 
-#: src/main.cc:104
+#: src/main.cc:106
 #, c-format
 #, c-format
 msgid "Unrecognized URL or unsupported protocol: %s\n"
 msgid "Unrecognized URL or unsupported protocol: %s\n"
 msgstr ""
 msgstr ""
 "%s は, 理解できない URL フォーマット, または, サポートされないプロトコルで"
 "%s は, 理解できない URL フォーマット, または, サポートされないプロトコルで"
 "す.\n"
 "す.\n"
 
 
-#: src/main.cc:110
+#: src/main.cc:112
 msgid " version "
 msgid " version "
 msgstr " バージョン "
 msgstr " バージョン "
 
 
-#: src/main.cc:114
+#: src/main.cc:116
 msgid ""
 msgid ""
 "This program is free software; you can redistribute it and/or modify\n"
 "This program is free software; you can redistribute it and/or modify\n"
 "it under the terms of the GNU General Public License as published by\n"
 "it under the terms of the GNU General Public License as published by\n"
@@ -252,31 +252,31 @@ msgstr ""
 "Temple Place, Suite 330, Boston, MA 02111-1307 USA)。\n"
 "Temple Place, Suite 330, Boston, MA 02111-1307 USA)。\n"
 "(訳: http://www.opensource.jp/gpl/gpl.ja.html.euc-jp)\n"
 "(訳: http://www.opensource.jp/gpl/gpl.ja.html.euc-jp)\n"
 
 
-#: src/main.cc:128
+#: src/main.cc:130
 #, c-format
 #, c-format
 msgid "Contact Info: %s\n"
 msgid "Contact Info: %s\n"
 msgstr "連絡先: %s\n"
 msgstr "連絡先: %s\n"
 
 
-#: src/main.cc:134
+#: src/main.cc:136
 #, c-format
 #, c-format
 msgid "Usage: %s [options] URL ...\n"
 msgid "Usage: %s [options] URL ...\n"
 msgstr "使い方: %s [オプション] URL ...\n"
 msgstr "使い方: %s [オプション] URL ...\n"
 
 
-#: src/main.cc:136
+#: src/main.cc:138
 msgid "Options:"
 msgid "Options:"
 msgstr "オプション:"
 msgstr "オプション:"
 
 
-#: src/main.cc:137
+#: src/main.cc:139
 msgid " -d, --dir=DIR                The directory to store downloaded file."
 msgid " -d, --dir=DIR                The directory to store downloaded file."
 msgstr ""
 msgstr ""
 " -d, --dir=DIR                ダウンロードしたファイルを保存するディレクトリ."
 " -d, --dir=DIR                ダウンロードしたファイルを保存するディレクトリ."
 
 
-#: src/main.cc:138
+#: src/main.cc:140
 msgid " -o, --out=FILE               The file name for downloaded file."
 msgid " -o, --out=FILE               The file name for downloaded file."
 msgstr ""
 msgstr ""
 " -o, --out=FILE               ダウンロードしたファイルの保存先ファイル名."
 " -o, --out=FILE               ダウンロードしたファイルの保存先ファイル名."
 
 
-#: src/main.cc:139
+#: src/main.cc:141
 msgid ""
 msgid ""
 " -l, --log=LOG                The file path to store log. If '-' is "
 " -l, --log=LOG                The file path to store log. If '-' is "
 "specified,\n"
 "specified,\n"
@@ -286,11 +286,11 @@ msgstr ""
 "力\n"
 "力\n"
 "                              に出力します."
 "                              に出力します."
 
 
-#: src/main.cc:141
+#: src/main.cc:143
 msgid " -D, --daemon                 Run as daemon."
 msgid " -D, --daemon                 Run as daemon."
 msgstr " -D, --daemon                 デーモンとして起動します."
 msgstr " -D, --daemon                 デーモンとして起動します."
 
 
-#: src/main.cc:142
+#: src/main.cc:144
 msgid ""
 msgid ""
 " -s, --split=N                Download a file using N connections. N must "
 " -s, --split=N                Download a file using N connections. N must "
 "be\n"
 "be\n"
@@ -309,7 +309,7 @@ msgstr ""
 "ショ\n"
 "ショ\n"
 "                              ンを確立します."
 "                              ンを確立します."
 
 
-#: src/main.cc:146
+#: src/main.cc:148
 msgid ""
 msgid ""
 " --retry-wait=SEC             Set amount of time in second between requests\n"
 " --retry-wait=SEC             Set amount of time in second between requests\n"
 "                              for errors. Specify a value between 0 and 60.\n"
 "                              for errors. Specify a value between 0 and 60.\n"
@@ -320,13 +320,13 @@ msgstr ""
 "                              す. 0 - 60 の値を指定してください.\n"
 "                              す. 0 - 60 の値を指定してください.\n"
 "                              デフォルト値: 5"
 "                              デフォルト値: 5"
 
 
-#: src/main.cc:149
+#: src/main.cc:151
 msgid " -t, --timeout=SEC            Set timeout in second. Default: 60"
 msgid " -t, --timeout=SEC            Set timeout in second. Default: 60"
 msgstr ""
 msgstr ""
 " -t, --timeout=SEC            タイムアウトとなる時間を秒で指定します.\n"
 " -t, --timeout=SEC            タイムアウトとなる時間を秒で指定します.\n"
 "                              デフォルト値: 60"
 "                              デフォルト値: 60"
 
 
-#: src/main.cc:150
+#: src/main.cc:152
 msgid ""
 msgid ""
 " -m, --max-tries=N            Set number of tries. 0 means unlimited.\n"
 " -m, --max-tries=N            Set number of tries. 0 means unlimited.\n"
 "                              Default: 5"
 "                              Default: 5"
@@ -335,7 +335,7 @@ msgstr ""
 "行\n"
 "行\n"
 "                              します. デフォルト値: 5"
 "                              します. デフォルト値: 5"
 
 
-#: src/main.cc:152
+#: src/main.cc:154
 msgid ""
 msgid ""
 " --min-segment-size=SIZE[K|M] Set minimum segment size. You can append\n"
 " --min-segment-size=SIZE[K|M] Set minimum segment size. You can append\n"
 "                              K or M(1K = 1024, 1M = 1024K). This\n"
 "                              K or M(1K = 1024, 1M = 1024K). This\n"
@@ -348,7 +348,7 @@ msgstr ""
 "1024K).\n"
 "1024K).\n"
 "                              1024 以上の値を指定してください."
 "                              1024 以上の値を指定してください."
 
 
-#: src/main.cc:156
+#: src/main.cc:158
 msgid ""
 msgid ""
 " --http-proxy=HOST:PORT       Use HTTP proxy server. This affects to all\n"
 " --http-proxy=HOST:PORT       Use HTTP proxy server. This affects to all\n"
 "                              URLs."
 "                              URLs."
@@ -357,14 +357,14 @@ msgstr ""
 "シ\n"
 "シ\n"
 "                              ョンはすべての URL に影響します."
 "                              ョンはすべての URL に影響します."
 
 
-#: src/main.cc:158
+#: src/main.cc:160
 msgid " --http-user=USER             Set HTTP user. This affects to all URLs."
 msgid " --http-user=USER             Set HTTP user. This affects to all URLs."
 msgstr ""
 msgstr ""
 " --http-user=USER             HTTP での認証ユーザーを指定します. このオプショ"
 " --http-user=USER             HTTP での認証ユーザーを指定します. このオプショ"
 "ン\n"
 "ン\n"
 "                              はすべての URL に影響します."
 "                              はすべての URL に影響します."
 
 
-#: src/main.cc:159
+#: src/main.cc:161
 msgid ""
 msgid ""
 " --http-passwd=PASSWD         Set HTTP password. This affects to all URLs."
 " --http-passwd=PASSWD         Set HTTP password. This affects to all URLs."
 msgstr ""
 msgstr ""
@@ -372,7 +372,7 @@ msgstr ""
 "ショ\n"
 "ショ\n"
 "                              ンはすべての URL に影響します."
 "                              ンはすべての URL に影響します."
 
 
-#: src/main.cc:160
+#: src/main.cc:162
 msgid ""
 msgid ""
 " --http-proxy-user=USER       Set HTTP proxy user. This affects to all URLs"
 " --http-proxy-user=USER       Set HTTP proxy user. This affects to all URLs"
 msgstr ""
 msgstr ""
@@ -382,7 +382,7 @@ msgstr ""
 "ま\n"
 "ま\n"
 "                              す."
 "                              す."
 
 
-#: src/main.cc:161
+#: src/main.cc:163
 msgid ""
 msgid ""
 " --http-proxy-passwd=PASSWD   Set HTTP proxy password. This affects to all "
 " --http-proxy-passwd=PASSWD   Set HTTP proxy password. This affects to all "
 "URLs."
 "URLs."
@@ -393,7 +393,7 @@ msgstr ""
 "し\n"
 "し\n"
 "                              ます."
 "                              ます."
 
 
-#: src/main.cc:162
+#: src/main.cc:164
 msgid ""
 msgid ""
 " --http-proxy-method=METHOD   Set the method to use in proxy request.\n"
 " --http-proxy-method=METHOD   Set the method to use in proxy request.\n"
 "                              METHOD is either 'get' or 'tunnel'.\n"
 "                              METHOD is either 'get' or 'tunnel'.\n"
@@ -404,7 +404,7 @@ msgstr ""
 "                              す. 'get' または 'tunnel' を指定してください.\n"
 "                              す. 'get' または 'tunnel' を指定してください.\n"
 "                              デフォルト値: tunnel"
 "                              デフォルト値: tunnel"
 
 
-#: src/main.cc:165
+#: src/main.cc:167
 msgid ""
 msgid ""
 " --http-auth-scheme=SCHEME    Set HTTP authentication scheme. Currently, "
 " --http-auth-scheme=SCHEME    Set HTTP authentication scheme. Currently, "
 "basic\n"
 "basic\n"
@@ -422,14 +422,14 @@ msgstr ""
 "定\n"
 "定\n"
 "                              する必要があります."
 "                              する必要があります."
 
 
-#: src/main.cc:169
+#: src/main.cc:171
 msgid " --referer=REFERER            Set Referer. This affects to all URLs."
 msgid " --referer=REFERER            Set Referer. This affects to all URLs."
 msgstr ""
 msgstr ""
 " --referer=REFERER            リファラーを指定します. このオプションはすべて"
 " --referer=REFERER            リファラーを指定します. このオプションはすべて"
 "の\n"
 "の\n"
 "                               URL に影響します."
 "                               URL に影響します."
 
 
-#: src/main.cc:170
+#: src/main.cc:172
 msgid ""
 msgid ""
 " --ftp-user=USER              Set FTP user. This affects to all URLs.\n"
 " --ftp-user=USER              Set FTP user. This affects to all URLs.\n"
 "                              Default: anonymous"
 "                              Default: anonymous"
@@ -439,7 +439,7 @@ msgstr ""
 "                              はすべての URL に影響します.\n"
 "                              はすべての URL に影響します.\n"
 "                              デフォルト値: anonymous"
 "                              デフォルト値: anonymous"
 
 
-#: src/main.cc:172
+#: src/main.cc:174
 msgid ""
 msgid ""
 " --ftp-passwd=PASSWD          Set FTP password. This affects to all URLs.\n"
 " --ftp-passwd=PASSWD          Set FTP password. This affects to all URLs.\n"
 "                              Default: ARIA2USER@"
 "                              Default: ARIA2USER@"
@@ -449,7 +449,7 @@ msgstr ""
 "                              ンはすべての URL に影響します.\n"
 "                              ンはすべての URL に影響します.\n"
 "                              デフォルト値: ARIA2USER@"
 "                              デフォルト値: ARIA2USER@"
 
 
-#: src/main.cc:174
+#: src/main.cc:176
 msgid ""
 msgid ""
 " --ftp-type=TYPE              Set FTP transfer type. TYPE is either "
 " --ftp-type=TYPE              Set FTP transfer type. TYPE is either "
 "'binary'\n"
 "'binary'\n"
@@ -460,11 +460,11 @@ msgstr ""
 "                              'ascii' を指定してください. デフォルト値: "
 "                              'ascii' を指定してください. デフォルト値: "
 "binary"
 "binary"
 
 
-#: src/main.cc:177
+#: src/main.cc:179
 msgid " -p, --ftp-pasv               Use passive mode in FTP."
 msgid " -p, --ftp-pasv               Use passive mode in FTP."
 msgstr " -p, --ftp-pasv               FTP で passive モードを使用します."
 msgstr " -p, --ftp-pasv               FTP で passive モードを使用します."
 
 
-#: src/main.cc:178
+#: src/main.cc:180
 msgid ""
 msgid ""
 " --ftp-via-http-proxy=METHOD  Use HTTP proxy in FTP. METHOD is either 'get' "
 " --ftp-via-http-proxy=METHOD  Use HTTP proxy in FTP. METHOD is either 'get' "
 "or\n"
 "or\n"
@@ -477,11 +477,11 @@ msgstr ""
 "く\n"
 "く\n"
 "                              ださい. デフォルト値: tunnel"
 "                              ださい. デフォルト値: tunnel"
 
 
-#: src/main.cc:182
+#: src/main.cc:184
 msgid " --torrent-file=TORRENT_FILE  The file path to .torrent file."
 msgid " --torrent-file=TORRENT_FILE  The file path to .torrent file."
 msgstr " --torrent-file=TORRENT_FILE  .torrent ファイルのパスを指定."
 msgstr " --torrent-file=TORRENT_FILE  .torrent ファイルのパスを指定."
 
 
-#: src/main.cc:183
+#: src/main.cc:185
 msgid ""
 msgid ""
 " --follow-torrent=true|false  Setting this option to false prevents aria2 "
 " --follow-torrent=true|false  Setting this option to false prevents aria2 "
 "to\n"
 "to\n"
@@ -496,16 +496,16 @@ msgstr ""
 "                              は, BitTorrent モードに入りません.\n"
 "                              は, BitTorrent モードに入りません.\n"
 "                              デフォルト値: true"
 "                              デフォルト値: true"
 
 
-#: src/main.cc:188
+#: src/main.cc:190
 msgid " -v, --version                Print the version number and exit."
 msgid " -v, --version                Print the version number and exit."
 msgstr " -v, --version                バージョン番号を表示し, 終了します."
 msgstr " -v, --version                バージョン番号を表示し, 終了します."
 
 
-#: src/main.cc:189
+#: src/main.cc:191
 msgid " -h, --help                   Print this message and exit."
 msgid " -h, --help                   Print this message and exit."
 msgstr ""
 msgstr ""
 " -h, --help                   このヘルプメッセージを表示し, 終了します."
 " -h, --help                   このヘルプメッセージを表示し, 終了します."
 
 
-#: src/main.cc:192
+#: src/main.cc:194
 msgid ""
 msgid ""
 " You can specify multiple URLs. All URLs must point to the same file\n"
 " You can specify multiple URLs. All URLs must point to the same file\n"
 " or downloading fails."
 " or downloading fails."
@@ -514,83 +514,83 @@ msgstr ""
 "れ\n"
 "れ\n"
 " ばなりません. さもなくばダウンロードは失敗します."
 " ばなりません. さもなくばダウンロードは失敗します."
 
 
-#: src/main.cc:195
+#: src/main.cc:197
 msgid "Examples:"
 msgid "Examples:"
 msgstr "例:"
 msgstr "例:"
 
 
-#: src/main.cc:196
+#: src/main.cc:198
 msgid " Download a file by 1 connection:"
 msgid " Download a file by 1 connection:"
 msgstr " 1 コネクションでのダウンロード:"
 msgstr " 1 コネクションでのダウンロード:"
 
 
-#: src/main.cc:198
+#: src/main.cc:200
 msgid " Download a file by 2 connections:"
 msgid " Download a file by 2 connections:"
 msgstr " 2 コネクションでのダウンロード:"
 msgstr " 2 コネクションでのダウンロード:"
 
 
-#: src/main.cc:200
+#: src/main.cc:202
 msgid " Download a file by 2 connections, each connects to a different server:"
 msgid " Download a file by 2 connections, each connects to a different server:"
 msgstr " 二つの異なるサーバーに接続してダウンロード:"
 msgstr " 二つの異なるサーバーに接続してダウンロード:"
 
 
-#: src/main.cc:202
+#: src/main.cc:204
 msgid " You can mix up different protocols:"
 msgid " You can mix up different protocols:"
 msgstr " 異なるプロトコルを混合させてダウンロード:"
 msgstr " 異なるプロトコルを混合させてダウンロード:"
 
 
-#: src/main.cc:205
+#: src/main.cc:207
 msgid " Download a torrent:"
 msgid " Download a torrent:"
 msgstr "torrent をダウンロード:"
 msgstr "torrent をダウンロード:"
 
 
-#: src/main.cc:207
+#: src/main.cc:209
 msgid " Download a torrent using local .torrent file:"
 msgid " Download a torrent using local .torrent file:"
 msgstr " ローカル .torrent ファイルを使ってダウンロード:"
 msgstr " ローカル .torrent ファイルを使ってダウンロード:"
 
 
-#: src/main.cc:211
+#: src/main.cc:213
 #, c-format
 #, c-format
 msgid "Reports bugs to %s"
 msgid "Reports bugs to %s"
 msgstr "バグレポートはこちらへ: %s"
 msgstr "バグレポートはこちらへ: %s"
 
 
-#: src/main.cc:296
+#: src/main.cc:298
 msgid "unrecognized proxy format"
 msgid "unrecognized proxy format"
 msgstr "理解できないProxyフォーマットです."
 msgstr "理解できないProxyフォーマットです."
 
 
-#: src/main.cc:322
+#: src/main.cc:324
 msgid "Currently, supported authentication scheme is basic."
 msgid "Currently, supported authentication scheme is basic."
 msgstr "現在サポートされている認証方法は basic です."
 msgstr "現在サポートされている認証方法は basic です."
 
 
-#: src/main.cc:331
+#: src/main.cc:333
 msgid "retry-wait must be between 0 and 60."
 msgid "retry-wait must be between 0 and 60."
 msgstr "retry-wait は 0 から 60 の間で指定してください."
 msgstr "retry-wait は 0 から 60 の間で指定してください."
 
 
-#: src/main.cc:348
+#: src/main.cc:350
 msgid "ftp-type must be either 'binary' or 'ascii'."
 msgid "ftp-type must be either 'binary' or 'ascii'."
 msgstr "ftp-type は 'binary' または 'ascii' を指定してください."
 msgstr "ftp-type は 'binary' または 'ascii' を指定してください."
 
 
-#: src/main.cc:357
+#: src/main.cc:359
 msgid "ftp-via-http-proxy must be either 'get' or 'tunnel'."
 msgid "ftp-via-http-proxy must be either 'get' or 'tunnel'."
 msgstr "ftp-via-http-proxy は 'get' または 'tunnel' を指定してください."
 msgstr "ftp-via-http-proxy は 'get' または 'tunnel' を指定してください."
 
 
-#: src/main.cc:375
+#: src/main.cc:377
 msgid "min-segment-size invalid"
 msgid "min-segment-size invalid"
 msgstr "min-segment-size が不正です."
 msgstr "min-segment-size が不正です."
 
 
-#: src/main.cc:386
+#: src/main.cc:388
 msgid "http-proxy-method must be either 'get' or 'tunnel'."
 msgid "http-proxy-method must be either 'get' or 'tunnel'."
 msgstr "http-proxy-method は 'get' または 'tunnel' を指定してください."
 msgstr "http-proxy-method は 'get' または 'tunnel' を指定してください."
 
 
-#: src/main.cc:400
+#: src/main.cc:402
 msgid "follow-torrent must be either 'true' or 'false'."
 msgid "follow-torrent must be either 'true' or 'false'."
 msgstr "follow-torrent は 'true' または 'false を指定してください."
 msgstr "follow-torrent は 'true' または 'false を指定してください."
 
 
-#: src/main.cc:426
+#: src/main.cc:428
 msgid "split must be between 1 and 5."
 msgid "split must be between 1 and 5."
 msgstr "split は 1 - 5 の値を指定してください."
 msgstr "split は 1 - 5 の値を指定してください."
 
 
-#: src/main.cc:436
+#: src/main.cc:438
 msgid "timeout must be between 1 and 600"
 msgid "timeout must be between 1 and 600"
 msgstr "timeout は 1 - 600 の値を指定してください."
 msgstr "timeout は 1 - 600 の値を指定してください."
 
 
-#: src/main.cc:445
+#: src/main.cc:447
 msgid "max-tries invalid"
 msgid "max-tries invalid"
 msgstr "max-tries が不正です."
 msgstr "max-tries が不正です."
 
 
-#: src/main.cc:468
+#: src/main.cc:470
 msgid "specify at least one URL"
 msgid "specify at least one URL"
 msgstr "一個以上の URL を指定してください."
 msgstr "一個以上の URL を指定してください."

+ 1 - 1
src/AbstractCommand.cc

@@ -62,7 +62,7 @@ bool AbstractCommand::isTimeoutDetected() {
     return false;
     return false;
   } else {
   } else {
     long long int elapsed = Util::difftv(now, checkPoint);
     long long int elapsed = Util::difftv(now, checkPoint);
-    if(elapsed >= e->option->getAsInt(PREF_TIMEOUT)*1000000) {
+    if(elapsed >= e->option->getAsLLInt(PREF_TIMEOUT)*1000000) {
       return true;
       return true;
     } else {
     } else {
       return false;
       return false;

+ 2 - 29
src/BitfieldMan.cc

@@ -111,6 +111,7 @@ int BitfieldMan::getMissingIndex(const unsigned char* peerBitfield, int length)
   }
   }
   int max = countSetBit(tempBitfield, bitfieldLength);
   int max = countSetBit(tempBitfield, bitfieldLength);
   int index = getMissingIndexRandomly(tempBitfield, bitfieldLength, max);
   int index = getMissingIndexRandomly(tempBitfield, bitfieldLength, max);
+  delete [] tempBitfield;
   return index;
   return index;
 }
 }
 
 
@@ -123,36 +124,8 @@ int BitfieldMan::getMissingUnusedIndex(const unsigned char* peerBitfield, int le
     tempBitfield[i] = peerBitfield[i] & ~bitfield[i] & ~useBitfield[i];
     tempBitfield[i] = peerBitfield[i] & ~bitfield[i] & ~useBitfield[i];
   }
   }
   int max = countSetBit(tempBitfield, bitfieldLength);
   int max = countSetBit(tempBitfield, bitfieldLength);
-  /*
-  int max = 0;
-  for(int i = 0; i < bitfieldLength; i++) {
-    unsigned char bit = tempBitfield[i];
-    for(int bs = 7; bs >= 0 && i*8+7-bs < blocks; bs--) {
-      unsigned char mask = 1 << bs;
-      if(bit & mask) {
-	max++;
-      }
-    }
-  }
-  */
   int index = getMissingIndexRandomly(tempBitfield, bitfieldLength, max);
   int index = getMissingIndexRandomly(tempBitfield, bitfieldLength, max);
-  /*
-  int index = -1;
-  int nth = 1+(int)(((double)max)*random()/(RAND_MAX+1.0));
-  for(int i = 0; i < bitfieldLength && index == -1; i++) {
-    unsigned char bit = tempBitfield[i];
-    for(int bs = 7; bs >= 0 && i*8+7-bs < blocks; bs--) {
-      unsigned char mask = 1 << bs;
-      if(bit & mask) {
-	nth--;
-	if(nth == 0) {
-	  index = i*8+7-bs;
-	  break;
-	}
-      }
-    }
-  }
-  */
+  delete [] tempBitfield;
   return index;
   return index;
 }
 }
 
 

+ 1 - 0
src/ChunkedEncoding.cc

@@ -154,6 +154,7 @@ int ChunkedEncoding::readChunkSize(char** pp) {
   temp[exsp-*pp] = '\0';
   temp[exsp-*pp] = '\0';
 
 
   chunkSize = strtol(temp, NULL, 16);
   chunkSize = strtol(temp, NULL, 16);
+  delete [] temp;
   if(chunkSize < 0) {
   if(chunkSize < 0) {
     throw new DlAbortEx(EX_INVALID_CHUNK_SIZE);
     throw new DlAbortEx(EX_INVALID_CHUNK_SIZE);
   } else if(errno == ERANGE && (chunkSize == LONG_MAX || chunkSize == LONG_MIN)) {
   } else if(errno == ERANGE && (chunkSize == LONG_MAX || chunkSize == LONG_MIN)) {

+ 4 - 2
src/Data.cc

@@ -44,7 +44,9 @@ string Data::toString() const {
     char* temp = new char[len+1];
     char* temp = new char[len+1];
     memcpy(temp, data, len);
     memcpy(temp, data, len);
     temp[len] = '\0';
     temp[len] = '\0';
-    return string(temp);
+    string str(temp);
+    delete [] temp;
+    return str;
   }
   }
 }
 }
 
 
@@ -68,7 +70,7 @@ long long int Data::toLLInt() const {
   if(len == 0) {
   if(len == 0) {
     return 0;
     return 0;
   } else {
   } else {
-    return strtoll(data, NULL, 10);
+    return strtoll(toString().c_str(), NULL, 10);
   }
   }
 }
 }
 
 

+ 4 - 0
src/Peer.cc

@@ -46,3 +46,7 @@ bool Peer::shouldChoke() const {
     return peerDownload >= peerUpload+pieceLength*4;
     return peerDownload >= peerUpload+pieceLength*4;
   }
   }
 }
 }
+
+bool Peer::hasPiece(int index) const {
+  return bitfield->isBitSet(index);
+}

+ 2 - 0
src/Peer.h

@@ -109,6 +109,8 @@ public:
 
 
   bool shouldChoke() const;
   bool shouldChoke() const;
 
 
+  bool hasPiece(int index) const;
+
   static Peer* nullPeer;
   static Peer* nullPeer;
 };
 };
 
 

+ 1 - 1
src/PeerAbstractCommand.cc

@@ -63,7 +63,7 @@ bool PeerAbstractCommand::isTimeoutDetected() {
     return false;
     return false;
   } else {
   } else {
     long long int elapsed = Util::difftv(now, checkPoint);
     long long int elapsed = Util::difftv(now, checkPoint);
-    if(elapsed >= e->option->getAsInt(PREF_TIMEOUT)*1000000) {
+    if(elapsed >= e->option->getAsLLInt(PREF_TIMEOUT)*1000000) {
       return true;
       return true;
     } else {
     } else {
       return false;
       return false;

+ 1 - 1
src/PeerInteractionCommand.cc

@@ -361,7 +361,7 @@ void PeerInteractionCommand::keepAlive() {
   } else {
   } else {
     struct timeval now;
     struct timeval now;
     gettimeofday(&now, NULL);
     gettimeofday(&now, NULL);
-    if(Util::difftv(now, keepAliveCheckPoint) >= 120*1000000) {
+    if(Util::difftv(now, keepAliveCheckPoint) >= (long long int)120*1000000) {
       if(pendingMessages.empty()) {
       if(pendingMessages.empty()) {
 	peerConnection->sendKeepAlive();
 	peerConnection->sendKeepAlive();
       }
       }

+ 3 - 1
src/PendingMessage.cc

@@ -25,7 +25,9 @@ bool PendingMessage::processMessage() {
   bool retval = true;
   bool retval = true;
   switch(peerMessageId) {
   switch(peerMessageId) {
   case PeerMessage::HAVE:
   case PeerMessage::HAVE:
-    peerConnection->sendHave(index);
+    if(!peerConnection->getPeer()->hasPiece(index)) {
+      peerConnection->sendHave(index);
+    }
     break;
     break;
   case PeerMessage::BITFIELD:
   case PeerMessage::BITFIELD:
     peerConnection->sendBitfield();
     peerConnection->sendBitfield();

+ 3 - 1
src/Request.cc

@@ -36,7 +36,9 @@ Request::Request():port(0), tryCount(0), isTorrent(false) {
   cookieBox = new CookieBox();
   cookieBox = new CookieBox();
 }
 }
 
 
-Request::~Request() {}
+Request::~Request() {
+  delete cookieBox;
+}
 
 
 bool Request::setUrl(string url) {
 bool Request::setUrl(string url) {
   this->url = url;
   this->url = url;

+ 1 - 1
src/RequestSlot.cc

@@ -55,7 +55,7 @@ void RequestSlot::setDispatchedTime() {
 bool RequestSlot::isTimeout(int timeoutSec) const {
 bool RequestSlot::isTimeout(int timeoutSec) const {
   struct timeval now;
   struct timeval now;
   gettimeofday(&now, NULL);
   gettimeofday(&now, NULL);
-  return Util::difftv(now, dispatchedTime) > timeoutSec*1000000;
+  return Util::difftv(now, dispatchedTime) > ((long long int)timeoutSec)*1000000;
 }
 }
 
 
 bool RequestSlot::isNull(const RequestSlot& requestSlot) {
 bool RequestSlot::isNull(const RequestSlot& requestSlot) {

+ 1 - 1
src/SleepCommand.cc

@@ -36,7 +36,7 @@ SleepCommand::~SleepCommand() {
 bool SleepCommand::execute() {
 bool SleepCommand::execute() {
   struct timeval now;
   struct timeval now;
   gettimeofday(&now, NULL);
   gettimeofday(&now, NULL);
-  if(Util::difftv(now, checkPoint) >= wait*1000000) {
+  if(Util::difftv(now, checkPoint) >= ((long long int)wait)*1000000) {
     engine->commands.push(nextCommand);
     engine->commands.push(nextCommand);
     nextCommand = NULL;
     nextCommand = NULL;
     return true;
     return true;

+ 10 - 6
src/TorrentMan.cc

@@ -37,11 +37,12 @@ TorrentMan::TorrentMan():bitfield(NULL),
 			 peerEntryIdCounter(0), cuidCounter(0),
 			 peerEntryIdCounter(0), cuidCounter(0),
 			 downloadedSize(0), uploadedSize(0),
 			 downloadedSize(0), uploadedSize(0),
 			 deltaDownload(0), deltaUpload(0),
 			 deltaDownload(0), deltaUpload(0),
+			 storeDir("."),
 			 multiFileTopDir(NULL),
 			 multiFileTopDir(NULL),
 			 interval(DEFAULT_ANNOUNCE_INTERVAL),
 			 interval(DEFAULT_ANNOUNCE_INTERVAL),
 			 minInterval(DEFAULT_ANNOUNCE_MIN_INTERVAL),
 			 minInterval(DEFAULT_ANNOUNCE_MIN_INTERVAL),
 			 complete(0), incomplete(0),
 			 complete(0), incomplete(0),
-			 connections(0) {}
+			 connections(0), diskWriter(NULL) {}
 
 
 TorrentMan::~TorrentMan() {
 TorrentMan::~TorrentMan() {
   if(bitfield != NULL) {
   if(bitfield != NULL) {
@@ -53,6 +54,9 @@ TorrentMan::~TorrentMan() {
   for(Peers::iterator itr = peers.begin(); itr != peers.end(); itr++) {
   for(Peers::iterator itr = peers.begin(); itr != peers.end(); itr++) {
     delete *itr;
     delete *itr;
   }
   }
+  if(diskWriter != NULL) {
+    delete diskWriter;
+  }
 }
 }
 
 
 // TODO do not use this method in application code
 // TODO do not use this method in application code
@@ -316,7 +320,6 @@ void TorrentMan::setup(string metaInfoFile) {
     name = string(basename(basec))+".file";
     name = string(basename(basec))+".file";
     free(basec);
     free(basec);
   }
   }
-
   List* files = (List*)infoDic->get("files");
   List* files = (List*)infoDic->get("files");
   if(files == NULL) {
   if(files == NULL) {
     // single-file mode;
     // single-file mode;
@@ -356,7 +359,6 @@ void TorrentMan::setup(string metaInfoFile) {
   announce = ((Data*)topDic->get("announce"))->toString();
   announce = ((Data*)topDic->get("announce"))->toString();
   pieceLength = ((Data*)infoDic->get("piece length"))->toInt();
   pieceLength = ((Data*)infoDic->get("piece length"))->toInt();
   pieces = totalSize/pieceLength+(totalSize%pieceLength ? 1 : 0);
   pieces = totalSize/pieceLength+(totalSize%pieceLength ? 1 : 0);
-    
   Data* piecesHashData = (Data*)infoDic->get("pieces");
   Data* piecesHashData = (Data*)infoDic->get("pieces");
   if(piecesHashData->getLen() != pieces*20) {
   if(piecesHashData->getLen() != pieces*20) {
     throw new DlAbortEx("the number of pieces is wrong.");
     throw new DlAbortEx("the number of pieces is wrong.");
@@ -388,7 +390,7 @@ string TorrentMan::getPieceHash(int index) const {
 }
 }
 
 
 string TorrentMan::getFilePath() const {
 string TorrentMan::getFilePath() const {
-  return (storeDir == "" ? "." : storeDir)+"/"+name;
+  return storeDir+"/"+name;
 }
 }
 
 
 string TorrentMan::getTempFilePath() const {
 string TorrentMan::getTempFilePath() const {
@@ -499,11 +501,13 @@ void TorrentMan::renameSingleFile() const {
 }
 }
 
 
 void TorrentMan::splitMultiFile() const {
 void TorrentMan::splitMultiFile() const {
-  multiFileTopDir->createDir((storeDir == "" ? "." : storeDir), true);
+  logger->info("creating directories");
+  multiFileTopDir->createDir(storeDir, true);
   long long int offset = 0;
   long long int offset = 0;
+  logger->info("splitting file");
   for(MultiFileEntries::const_iterator itr = multiFileEntries.begin();
   for(MultiFileEntries::const_iterator itr = multiFileEntries.begin();
       itr != multiFileEntries.end(); itr++) {
       itr != multiFileEntries.end(); itr++) {
-    Util::rangedFileCopy(itr->path, getTempFilePath(), offset, itr->length);
+    Util::rangedFileCopy(storeDir+"/"+itr->path, getTempFilePath(), offset, itr->length);
     offset += itr->length;
     offset += itr->length;
   }
   }
   unlink(getTempFilePath().c_str());
   unlink(getTempFilePath().c_str());

+ 3 - 2
src/main.cc

@@ -525,7 +525,7 @@ int main(int argc, char* argv[]) {
     Requests requests;
     Requests requests;
     for(int i = 1; optind+i-1 < argc; i++) {
     for(int i = 1; optind+i-1 < argc; i++) {
       for(int s = 1; s <= split; s++) {
       for(int s = 1; s <= split; s++) {
-      addCommand(split*(i-1)+s, argv[optind+i-1], referer, requests); 
+	addCommand(split*(i-1)+s, argv[optind+i-1], referer, requests); 
       }
       }
     }
     }
     e->run();
     e->run();
@@ -594,9 +594,10 @@ int main(int argc, char* argv[]) {
       } else {
       } else {
 	printDownloadAbortMessage();
 	printDownloadAbortMessage();
       }
       }
-      
+      delete(req);
       delete(te->segmentMan);
       delete(te->segmentMan);
       delete(te->torrentMan);
       delete(te->torrentMan);
+      delete(te->diskWriter);
       delete(te);
       delete(te);
     } catch(Exception* ex) {
     } catch(Exception* ex) {
       cerr << ex->getMsg() << endl;
       cerr << ex->getMsg() << endl;