tags 327564 patch
thanks
Hello Jung-hoon, Chris and Rene,
The attached patch seems to fix aria on 64bit plateform.
At least I can download a file with aria now on amd64.
This patch also fix most gcc warning on amd64.
This patch replace use of 'unsigned int' where string::size_type would be
expected (there are a lot of them).
The problem was that string::size_type is a 64bit unsigned type and
(string::size_type) -1 was used as a marker and was lost whe converting
to 32 bit unsigned.
There are still some poor usage of 'int' where a 64bit type would be
better, but they do not seem to affect normal operations (maybe only if
one try to download files >=4B).
(Rene, please add a file debian/README.sources explaining how to use the
build system to get the patched sources).
Cheers,
--
Bill. <[EMAIL PROTECTED]>
Imagine a large red swirl here.
diff -ruN aria-1.0.0-old/src/Command.cc aria-1.0.0/src/Command.cc
--- aria-1.0.0-old/src/Command.cc 2002-04-03 15:33:51.000000000 +0200
+++ aria-1.0.0/src/Command.cc 2006-05-09 19:10:43.621958801 +0200
@@ -171,7 +171,7 @@
string Command::MyToken_splitter(string& line)
{
- unsigned int start_pos = line.find_first_not_of(" \t\n\r");
+ string::size_type start_pos = line.find_first_not_of(" \t\n\r");
if(start_pos == string::npos) {
line.erase();
@@ -187,7 +187,7 @@
if(line.at(start_pos) == '$') { // reserved word
// $(****)
- unsigned int end_pos = line.find(')', start_pos);
+ string::size_type end_pos = line.find(')', start_pos);
if(end_pos == string::npos) {
cerr << "error: paren mismatch: '" << line.substr(start_pos) << "'" <<
endl;
throw 0;
@@ -196,7 +196,7 @@
line.erase(0, end_pos+1);
} else { // unreserved word
- unsigned int end_pos = line.find_first_of("$", start_pos);
+ string::size_type end_pos = line.find_first_of("$", start_pos);
if(end_pos == string::npos) {
end_pos = line.size();
}
diff -ruN aria-1.0.0-old/src/FTPcontainer.cc aria-1.0.0/src/FTPcontainer.cc
--- aria-1.0.0-old/src/FTPcontainer.cc 2002-04-06 05:14:34.000000000 +0200
+++ aria-1.0.0/src/FTPcontainer.cc 2006-05-09 19:10:43.621958801 +0200
@@ -36,7 +36,7 @@
port = 0;
if(resp == NULL) return;
- unsigned int index = resp_string.find_first_of("0123456789");
+ string::size_type index = resp_string.find_first_of("0123456789");
if(index != string::npos) {
//cout << resp+i << "\n" << flush;
sscanf(resp+index, "%d,%d,%d,%d,%d,%d", ip, ip+1, ip+2, ip+3,
diff -ruN aria-1.0.0-old/src/HTMLparse.cc aria-1.0.0/src/HTMLparse.cc
--- aria-1.0.0-old/src/HTMLparse.cc 2002-09-30 15:29:45.000000000 +0200
+++ aria-1.0.0/src/HTMLparse.cc 2006-05-09 19:10:43.622958771 +0200
@@ -37,10 +37,10 @@
{
line.erase(prot_pos, length);
line.insert(prot_pos, prefix);
- unsigned int colon_pos = line.find_first_of(":/\"'>", prot_pos);
+ string::size_type colon_pos = line.find_first_of(":/\"'>", prot_pos);
if(colon_pos != string::npos) {
if(line.at(colon_pos) == ':') {
- unsigned int slash_pos = line.find_first_of("/\"'>", colon_pos);
+ string::size_type slash_pos = line.find_first_of("/\"'>", colon_pos);
if(slash_pos != string::npos) {
line.erase(colon_pos, slash_pos-colon_pos);
} else {
@@ -53,8 +53,8 @@
URLcontainer HTMLparse::find_href(string line, Options& options)
{
- unsigned int href_pos = 0;
- unsigned int eq_pos = 0;
+ string::size_type href_pos = 0;
+ string::size_type eq_pos = 0;
bool flag = true;;
URLcontainer urlcon;
bool fsavefile = (options.ret_with_hostname_dir() &&
options.ret_abs2rel_url() || options.ret_delete_comment() ||
options.ret_delete_javascript() || options.ret_convert_tilde()) && !outfile_bad;
@@ -157,7 +157,7 @@
}
if(!flag) {
- unsigned int url_start = line.find_first_not_of(" \t\r\n", eq_pos+1);
+ string::size_type url_start = line.find_first_not_of(" \t\r\n",
eq_pos+1);
if(url_start == string::npos) {
throw HTMLPARSE_NOHREF;
}
@@ -172,7 +172,7 @@
//cerr << line.substr(url_start) << endl;
/*
- unsigned int url_start = line.find_first_not_of(" \t'\"", eq_pos+1);
+ string::size_type url_start = line.find_first_not_of(" \t'\"", eq_pos+1);
bool quoted_flag = false;
if(url_start == string::npos) {
throw HTMLPARSE_NOHREF;
@@ -190,7 +190,7 @@
if(line.at(url_start) == '\\') {
url_start += 2;
}
- unsigned int url_end;
+ string::size_type url_end;
if(quoted_flag) {
url_end = line.find_first_of("'\">", url_start);
} else {
@@ -208,7 +208,7 @@
string href =
replaceSubstring(removeCtrlChar(Remove_white(line.substr(url_start,
url_end-url_start))), "&", "&");
href = URLcontainer::URL_Decode(href);
- unsigned int slash_pos = href.find('#');
+ string::size_type slash_pos = href.find('#');
if(slash_pos != string::npos) {
href.erase(slash_pos);
}
@@ -320,7 +320,7 @@
Set_save_directory(urlcon, href, options);
if(options.ret_convert_tilde()) {
- unsigned int tilde_pos = line.find('~');
+ string::size_type tilde_pos = line.find('~');
if(tilde_pos >= url_start && tilde_pos < url_end) {
line.erase(tilde_pos, 1);
line.insert(tilde_pos, "%7E");
@@ -329,7 +329,7 @@
}
// convert absolute URL to relative one
if(abs2rel) {
- unsigned int prot_pos;
+ string::size_type prot_pos;
string line_temp;
if(line.size() > 7 && (prot_pos = line.find("http://", url_start, 7))
!= string::npos && prot_pos < url_end) {
// start with "HTTP://"
@@ -413,7 +413,7 @@
bool abs2rel = options.ret_with_hostname_dir() && options.ret_abs2rel_url()
&& !outfile_bad;
URLcontainer urlcon;
try {
- unsigned int index;
+ string::size_type index;
bool fcv_flag = false;
string media;
@@ -427,14 +427,14 @@
}
// needs following three variables
string href;
- unsigned int url_start;
- unsigned int url_end;
+ string::size_type url_start;
+ string::size_type url_end;
if(casecomp(media, "url")) {
//cerr << "find keyword 'url'" << endl;
- unsigned int parenL = index;
- unsigned int parenR = line.find(")", index+1);
+ string::size_type parenL = index;
+ string::size_type parenR = line.find(")", index+1);
if(parenR == string::npos) throw HTMLPARSE_NOHREF;
- unsigned int quoteL = line.find("\"", index+1);
+ string::size_type quoteL = line.find("\"", index+1);
if(quoteL < parenR && quoteL != string::npos) {
if((url_start = line.find_first_not_of(" \t", quoteL+1,
parenR-quoteL-1)) == string::npos) {
throw HTMLPARSE_NOHREF;
@@ -442,7 +442,7 @@
} else {
url_start = parenL+1;
}
- unsigned int quoteR = line.find("\"", url_start+1);
+ string::size_type quoteR = line.find("\"", url_start+1);
if(quoteR < parenR && quoteR != string::npos) {
url_end = quoteR-1;
} else {
@@ -561,7 +561,7 @@
Set_save_directory(urlcon, href, options);
if(options.ret_convert_tilde()) {
- unsigned int tilde_pos = line.find('~');
+ string::size_type tilde_pos = line.find('~');
if(tilde_pos >= url_start && tilde_pos < url_end) {
line.erase(tilde_pos, 1);
line.insert(tilde_pos, "%7E");
@@ -570,7 +570,7 @@
}
// convert absolute URL to relative one
if(abs2rel) {
- unsigned int prot_pos;
+ string::size_type prot_pos;
string line_temp;
if(line.size() > 7 && (prot_pos = line.find("http://", url_start, 7))
!= string::npos && prot_pos < url_end) {
// start with "HTTP://"
@@ -631,7 +631,7 @@
if(line.empty() && infile.eof()) {
throw HTMLPARSE_EOF;
}
- unsigned int index;
+ string::size_type index;
if((index = line.find("@import")) != string::npos) {
index = line.find_first_not_of(" \t", index+7);// 7 is the length of
string "@import"
if(index != string::npos) {
@@ -800,7 +800,7 @@
static_options_in.ret_abs2rel_url() ||
static_options_in.ret_delete_comment() ||
static_options_in.ret_delete_javascript()) {
- unsigned int pos = documentroot_dir.size();
+ string::size_type pos = documentroot_dir.size();
while((pos = static_options_in.ret_Store_Dir().find('/', pos+1)) !=
string::npos) {
prefix += "../";
}
diff -ruN aria-1.0.0-old/src/HTTPcontainer.cc aria-1.0.0/src/HTTPcontainer.cc
--- aria-1.0.0-old/src/HTTPcontainer.cc 2001-10-17 15:06:34.000000000 +0200
+++ aria-1.0.0/src/HTTPcontainer.cc 2006-05-09 19:10:43.622958771 +0200
@@ -79,7 +79,7 @@
} else if(casecomp(hl_itr->ret_Item(), "Content-Range")) {
// must deal with '*'. fix this
string arg = hl_itr->ret_Arg();
- unsigned int slash_pos = arg.find('/');
+ string::size_type slash_pos = arg.find('/');
if(slash_pos != string::npos && slash_pos+1 < arg.size()) {
set_ContentLength(arg.substr(slash_pos+1));
}
diff -ruN aria-1.0.0-old/src/ItemOption.cc aria-1.0.0/src/ItemOption.cc
--- aria-1.0.0-old/src/ItemOption.cc 2002-10-01 17:32:00.000000000 +0200
+++ aria-1.0.0/src/ItemOption.cc 2006-05-09 19:11:50.474951116 +0200
@@ -157,7 +157,7 @@
ProxyList *proxy_list_temp,
GtkWidget *proxy_cbox)
{
- unsigned int colon_pos;
+ string::size_type colon_pos;
string proxyserver_name;
if(string::npos != (colon_pos = proxy_entry.find(':')) &&
proxy_entry.substr(colon_pos).size() > 1) {
@@ -195,7 +195,7 @@
static void Add_http_proxy_entry(GtkWidget *w, GtkWidget *http_proxy_cbox)
{
string proxy_entry =
Remove_white(gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(http_proxy_cbox)->entry)));
- //unsigned int colon_pos;
+ //string::size_type colon_pos;
//string proxyserver_name;
//int proxyserver_port = DEFAULT_PROXY_PORT;
@@ -231,7 +231,7 @@
ProxyList *proxy_list_temp,
GtkWidget *proxy_cbox)
{
- unsigned int colon_pos;
+ string::size_type colon_pos;
string proxyserver_name;
if(string::npos != (colon_pos = proxy_entry.find(':')) &&
proxy_entry.substr(colon_pos).size() > 1) {
@@ -265,7 +265,7 @@
static void Delete_ftp_proxy_entry(GtkWidget *w, GtkWidget *ftp_proxy_cbox)
{
string proxy_entry =
Remove_white(gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(ftp_proxy_cbox)->entry)));
- //unsigned int colon_pos;
+ //string::size_type colon_pos;
//string proxyserver_name;
//int proxyserver_port = DEFAULT_PROXY_PORT;
Delete_common_proxy_entry(proxy_entry, DEFAULT_FTP_PROXY_PORT,
sg_ftpProxyListTemp,
@@ -276,7 +276,7 @@
static void Delete_http_proxy_entry(GtkWidget *w, GtkWidget *http_proxy_cbox)
{
string proxy_entry =
Remove_white(gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(http_proxy_cbox)->entry)));
- //unsigned int colon_pos;
+ //string::size_type colon_pos;
//string proxyserver_name;
//int proxyserver_port = DEFAULT_PROXY_PORT;
Delete_common_proxy_entry(proxy_entry, DEFAULT_HTTP_PROXY_PORT,
sg_httpProxyListTemp,
@@ -3489,7 +3489,7 @@
}
string proxy_entry =
Remove_white(gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(http_proxy_cbox)->entry)));
- unsigned int colon_pos;
+ string::size_type colon_pos;
string proxyserver_name;
int proxyserver_port = DEFAULT_HTTP_PROXY_PORT;
if(string::npos != (colon_pos = proxy_entry.find(':')) &&
proxy_entry.substr(colon_pos).size() > 1) {
@@ -3880,7 +3880,7 @@
// acquire CRC lock
itemcell->get_CRC_Lock();
string crc_string = Remove_white(gtk_entry_get_text(GTK_ENTRY(crc_entry)));
- unsigned int crc = 0;
+ unsigned long crc = 0;
if(crc_string.empty()) {
itemcell->set_CRC_Type(ItemCell::CRC_NONE);
// fixed
diff -ruN aria-1.0.0-old/src/RetrieveFTP.cc aria-1.0.0/src/RetrieveFTP.cc
--- aria-1.0.0-old/src/RetrieveFTP.cc 2002-10-01 17:32:00.000000000 +0200
+++ aria-1.0.0/src/RetrieveFTP.cc 2006-05-09 19:10:43.624958712 +0200
@@ -366,7 +366,7 @@
string year_hm = Token_splitter(line, " \t");
string fullpath;
string savedir;
- unsigned int arrow_pos;
+ string::size_type arrow_pos;
bool dir_flag = false;
try {
@@ -1363,7 +1363,7 @@
// add the header lines to previous line
string tempSockBuf = sockBuf;
tempLine += tempSockBuf;
- unsigned int lineEnd;
+ string::size_type lineEnd;
while((lineEnd = tempLine.find('\r')) != string::npos &&
tempLine.find('\n') != string::npos) {
string headerLine = tempLine.substr(0, lineEnd);
diff -ruN aria-1.0.0-old/src/Session.cc aria-1.0.0/src/Session.cc
--- aria-1.0.0-old/src/Session.cc 2002-04-03 15:33:52.000000000 +0200
+++ aria-1.0.0/src/Session.cc 2006-05-09 19:10:43.625958682 +0200
@@ -119,7 +119,7 @@
string Session::MyToken_splitter(string& line)
{
- unsigned int start_pos = line.find_first_not_of(" \t\n\r");
+ string::size_type start_pos = line.find_first_not_of(" \t\n\r");
if(start_pos == string::npos) {
line.erase();
return "";
@@ -127,7 +127,7 @@
string token;
if(line.at(start_pos) == '$') { // reserved word
// $(****)
- unsigned int end_pos = line.find(')', start_pos);
+ string::size_type end_pos = line.find(')', start_pos);
if(end_pos == string::npos) {
cerr << "error: paren mismatch: '" << line.substr(start_pos) << "'" <<
endl;
throw EPARSE;
@@ -138,7 +138,7 @@
} else if(line.at(start_pos) == '"') { //phrase
++start_pos;
- unsigned int end_pos = line.find('"', start_pos);
+ string::size_type end_pos = line.find('"', start_pos);
if(end_pos == string::npos) {
cerr << "error: unterminated phrase '" << line.substr(start_pos) << "'"
<< endl;
throw EPARSE;
@@ -147,15 +147,15 @@
line.erase(0, end_pos+1);
} else { // unreserved word
bool flag = true;
- unsigned int end_pos = start_pos;
+ string::size_type end_pos = start_pos;
while(flag) {
- unsigned int lstart_pos = end_pos;
+ string::size_type lstart_pos = end_pos;
end_pos = line.find_first_of(" \t\"$", lstart_pos);
if(end_pos == string::npos) {
end_pos = line.size();
flag = false;
} else {
- unsigned int bkslash_pos;
+ string::size_type bkslash_pos;
// '\\' must be converted to '\'
bkslash_pos = lstart_pos;
while((bkslash_pos = line.find("\\\\", bkslash_pos)) < end_pos) {
@@ -540,7 +540,7 @@
int start = stoi(Token_splitter(word, " ,)\t"));
int end = stoi(Token_splitter(word, " ,)\t"));
- unsigned int start_index = 0;
+ string::size_type start_index = 0;
for(int i = 0; i < start; ++i) {
start_index = urlcon.ret_Dir().find("/", start_index+1);
if(start_index == string::npos) {
@@ -548,7 +548,7 @@
break;
}
}
- unsigned int end_index;
+ string::size_type end_index;
if(end < 0) {
end_index = urlcon.ret_Dir().size();
} else {
@@ -585,7 +585,7 @@
int start = stoi(Token_splitter(word, " ,)\t"));
int end = stoi(Token_splitter(word, " ,)\t"));
- unsigned int start_index = 0;
+ string::size_type start_index = 0;
for(int i = 0; i < start; ++i) {
start_index = urlcon.ret_Hostname().find(".", start_index);
@@ -596,7 +596,7 @@
++start_index;
}
}
- unsigned int end_index;
+ string::size_type end_index;
if(end < 0) {
end_index = urlcon.ret_Hostname().size();
} else {
diff -ruN aria-1.0.0-old/src/URLcontainer.cc aria-1.0.0/src/URLcontainer.cc
--- aria-1.0.0-old/src/URLcontainer.cc 2002-12-18 16:41:05.000000000 +0100
+++ aria-1.0.0/src/URLcontainer.cc 2006-05-09 19:10:43.626958652 +0200
@@ -48,8 +48,8 @@
URLcontainer urlcon;
list<string> url_list;
if(!urlcon.Parse_URL(src_url)) return url_list;
- unsigned int h_pos;
- unsigned int lbr_pos;
+ string::size_type h_pos;
+ string::size_type lbr_pos;
string start, end;
string body, tail;
int rank_start, rank_end;
@@ -69,14 +69,14 @@
//return src_url;//""
throw NONUM;
}
- unsigned int var_end_pos = src_file.find('.', h_pos);
+ string::size_type var_end_pos = src_file.find('.', h_pos);
if(var_end_pos == string::npos) {
var_end_pos = src_file.size();
}
rank_end = var_end_pos-h_pos-1;
rank_start = rank_end;
- if(rank_end == 0 || h_pos-1 < (unsigned int)rank_end) throw
NONUM;//return src_url;//""
+ if(rank_end == 0 || h_pos-1 < (string::size_type)rank_end) throw
NONUM;//return src_url;//""
start = src_file.substr(h_pos-rank_start, rank_start);//cerr << start
<< endl;
end = src_file.substr(h_pos+1, rank_end);//cerr << end << endl;
@@ -87,7 +87,7 @@
if((h_pos = src_file.find('-', lbr_pos)) == string::npos) {
throw NONUM;//return "";
}
- unsigned int rbr_pos = src_file.rfind(']');
+ string::size_type rbr_pos = src_file.rfind(']');
if(rbr_pos == string::npos || rbr_pos < lbr_pos) throw NONUM;//return
"";
//rank = h_pos-lbr_pos-1;
rank_end = rbr_pos-h_pos-1;
@@ -163,7 +163,7 @@
// fix this. Only absolute URLs can be retrieved currently.
// This feature must support relative URLs.
string url;
- unsigned int p_pos;
+ string::size_type p_pos;
bool quote_flag = false;
if((p_pos = text.find("http://")) != string::npos ||
#ifdef HAVE_OPENSSL
@@ -173,7 +173,7 @@
if(p_pos > 0 && (text.at(p_pos-1) == '"' || text.at(p_pos-1) == '\'')) {
quote_flag = true;
}
- unsigned int delim_pos;
+ string::size_type delim_pos;
if(quote_flag) {
delim_pos = text.find_first_of("\t\n\"<", p_pos);
} else {
@@ -193,7 +193,7 @@
if(url.size() && !startwith(url, "mailto:") & !startwith(url, "telnet:")) {
if(url.at(0) == '/' && !base_url.empty() && base_url.at(base_url.size()-1)
== '/') {
- unsigned int slash_pos = url.find_first_not_of("/");
+ string::size_type slash_pos = url.find_first_not_of("/");
if(slash_pos == string::npos) slash_pos = url.size();
url.erase(0, slash_pos);
} else if(url.at(0) != '/' && !base_url.empty() &&
base_url.at(base_url.size()-1) != '/') {
@@ -215,20 +215,20 @@
/*
string URLcontainer::Find_HREF_strict(string& text, string base_url)
{
- unsigned int href_pos;
+ string::size_type href_pos;
string url;
if((href_pos = text.find("HREF=")) != string::npos ||
(href_pos = text.find("href=")) != string::npos ||
(href_pos = text.find("SRC=")) != string::npos ||
(href_pos = text.find("src=")) != string::npos) {
- unsigned int lq_pos;
+ string::size_type lq_pos;
if((lq_pos = text.find('"', href_pos)) == string::npos &&
(lq_pos = text.find('\'', href_pos)) == string::npos) {
text.erase();
return "";
}
- unsigned int rq_pos;
+ string::size_type rq_pos;
if((rq_pos = text.find('"', lq_pos+1)) == string::npos &&
(rq_pos = text.find('\'', lq_pos+1)) == string::npos) {
text.erase();
@@ -240,7 +240,7 @@
text.erase(0, rq_pos+1);
if(url.size() && url.substr(0, 7) != "mailto:") {
if(url.at(0) == '/' && !base_url.empty() &&
base_url.at(base_url.size()-1) == '/') {
- unsigned int slash_pos = url.find_first_not_of("/");
+ string::size_type slash_pos = url.find_first_not_of("/");
if(slash_pos == string::npos) slash_pos = url.size();
url.erase(0, slash_pos);
} else if(url.at(0) != '/' && !base_url.empty() &&
base_url.at(base_url.size()-1) != '/') {
@@ -262,7 +262,7 @@
string URLcontainer::Find_URL(string& text, bool ws_quark)
{
- unsigned int p_pos;
+ string::size_type p_pos;
string url;
if((p_pos = text.find("http://")) != string::npos
@@ -270,7 +270,7 @@
|| (p_pos = text.find("https://")) != string::npos
#endif // HAVE_OPENSSL
||(p_pos = text.find("ftp://")) != string::npos) {
- unsigned int delim_pos;
+ string::size_type delim_pos;
if(!ws_quark) {
// "'\"<" is removed,??
if((delim_pos = text.find_first_of("\t\r\n", p_pos)) == string::npos) {
@@ -278,7 +278,7 @@
}
// space is not now recognized as a delimiter.
/*
- unsigned int np_pos;
+ string::size_type np_pos;
if((np_pos = text.substr(p_pos+1, delim_pos-p_pos-1).find("ftp://")) !=
string::npos ||
#ifdef HAVE_OPENSSL
(np_pos = text.substr(p_pos+1, delim_pos-p_pos-1).find("https://")) !=
string::npos ||
@@ -406,7 +406,7 @@
while(!end_flag) {
string line = "";
getline(infile, line, ';');
- unsigned int t_pos;
+ string::size_type t_pos;
if((t_pos = line.find(target)) != string::npos) {
unsigned f_pos = line.find('\'', t_pos)+1;
unsigned e_pos = line.find('\'', f_pos);
@@ -432,8 +432,8 @@
const list<string>& keylink_list,
const URLcontainer& urlcon)
{
- unsigned int href_pos;
- unsigned int eq_pos = 0;
+ string::size_type href_pos;
+ string::size_type eq_pos = 0;
bool flag = true;
string url;
try {
@@ -458,7 +458,7 @@
}
if(flag) throw URLCON_URLNOTFOUND;
- unsigned int url_start = line.find_first_not_of(" \t\r\n", eq_pos+1);
+ string::size_type url_start = line.find_first_not_of(" \t\r\n", eq_pos+1);
if(url_start == string::npos) {
throw URLCON_URLNOTFOUND;
}
@@ -474,7 +474,7 @@
if(line.at(url_start) == '\\') {
url_start += 2;
}
- unsigned int url_end;
+ string::size_type url_end;
if(quoted_flag) {
url_end = line.find_first_of("'\">", url_start);
} else {
@@ -490,7 +490,7 @@
// fix this
string href =
replaceSubstring(removeCtrlChar(Remove_white(line.substr(url_start,
url_end-url_start))), "&", "&");
- unsigned int slash_pos = href.find('#');
+ string::size_type slash_pos = href.find('#');
if(slash_pos != string::npos) {
href.erase(slash_pos);
}
@@ -528,7 +528,7 @@
case URLCON_URLFOUND:
for(list<string>::const_iterator itr = keylink_list.begin();
itr != keylink_list.end(); ++itr) {
- unsigned int pointer = url.find(*itr);
+ string::size_type pointer = url.find(*itr);
if(pointer != string::npos) {
return true;
}
@@ -546,8 +546,8 @@
const list<string>& keylink_list,
const URLcontainer& urlcon)
{
- unsigned int pointer = 0;
- unsigned int from_pos = 0;
+ string::size_type pointer = 0;
+ string::size_type from_pos = 0;
while(1) {
bool flag = true;
for(list<string>::const_iterator itr = keylink_list.begin();
@@ -559,7 +559,7 @@
}
if(flag) return false;
- unsigned int eq_pos;
+ string::size_type eq_pos;
eq_pos = line.rfind('=', pointer);
if(eq_pos == string::npos || eq_pos < from_pos) {
if((from_pos = line.find(' ', pointer)) == string::npos) {
@@ -568,7 +568,7 @@
continue;
}
}
- unsigned int url_start = line.find_first_not_of(" \t'\"", eq_pos+1);
+ string::size_type url_start = line.find_first_not_of(" \t'\"", eq_pos+1);
bool quoted_flag = false;
if(url_start == string::npos) {
if((from_pos = line.find(' ', pointer)) == string::npos) {
@@ -586,7 +586,7 @@
if(line.at(url_start) == '\\') {
url_start += 2;
}
- unsigned int url_end;
+ string::size_type url_end;
if(quoted_flag) {
url_end = line.find_first_of("'\">", url_start+1);
} else {
@@ -601,7 +601,7 @@
}
string href = Remove_white(line.substr(url_start, url_end-url_start));
- unsigned int slash_pos = href.find('#');
+ string::size_type slash_pos = href.find('#');
if(slash_pos != string::npos) {
href.erase(slash_pos);
}
@@ -670,7 +670,7 @@
void URLcontainer::Extract_protocol(string& url)
{
- unsigned int slash_index = url.find("//");
+ string::size_type slash_index = url.find("//");
if(slash_index == string::npos) throw URLCON_EINVALIDURL;
protocol = url.substr(0, slash_index);
url.erase(0, slash_index+2);
@@ -680,15 +680,15 @@
// username and passwd extraction made by Matthias Babisch
void URLcontainer::Extract_userpasswd(string& url)
{
- unsigned int slash_index = url.find("/");
- unsigned int at_index = url.find("@");
+ string::size_type slash_index = url.find("/");
+ string::size_type at_index = url.find("@");
if(at_index == string::npos) {
username="";
passwd="";
} else {
if(slash_index == string::npos || slash_index > at_index) {
// We do have a username-passwd combination
- unsigned int colon_index = url.find(":");
+ string::size_type colon_index = url.find(":");
if(colon_index < slash_index) {
// we have a passwd
passwd=url.substr(colon_index+1, at_index-colon_index-1);
@@ -704,7 +704,7 @@
void URLcontainer::Extract_host(string& url)
{
- unsigned int slash_index = url.find('/');
+ string::size_type slash_index = url.find('/');
if(slash_index == string::npos) {
if(url.empty()) {
throw URLCON_EINVALIDURL;
@@ -715,7 +715,7 @@
if(slash_index == 0) throw URLCON_EINVALIDURL;
host = url.substr(0, slash_index);
url.erase(0, slash_index);
- unsigned int colon_index = host.rfind(':');
+ string::size_type colon_index = host.rfind(':');
if(colon_index != string::npos) {
int port_temp = stoi(host.substr(colon_index+1), 10);
if(port_temp != 0) port = port_temp;
@@ -725,14 +725,14 @@
void URLcontainer::Extract_dir(string& url)
{
- unsigned int ques_index = url.find('?');
+ string::size_type ques_index = url.find('?');
if(ques_index != string::npos) {
- unsigned int slash_index = url.rfind('/', ques_index);
+ string::size_type slash_index = url.rfind('/', ques_index);
if(slash_index == string::npos) throw URLCON_EINVALIDURL;
dir = url.substr(0, slash_index);
url.erase(0, slash_index);
} else {
- unsigned int slash_index = url.rfind('/');
+ string::size_type slash_index = url.rfind('/');
if(slash_index == string::npos) {
slash_index = url.size();
}
@@ -749,11 +749,11 @@
{
//file = Remove_white(url);
file = url;
- unsigned int sharp_index = file.find('#');
+ string::size_type sharp_index = file.find('#');
if(sharp_index != string::npos) {
file.erase(sharp_index);
}
- unsigned int query_index = file.find('?');
+ string::size_type query_index = file.find('?');
if(query_index != string::npos) {
query = file.substr(query_index);
file.erase(query_index);
@@ -801,7 +801,7 @@
string URLcontainer::ret_Extension() const
{
- unsigned int comma_pos = file.rfind(".");
+ string::size_type comma_pos = file.rfind(".");
if(comma_pos == string::npos) return "";
else return file.substr(comma_pos+1);
}
@@ -870,7 +870,7 @@
string URLcontainer::ret_Filename() const
{
/*
- unsigned int ques_pos = file.find('?', 1);
+ string::size_type ques_pos = file.find('?', 1);
if(ques_pos != string::npos) {
return file.substr(1, ques_pos-1);
}
diff -ruN aria-1.0.0-old/src/gui_edit.cc aria-1.0.0/src/gui_edit.cc
--- aria-1.0.0-old/src/gui_edit.cc 2001-11-28 16:28:40.000000000 +0100
+++ aria-1.0.0/src/gui_edit.cc 2006-05-09 19:10:43.626958652 +0200
@@ -326,7 +326,7 @@
static void Paste_md5_set(const string& md5Strings)
{
list<CRCList*> md5List;
- unsigned int index = 0;
+ string::size_type index = 0;
ListEntry *listentry = g_listManager->ret_Current_listentry();
@@ -334,14 +334,14 @@
string filenameString;
string md5String;
- unsigned int lf_pos, top_pos;
+ string::size_type lf_pos, top_pos;
if((lf_pos = md5Strings.find('\n', index)) == string::npos) {
lf_pos = md5Strings.size();
}
if((top_pos = md5Strings.find_first_not_of(" \t", index)) != string::npos
&& top_pos < lf_pos) {
index = lf_pos+1;
string md5EntryString = md5Strings.substr(top_pos, lf_pos);
- unsigned int start_pos, end_pos;
+ string::size_type start_pos, end_pos;
if((end_pos = md5EntryString.find_first_of(" \t")) == string::npos)
continue;
md5String = md5EntryString.substr(0, end_pos);
@@ -380,7 +380,7 @@
static void Paste_crc_set(const string& crc_strings)
{
list<CRCList*> crc_list;
- unsigned int index = 0;
+ string::size_type index = 0;
ListEntry *listentry = g_listManager->ret_Current_listentry();
@@ -388,14 +388,14 @@
string filename_entry;
string crc_string;
string size_string;
- unsigned int lf_pos, top_pos;
+ string::size_type lf_pos, top_pos;
if((lf_pos = crc_strings.find('\n', index)) == string::npos) {
lf_pos = crc_strings.size();
}
if((top_pos = crc_strings.find_first_not_of(" \t", index)) != string::npos
&& top_pos < lf_pos) {
index = lf_pos+1;
string crc_entry_string = crc_strings.substr(top_pos, lf_pos);
- unsigned int start_pos, end_pos;
+ string::size_type start_pos, end_pos;
if((end_pos = crc_entry_string.find_first_of(" \t")) == string::npos)
continue;
filename_entry = crc_entry_string.substr(0, end_pos);
if((start_pos = crc_entry_string.find_first_not_of(" \t", end_pos)) ==
string::npos) continue;
diff -ruN aria-1.0.0-old/src/gui_file_open_url.cc
aria-1.0.0/src/gui_file_open_url.cc
--- aria-1.0.0-old/src/gui_file_open_url.cc 2002-02-13 13:09:24.000000000
+0100
+++ aria-1.0.0/src/gui_file_open_url.cc 2006-05-09 19:10:43.626958652 +0200
@@ -58,7 +58,7 @@
if(stat(crcFilename.c_str(), &fileStat) == 0 && S_ISREG(fileStat.st_mode))
{
crcFlag = true;
} else {
- unsigned int ext_pos = filename.rfind('.');
+ string::size_type ext_pos = filename.rfind('.');
if(ext_pos != string::npos) {
crcFilename = filename.substr(0, ext_pos)+".crc";
if(stat(crcFilename.c_str(), &fileStat) == 0 &&
S_ISREG(fileStat.st_mode)) {
diff -ruN aria-1.0.0-old/src/main.cc aria-1.0.0/src/main.cc
--- aria-1.0.0-old/src/main.cc 2002-12-18 16:41:05.000000000 +0100
+++ aria-1.0.0/src/main.cc 2006-05-09 19:10:43.627958622 +0200
@@ -586,8 +586,8 @@
{
string arg = optarg;
// try {
- unsigned int loc_pos;
- unsigned int locsep_pos;
+ string::size_type loc_pos;
+ string::size_type locsep_pos;
if((loc_pos = arg.find('+')) == string::npos ||
loc_pos+1 == arg.size()) {
loc_pos = arg.size();
@@ -605,7 +605,7 @@
}
}
}
- unsigned int x_pos;
+ string::size_type x_pos;
if((x_pos = arg.find('x')) == string::npos ||
x_pos+1 == arg.size() ||
loc_pos == x_pos+1) {
diff -ruN aria-1.0.0-old/src/utils.cc aria-1.0.0/src/utils.cc
--- aria-1.0.0-old/src/utils.cc 2002-10-01 17:32:00.000000000 +0200
+++ aria-1.0.0/src/utils.cc 2006-05-09 19:10:43.627958622 +0200
@@ -23,23 +23,23 @@
string Remove_white(string nword)
{
//string nword = word;
- unsigned int first_pos = nword.find_first_not_of(" \t\r\n");
+ string::size_type first_pos = nword.find_first_not_of(" \t\r\n");
if(first_pos == string::npos) {
first_pos = nword.size();
}
nword.erase(0, first_pos);
- unsigned int last_pos = nword.find_last_not_of(" \t\r\n");
+ string::size_type last_pos = nword.find_last_not_of(" \t\r\n");
if(last_pos != string::npos) {
nword.erase(last_pos+1);
}
/*
- unsigned int first_pos = nword.find_first_not_of(" \t");
+ string::size_type first_pos = nword.find_first_not_of(" \t");
if(first_pos != string::npos) {
nword.erase(0, first_pos);
}
- unsigned int last_pos = nword.find_last_not_of(" \t\r");
+ string::size_type last_pos = nword.find_last_not_of(" \t\r");
if(last_pos != string::npos) {
nword.erase(last_pos+1);
}
@@ -50,17 +50,17 @@
string Token_splitter(string& line, const char *delimitors)
{
string token;
- unsigned int start_pos = line.find_first_not_of(" \t");
+ string::size_type start_pos = line.find_first_not_of(" \t");
if(start_pos == string::npos) {
line.erase();
return token;
}
- unsigned int end_pos = line.find_first_of(delimitors, start_pos);
+ string::size_type end_pos = line.find_first_of(delimitors, start_pos);
if(end_pos == string::npos) {
end_pos = line.size();
}
token = line.substr(start_pos, end_pos-start_pos);
- unsigned int erase_pos = line.find_first_not_of(delimitors, end_pos+1);
+ string::size_type erase_pos = line.find_first_not_of(delimitors, end_pos+1);
if(erase_pos == string::npos) {
line.erase();
} else {
@@ -262,7 +262,7 @@
string get_protocol_from_url(const string& base_url)
{
- unsigned int pos = base_url.find(':');
+ string::size_type pos = base_url.find(':');
if(pos != string::npos) {
return base_url.substr(0, pos);
} else {
@@ -277,7 +277,7 @@
return get_protocol_from_url(base_url)+"://"+
get_hostname(base_url)+target;
}
- unsigned int file_pos = target.find_last_of("/");
+ string::size_type file_pos = target.find_last_of("/");
string file;
if(file_pos != string::npos) {
file = target.substr(file_pos+1);
@@ -336,13 +336,13 @@
string get_hostname(string url)
{
erase_protocol(url);
- unsigned int slash_index = url.find('/');
+ string::size_type slash_index = url.find('/');
if(slash_index == string::npos) {
slash_index = url.size();
}
string host = url.substr(0, slash_index);
//url.erase(0, slash_index);
- unsigned int colon_index = host.rfind(':');
+ string::size_type colon_index = host.rfind(':');
if(colon_index != string::npos) {
//int port_temp = stoi(host.substr(colon_index+1), 10);
//if(port_temp != 0) port = port_temp;
@@ -353,7 +353,7 @@
string get_file(string& target)
{
- unsigned int file_pos = target.find_last_of("/");
+ string::size_type file_pos = target.find_last_of("/");
if(file_pos == string::npos) {
target.erase();
return target;
@@ -463,11 +463,11 @@
return date;
}
-unsigned int casefind(const string& string1, const string& string2)
+string::size_type casefind(const string& string1, const string& string2)
{
if(string1.size() < string2.size()) return string::npos;
- for(unsigned int index = 0; index < string1.size()-string2.size()+1;
++index) {
+ for(string::size_type index = 0; index < string1.size()-string2.size()+1;
++index) {
if(!strncasecmp(string1.substr(index).c_str(), string2.c_str(),
string2.size())) {
return index;
}
@@ -509,7 +509,7 @@
string insert_comma(const string& val_str)
{
- unsigned int pos = val_str.size();
+ string::size_type pos = val_str.size();
string ret_str;
while(pos > 3) {
ret_str = ','+val_str.substr(pos-3, 3)+ret_str;
@@ -546,7 +546,7 @@
string convert_tilde(const string& src_str)
{
string mod_str = src_str;
- unsigned int tilde_pos = src_str.rfind('~');
+ string::size_type tilde_pos = src_str.rfind('~');
if(tilde_pos != string::npos) {
mod_str.erase(tilde_pos, 1);
mod_str.insert(tilde_pos, "%7E");
@@ -573,7 +573,7 @@
}
string replaceSubstring(const string& srcStr, const string& oldSubstr, const
string& newSubstr) {
- unsigned int index = 0;
+ string::size_type index = 0;
string dstStr = srcStr;
while(1) {
if((index = dstStr.find(oldSubstr, index)) == string::npos) {
@@ -588,7 +588,7 @@
// remove control chars from a given string
string removeCtrlChar(const string& srcStr) {
string dstStr = srcStr;
- unsigned int index = 0;
+ string::size_type index = 0;
while(1) {
if((index = dstStr.find_first_of("\r\n", index)) == string::npos) {
return dstStr;
@@ -602,7 +602,7 @@
{
string retStr;
- unsigned int wcIndex = pattern.find_first_of("*?");
+ string::size_type wcIndex = pattern.find_first_of("*?");
if(wcIndex == string::npos) {
retStr = pattern;
pattern.erase();
@@ -623,7 +623,7 @@
bool patternMatch(string str, string pattern)
{
// wildcards: *, ?
- unsigned int sIndex = 0;
+ string::size_type sIndex = 0;
char wc = 0;
while(1) {
string subpattern = patternGetNextToken(pattern);
@@ -642,7 +642,7 @@
} else if(subpattern == "*") {
wc = '*';
} else {
- unsigned int searchSize;
+ string::size_type searchSize;
if(wc) {
if(str.size() < sIndex) {
return false;
@@ -655,7 +655,7 @@
}
// cerr << sIndex << ", " << searchSize << endl;
// cerr << str.substr(sIndex, searchSize) << endl;
- unsigned int index = casefind(str.substr(sIndex, searchSize),
subpattern);
+ string::size_type index = casefind(str.substr(sIndex, searchSize),
subpattern);
if(index == string::npos) {
return false;
}
diff -ruN aria-1.0.0-old/src/utils.h aria-1.0.0/src/utils.h
--- aria-1.0.0-old/src/utils.h 2002-02-13 13:09:24.000000000 +0100
+++ aria-1.0.0/src/utils.h 2006-05-09 19:10:43.628958592 +0200
@@ -61,7 +61,7 @@
string get_hostname(string url);
string get_file(string& target);
string get_file_mod_date(const string& filename);
-unsigned int casefind(const string& string1, const string& string2);
+string::size_type casefind(const string& string1, const string& string2);
bool startwith(const string& string1, const string& string2);
bool casecomp(const string& string1, const string& string2);
bool startwith(const string& string1, const string& string2);