Explorar o código

2007-07-02 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>

	Fix the bug that causes -s option not to work.
	* src/main.cc (main)
	* src/a2algo.h: New file.
Tatsuhiro Tsujikawa %!s(int64=18) %!d(string=hai) anos
pai
achega
583f6c9c22
Modificáronse 6 ficheiros con 72 adicións e 14 borrados
  1. 6 0
      ChangeLog
  2. 10 10
      configure
  3. 1 1
      configure.ac
  4. 1 1
      po/Makefile.in
  5. 45 0
      src/a2algo.h
  6. 9 2
      src/main.cc

+ 6 - 0
ChangeLog

@@ -1,3 +1,9 @@
+2007-07-02  Tatsuhiro Tsujikawa  <tujikawa at rednoah dot com>
+
+	Fix the bug that causes -s option not to work.
+	* src/main.cc (main)
+	* src/a2algo.h: New file.
+
 2007-07-01  Tatsuhiro Tsujikawa  <tujikawa at rednoah dot com>
 
 	Create directory structure specified in metalink file.

+ 10 - 10
configure

@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.61 for aria2c 0.11.0.
+# Generated by GNU Autoconf 2.61 for aria2c 0.11.1.
 #
 # Report bugs to <t-tujikawa@users.sourceforge.net>.
 #
@@ -574,8 +574,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
 # Identity of this package.
 PACKAGE_NAME='aria2c'
 PACKAGE_TARNAME='aria2c'
-PACKAGE_VERSION='0.11.0'
-PACKAGE_STRING='aria2c 0.11.0'
+PACKAGE_VERSION='0.11.1'
+PACKAGE_STRING='aria2c 0.11.1'
 PACKAGE_BUGREPORT='t-tujikawa@users.sourceforge.net'
 
 ac_unique_file="src/Socket.h"
@@ -1275,7 +1275,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures aria2c 0.11.0 to adapt to many kinds of systems.
+\`configure' configures aria2c 0.11.1 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1345,7 +1345,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of aria2c 0.11.0:";;
+     short | recursive ) echo "Configuration of aria2c 0.11.1:";;
    esac
   cat <<\_ACEOF
 
@@ -1466,7 +1466,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-aria2c configure 0.11.0
+aria2c configure 0.11.1
 generated by GNU Autoconf 2.61
 
 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@@ -1480,7 +1480,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by aria2c $as_me 0.11.0, which was
+It was created by aria2c $as_me 0.11.1, which was
 generated by GNU Autoconf 2.61.  Invocation command line was
 
   $ $0 $@
@@ -2150,7 +2150,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE='aria2c'
- VERSION='0.11.0'
+ VERSION='0.11.1'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -12941,7 +12941,7 @@ exec 6>&1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by aria2c $as_me 0.11.0, which was
+This file was extended by aria2c $as_me 0.11.1, which was
 generated by GNU Autoconf 2.61.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -12994,7 +12994,7 @@ Report bugs to <bug-autoconf@gnu.org>."
 _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF
 ac_cs_version="\\
-aria2c config.status 0.11.0
+aria2c config.status 0.11.1
 configured by $0, generated by GNU Autoconf 2.61,
   with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
 

+ 1 - 1
configure.ac

@@ -2,7 +2,7 @@
 # Process this file with autoconf to produce a configure script.
 #
 AC_PREREQ(2.59)
-AC_INIT(aria2c, 0.11.0, t-tujikawa@users.sourceforge.net)
+AC_INIT(aria2c, 0.11.1, t-tujikawa@users.sourceforge.net)
 AM_INIT_AUTOMAKE()
 AM_PATH_CPPUNIT(1.10.2)
 AC_CONFIG_SRCDIR([src/Socket.h])

+ 1 - 1
po/Makefile.in

@@ -9,7 +9,7 @@
 # General Public License and is *not* in the public domain.
 
 PACKAGE = aria2c
-VERSION = 0.11.0
+VERSION = 0.11.1
 
 SHELL = /bin/sh
 

+ 45 - 0
src/a2algo.h

@@ -0,0 +1,45 @@
+/* <!-- copyright */
+/*
+ * aria2 - The high speed download utility
+ *
+ * Copyright (C) 2006 Tatsuhiro Tsujikawa
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ * In addition, as a special exception, the copyright holders give
+ * permission to link the code of portions of this program with the
+ * OpenSSL library under certain conditions as described in each
+ * individual source file, and distribute linked combinations
+ * including the two.
+ * You must obey the GNU General Public License in all respects
+ * for all of the code used other than OpenSSL.  If you modify
+ * file(s) with this exception, you may extend this exception to your
+ * version of the file(s), but you are not obligated to do so.  If you
+ * do not wish to do so, delete this exception statement from your
+ * version.  If you delete this exception statement from all source
+ * files in the program, then also delete it here.
+ */
+/* copyright --> */
+
+template<typename InputIterator, typename OutputIterator>
+OutputIterator ncopy(InputIterator first, InputIterator last,
+		     int32_t count, OutputIterator destination)
+{
+  OutputIterator x = destination;
+  for(int32_t i = 0; i < count; ++i) {
+    x = copy(first, last, destination);
+  }
+  return x;
+}

+ 9 - 2
src/main.cc

@@ -51,6 +51,7 @@
 #include "CUIDCounter.h"
 #include "UriFileListParser.h"
 #include "CookieBoxFactory.h"
+#include "a2algo.h"
 #include <deque>
 #include <algorithm>
 #include <time.h>
@@ -747,7 +748,10 @@ int main(int argc, char* argv[]) {
 	  while(flparser.hasNext()) {
 	    Strings uris = flparser.next();
 	    if(!uris.empty()) {
-	      RequestGroupHandle rg = new RequestGroup(uris, op);
+	      Strings xuris;
+	      ncopy(uris.begin(), uris.end(), op->getAsInt(PREF_SPLIT),
+		    back_inserter(xuris));
+	      RequestGroupHandle rg = new RequestGroup(xuris, op);
 	      groups.push_back(rg);
 	    }
 	  }
@@ -755,7 +759,10 @@ int main(int argc, char* argv[]) {
 	}
 	else
 	  {
-	    firstReqInfo = new MultiUrlRequestInfo(args, op);
+	    Strings xargs;
+	    ncopy(args.begin(), args.end(), op->getAsInt(PREF_SPLIT),
+		  back_inserter(xargs));
+	    firstReqInfo = new MultiUrlRequestInfo(xargs, op);
 	  }
 
     RequestInfos reqInfos;