From c215e4f94be9fc1a76c9868a475862d68157c9a8 Mon Sep 17 00:00:00 2001 From: Pav Lucistnik Date: Sat, 16 Aug 2008 09:22:41 +0000 Subject: - Fix build with gcc42 - Backport bugfixes from vendor CVS Submitted by: Jeff Burchell --- news/nget/Makefile | 11 +- news/nget/files/patch-Changelog | 17 ++ news/nget/files/patch-aclocal.m4 | 82 ++++++++++ news/nget/files/patch-auto_map.h | 47 ++++++ news/nget/files/patch-cache.cc | 318 +++++++++++++++++++++++++++++++++++++ news/nget/files/patch-cache.h | 102 ++++++++++++ news/nget/files/patch-dupe_file.cc | 10 ++ news/nget/files/patch-grouplist.cc | 29 ++++ news/nget/files/patch-lite.h | 11 ++ news/nget/files/patch-misc.cc | 20 +++ news/nget/files/patch-myregex.cc | 10 ++ news/nget/files/patch-nget.cc | 22 +++ news/nget/files/patch-nrange.h | 10 ++ news/nget/files/patch-par.cc | 26 +++ news/nget/files/patch-path.cc | 10 ++ news/nget/files/patch-prot_nntp.cc | 63 ++++++++ news/nget/files/patch-status.cc | 10 ++ news/nget/files/patch-stlhelp.h | 11 ++ news/nget/files/patch-termstuff.cc | 89 +++++++++++ 19 files changed, 890 insertions(+), 8 deletions(-) create mode 100644 news/nget/files/patch-Changelog create mode 100644 news/nget/files/patch-aclocal.m4 create mode 100644 news/nget/files/patch-auto_map.h create mode 100644 news/nget/files/patch-cache.cc create mode 100644 news/nget/files/patch-cache.h create mode 100644 news/nget/files/patch-dupe_file.cc create mode 100644 news/nget/files/patch-grouplist.cc create mode 100644 news/nget/files/patch-lite.h create mode 100644 news/nget/files/patch-misc.cc create mode 100644 news/nget/files/patch-myregex.cc create mode 100644 news/nget/files/patch-nget.cc create mode 100644 news/nget/files/patch-nrange.h create mode 100644 news/nget/files/patch-par.cc create mode 100644 news/nget/files/patch-path.cc create mode 100644 news/nget/files/patch-prot_nntp.cc create mode 100644 news/nget/files/patch-status.cc create mode 100644 news/nget/files/patch-stlhelp.h create mode 100644 news/nget/files/patch-termstuff.cc (limited to 'news') diff --git a/news/nget/Makefile b/news/nget/Makefile index 4f0f8771c589..4f8e76bb4ddb 100644 --- a/news/nget/Makefile +++ b/news/nget/Makefile @@ -7,6 +7,7 @@ PORTNAME= nget PORTVERSION= 0.27.1 +PORTREVISION= 1 CATEGORIES= news MASTER_SITES= ${MASTER_SITE_SOURCEFORGE} MASTER_SITE_SUBDIR= nget @@ -17,16 +18,10 @@ COMMENT= Auto-resuming command line nntp file grabber MAN1= nget.1 ngetlite.1 MANCOMPRESSED= no -GNU_CONFIGURE= yes +USE_AUTOTOOLS= autoconf:261 CONFIGURE_TARGET=--build=${MACHINE_ARCH}-portbld-freebsd${OSREL} USE_GMAKE= yes -.include - -.if ${OSVERSION} >= 700042 -BROKEN= Broken with gcc 4.2 -.endif - post-extract: ${LN} -s nget-${PORTVERSION} ${WRKDIR}/${DISTNAME} @@ -46,4 +41,4 @@ post-install: .endfor .endif -.include +.include diff --git a/news/nget/files/patch-Changelog b/news/nget/files/patch-Changelog new file mode 100644 index 000000000000..f703d9418e47 --- /dev/null +++ b/news/nget/files/patch-Changelog @@ -0,0 +1,17 @@ +--- Changelog 2004-12-20 16:05:39.000000000 -0800 ++++ Changelog 2008-03-09 23:41:58.000000000 -0700 +@@ -1,3 +1,14 @@ ++2008-08-15 FreeBSD Port: ++ [Patches are taken from upstream CVS repository at :pserver:anonymous@nget.cvs.sourceforge.net:/cvsroot/nget ] ++ ++ * Reduce memory usage by using vectors rather than maps for some data structures that usually do not have many elements anyway. (Dieter Shirley) ++ * Use netbsd-style termcap for line clearing when available, fixes problems with progress lines getting overwritten on netbsd systems. (Frederick Bruckman, Matthew Mueller) ++ * Make autopar handle posts where someone has created par2 for a large file, then split the file into parts named .. (Steven Mueller, Matthew Mueller) ++ * Fix compile with GCC 4.2. ++ * Fix some compile warnings. (Frederick Bruckman, Matthew Mueller) ++ * Fix compile with GCC 4.3. (Arnaud Cornet) ++ * Add support for SVR4 curses. (Frederick Bruckman) ++ + 2004-12-20 v0.27.1: + * Fix error in configure script when printing exceptions not found message, due to unquoted string. (Reported by M.J. Soft) + * Fix -G* when NGETCACHE != NGETHOME. (Reported by Steven Adeff) diff --git a/news/nget/files/patch-aclocal.m4 b/news/nget/files/patch-aclocal.m4 new file mode 100644 index 000000000000..2fa7fcd4cc2b --- /dev/null +++ b/news/nget/files/patch-aclocal.m4 @@ -0,0 +1,82 @@ +--- aclocal.m4 2004-12-20 12:44:09.000000000 -0800 ++++ aclocal.m4 2008-03-02 23:38:19.000000000 -0800 +@@ -49,25 +49,33 @@ + ) + + AC_DEFUN(MY_CHECK_FOMIT_FRAME_POINTER,[ +- AC_MSG_CHECKING([attempted use of -fomit-frame-pointer on x86]) ++ AC_MSG_CHECKING([for improper use of -fomit-frame-pointer]) + result=no +- if echo "$CXX $CXXFLAGS" | grep fomit-frame-pointer ; then ++ if echo "$CXX $CXXFLAGS" | grep fomit-frame-pointer > /dev/null ; then + if test -n "$host_alias" ; then + my_host="$host_alias" + else + my_host=`uname -m` + fi +- if echo "$my_host" | grep 86 ; then +- AC_MSG_WARN([cannot build with -fomit-frame-pointer on x86. +-gcc does not handle exceptions properly in code compiled with ++ if echo "$my_host" | grep 86 > /dev/null ; then ++ if test "$GXX" = "yes"; then ++ case `$CXX -dumpversion` in ++ [ ++ [012].* | 3.[012]* | 3.3 | 3.3.0* ) ++ ]dnl quote the tests with []'s to prevent m4 from eating the []'s in the tests. ++ AC_MSG_WARN([cannot build with -fomit-frame-pointer on x86. ++Old versions of gcc do not handle exceptions properly in code compiled with + -fomit-frame-pointer on x86 platforms. See: + http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=2447&database=gcc + + Removing -fomit-frame-pointer from the compiler flags. + ]) +- CXX=`echo $CXX | sed "s/-fomit-frame-pointer//"` +- CXXFLAGS=`echo $CXXFLAGS | sed "s/-fomit-frame-pointer//"` +- result=removed ++ CXX=`echo $CXX | sed "s/-fomit-frame-pointer//"` ++ CXXFLAGS=`echo $CXXFLAGS | sed "s/-fomit-frame-pointer//"` ++ result=removed ++ ;; ++ esac ++ fi + fi + fi + AC_MSG_RESULT($result) +@@ -138,12 +146,31 @@ + AC_DEFINE(HAVE_[]translit([$1], [a-z], [A-Z]),1,[Do we have $5?])])dnl + ]) + +-AC_DEFUN([MY_CHECK_TERMSTUFF],[MY_SEARCH_LIBS(working_termstuff, +-[#include +-#include ], +-[tputs(clr_bol, 1, putchar);], +-[termcap curses ncurses], +-[a working term.h, tputs, and clr_bol]) ++AC_DEFUN([MY_CHECK_TERMSTUFF],[ ++ MY_SEARCH_LIBS(netbsd_curses, ++ [#include ], ++ [struct tinfo *info; ++ char *term="foo"; ++ int res = t_getent(&info, term);], ++ [termcap], ++ [netbsd-style termcap]) ++ if test "$my_cv_netbsd_curses" = no ; then ++ MY_SEARCH_LIBS(new_curses, ++ [#include ++ #include ], ++ [int res = tputs(clr_bol, 1, putchar);], ++ [termcap curses ncurses], ++ [new curses terminfo]) ++ fi ++ if test "$my_cv_netbsd_curses" = no -a "$my_cv_new_curses" = no ; then ++ MY_SEARCH_LIBS(old_curses, ++ [#include ++ #include ], ++ [setupterm((char *)0, 1, (int *)0); ++ int res = putp(clr_bol);], ++ [curses], ++ [sysv terminfo]) ++ fi + ]) + + AC_DEFUN([MY_CHECK_SOCKET],[MY_SEARCH_LIBS(socket, diff --git a/news/nget/files/patch-auto_map.h b/news/nget/files/patch-auto_map.h new file mode 100644 index 000000000000..b61c670ef7c3 --- /dev/null +++ b/news/nget/files/patch-auto_map.h @@ -0,0 +1,47 @@ +--- auto_map.h 2004-06-17 14:00:33.000000000 -0700 ++++ auto_map.h 2008-03-09 23:52:28.000000000 -0700 +@@ -23,10 +23,10 @@ + #include + #include + +-template class Base> +-class auto_map_base : public Base > { ++template ++class auto_map_base : public Base { + protected: +- typedef Base > super; ++ typedef Base super; + public: + typedef typename super::iterator iterator; + +@@ -55,9 +55,9 @@ + + + template +-class auto_map : public auto_map_base { ++class auto_map : public auto_map_base > > { + public: +- typedef typename auto_map_base::super super; ++ typedef typename auto_map_base > >::super super; + typedef typename super::iterator iterator; + typedef typename super::value_type value_type; + /*super::value_type value_type(const K &k, T*p) { +@@ -68,15 +68,15 @@ + return super::insert(v); + }*/ + std::pair insert_value(const K &k, T* p) { //we can't really use the normal insert funcs, but we don't want to just name it insert since it would be easy to confuse with all the normal map insert funcs +- assert(find(k)==this->end()); ++ assert(this->find(k)==this->end()); + return super::insert(value_type(k, restricted_ptr(p))); + } + }; + + template +-class auto_multimap : public auto_map_base { ++class auto_multimap : public auto_map_base > > { + public: +- typedef typename auto_map_base::super super; ++ typedef typename auto_map_base > >::super super; + typedef typename super::iterator iterator; + typedef typename super::value_type value_type; + iterator insert_value(const K &k, T* p) { //we can't really use the normal insert funcs, but we don't want to just name it insert since it would be easy to confuse with all the normal map insert funcs diff --git a/news/nget/files/patch-cache.cc b/news/nget/files/patch-cache.cc new file mode 100644 index 000000000000..9111119206cb --- /dev/null +++ b/news/nget/files/patch-cache.cc @@ -0,0 +1,318 @@ +--- cache.cc 2004-05-29 16:00:05.000000000 -0700 ++++ cache.cc 2005-09-22 22:37:43.000000000 -0700 +@@ -133,37 +133,63 @@ + c_nntp_server_article *sa; + #ifndef NDEBUG + if (debug>=DEBUG_MIN){ +- t_nntp_server_articles::iterator sai=articles.find(h->serverid); +- if (sai!=articles.end()){ +- sa=(*sai).second; +- printf("adding server_article we already have %lu %lu %lu %lu(%lu %lu %lu %lu)\n",h->serverid,h->articlenum,h->bytes,h->lines,sa->serverid,sa->articlenum,sa->bytes,sa->lines); +- // return;//could be useful, lets add it. ++ t_nntp_server_articles::iterator sai=articles.begin(); ++ for (;sai!=articles.end();++sai){ ++ if ((*sai)->serverid == h->serverid) ++ { ++ sa=(*sai); ++ printf("adding server_article we already have %lu %lu %lu %lu(%lu %lu %lu %lu)\n",h->serverid,h->articlenum,h->bytes,h->lines,sa->serverid,sa->articlenum,sa->bytes,sa->lines); ++ // return;//could be useful, lets add it. ++ } + } + } + if (h->date!=date) + printf("adding server_article with different date, date=%li h->date=%li mid=%s\n",date,h->date,h->messageid.c_str()); + #endif + sa=new c_nntp_server_article(h->serverid,h->group,h->articlenum,h->bytes,h->lines); +- articles.insert(t_nntp_server_articles::value_type(h->serverid,sa)); ++ articles.push_back(sa); + } + + c_nntp_part::~c_nntp_part(){ + t_nntp_server_articles::iterator i; + for(i = articles.begin();i!=articles.end();++i){ +- assert((*i).second); +- delete (*i).second; ++ assert(*i); ++ delete (*i); ++ } ++} ++ ++c_nntp_file_parts::iterator c_nntp_file_parts::lower_bound(int partnum) ++{ ++ iterator first = begin(); ++ ptrdiff_t len = distance(begin(), end()); ++ ptrdiff_t half; ++ iterator middle; ++ ++ while (len > 0) { ++ half = len >> 1; ++ middle = first; ++ advance(middle, half); ++ ++ if ((*middle)->partnum < partnum) { ++ first = middle; ++ ++first; ++ len = len - half - 1; ++ } ++ else ++ len = half; + } ++ return first; + } + ++ + void c_nntp_file::addpart(c_nntp_part *p){ + assert(p); + //assert((req==-1 && p->partnum<=0) || (p->partnum<=req));//#### req==-1 hack for old version that set non-multipart messages partnum to 0 instead of -1 + // parts[p->partnum]=p; + #ifndef NDEBUG +- t_nntp_file_parts::iterator nfpi=parts.find(p->partnum); +- assert(nfpi==parts.end()); ++ assert(!parts.haspart(p->partnum)); + #endif +- parts.insert(t_nntp_file_parts::value_type(p->partnum,p)); ++ parts.addpart(p); + if (count_partnum(p->partnum, req)) have++; + // bytes+=p->apxbytes;lines+=p->apxlines; + } +@@ -175,43 +201,41 @@ + void c_nntp_file::mergefile(c_nntp_file::ptr &f){ + if (f->update>update) + update=f->update; +- t_nntp_file_parts::iterator fpi=f->parts.begin(); ++ c_nntp_file_parts::iterator fpi=f->parts.begin(); + while (fpi!=f->parts.end()){ +- const c_nntp_part *p = fpi->second; +- t_nntp_file_parts::iterator nfpi=parts.find(p->partnum); +- if (nfpi==parts.end()) { ++ const c_nntp_part *p = (*fpi); ++ c_nntp_part* mp = parts.part(p->partnum); ++ if (mp == NULL) { + addpart(new c_nntp_part(p->partnum, p->date, p->messageid)); +- nfpi=parts.find(p->partnum); ++ mp=parts.part(p->partnum); + }else{ +- if (nfpi->second->messageid!=p->messageid){ +- PDEBUG(DEBUG_MED,"%s was gonna merge, but already have this part(sub=%s part=%i omid=%s)?\n",p->messageid.c_str(),f->subject.c_str(),p->partnum,nfpi->second->messageid.c_str()); ++ if (mp->messageid!=p->messageid){ ++ PDEBUG(DEBUG_MED,"%s was gonna merge, but already have this part(sub=%s part=%i omid=%s)?\n",p->messageid.c_str(),f->subject.c_str(),p->partnum,mp->messageid.c_str()); + ++fpi; + continue; + } + } + for (t_nntp_server_articles::const_iterator fsai=p->articles.begin(); fsai!=p->articles.end(); ++fsai){ + +- c_nntp_server_article *nsa = new c_nntp_server_article(*fsai->second); +- nfpi->second->articles.insert(t_nntp_server_articles::value_type(nsa->serverid,nsa)); ++ c_nntp_server_article *nsa = new c_nntp_server_article(**fsai); ++ mp->articles.push_back(nsa); + } +- t_nntp_file_parts::iterator del_pi = fpi; +- ++fpi; +- delete del_pi->second; +- f->parts.erase(del_pi); ++ delete (*fpi); ++ fpi = f->parts.erase(fpi); + } + } + + //fill a mapping of how many parts of the file each server has + void c_nntp_file::get_server_have_map(t_server_have_map &have_map) const{ +- t_nntp_file_parts::const_iterator pi(parts.begin()); ++ c_nntp_file_parts::const_iterator pi(parts.begin()); + for (;pi!=parts.end();++pi){ +- t_nntp_server_articles::const_iterator nsai(pi->second->articles.begin()); ++ t_nntp_server_articles::const_iterator nsai((*pi)->articles.begin()); + ulong serverid; +- int partnum=pi->second->partnum; ++ int partnum=(*pi)->partnum; + set servers_already_found; + +- for (;nsai!=pi->second->articles.end();++nsai) { +- serverid=nsai->first; ++ for (;nsai!=(*pi)->articles.end();++nsai) { ++ serverid=(*nsai)->serverid; + //don't increment count twice if a server has multiple server_articles for a single part + if (servers_already_found.insert(serverid).second){ + t_server_have_map::iterator hmi(have_map.insert(t_server_have_map::value_type(serverid, 0)).first); +@@ -230,10 +254,10 @@ + } + + c_nntp_file::~c_nntp_file(){ +- t_nntp_file_parts::iterator i; ++ c_nntp_file_parts::iterator i; + for(i = parts.begin();i!=parts.end();++i){ +- assert((*i).second); +- delete (*i).second; ++ assert(*i); ++ delete (*i); + } + } + +@@ -323,9 +347,8 @@ + for (i=irange.first;i!=irange.second;++i){ + f=(*i).second; + assert(!f.isnull()); +- t_nntp_file_parts::iterator op; +- if ((op=f->parts.find(h->partnum))!=f->parts.end()){ +- c_nntp_part *matchpart=(*op).second; ++ c_nntp_part* matchpart = f->parts.part(h->partnum); ++ if (matchpart != NULL) { + if (matchpart->messageid==h->messageid){ + matchpart->addserverarticle(h); + return 0; +@@ -357,23 +380,22 @@ + void c_nntp_cache::getxrange(c_nntp_server_info *servinfo, c_nrange *range) const { + t_nntp_files::const_iterator i; + c_nntp_file::ptr nf; +- t_nntp_file_parts::const_iterator pi; ++ c_nntp_file_parts::const_iterator pi; + c_nntp_part *np; + pair sarange; +- c_nntp_server_article *sa; + for(i = files.begin();i!=files.end();++i){ + nf=(*i).second; + assert(!nf.isnull()); + assert(!nf->parts.empty()); + for(pi = nf->parts.begin();pi!=nf->parts.end();++pi){ +- np=(*pi).second; ++ np=(*pi); + assert(np); +- sarange=np->articles.equal_range(servinfo->serverid); +- while (sarange.first!=sarange.second){ +- sa=(*sarange.first).second; +- assert(sa); +- range->remove(sa->articlenum); +- ++sarange.first; ++ t_nntp_server_articles::const_iterator sai = np->articles.begin(); ++ for (; sai != np->articles.end(); ++sai){ ++ if ((*sai)->serverid == servinfo->serverid) ++ { ++ range->remove((*sai)->articlenum); ++ } + } + } + } +@@ -390,9 +412,8 @@ + ulong count=0,countp=0,countf=0; + t_nntp_files::iterator i,in; + c_nntp_file::ptr nf; +- t_nntp_file_parts::iterator pi,pic; ++ c_nntp_file_parts::iterator pi; + c_nntp_part *np; +- pair sarange; + t_nntp_server_articles::iterator sai; + c_nntp_server_article *sa; + c_mid_info rel_midinfo(""); +@@ -408,32 +429,31 @@ + nf=(*i).second; + assert(!nf.isnull()); + assert(!nf->parts.empty()); +- for(pi = nf->parts.begin();pi!=nf->parts.end();){ +- pic=pi; +- ++pi; +- np=(*pic).second; ++ for(pi = nf->parts.end();pi!=nf->parts.begin();){ ++ --pi; ++ np=(*pi); + assert(np); +- sarange=np->articles.equal_range(servinfo->serverid); +- while (sarange.first!=sarange.second){ +- sai=sarange.first; +- ++sarange.first; +- sa=(*sai).second; ++ for (sai = np->articles.end(); sai != np->articles.begin();) { ++ --sai; ++ sa=*sai; + assert(sa); +- if (flushrange.check(sa->articlenum)){ ++ if ((sa->serverid == servinfo->serverid) && flushrange.check(sa->articlenum)){ + delete sa; +- np->articles.erase(sai); +- if (np->articles.empty()){ +- if (count_partnum(np->partnum,nf->req)) nf->have--; +- midinfo->set_delete(np->messageid); +- delete np; +- np=NULL; +- nf->parts.erase(pic); +- countp++; +- } ++ sai = np->articles.erase(sai); + count++; + } + } +- if (np && midinfo->check(np->messageid)) rel_midinfo.insert(np->messageid); ++ if (np->articles.empty()){ ++ if (count_partnum(np->partnum,nf->req)) nf->have--; ++ midinfo->set_delete(np->messageid); ++ delete np; ++ pi = nf->parts.erase(pi); ++ countp++; ++ } ++ else if (midinfo->check(np->messageid)) ++ { ++ rel_midinfo.insert(np->messageid); ++ } + } + if (nf->parts.empty()){ + // nf->dec_rcount(); +@@ -453,12 +473,13 @@ + assert(!nf.isnull()); + assert(!nf->parts.empty()); + for(pi = nf->parts.begin();pi!=nf->parts.end();++pi){ +- np=(*pi).second; ++ np=(*pi); + assert(np); +- sai=np->articles.find(servinfo->serverid); +- if (sai!=np->articles.end()){ +- sa=(*sai).second; +- assert(!flushrange.check(sa->articlenum)); ++ for (sai=np->articles.begin(); sai != np->articles.end(); ++sai){ ++ sa=*sai; ++ if (sa->serverid == servinfo->serverid){ ++ assert(!flushrange.check(sa->articlenum)); ++ } + } + } + } +@@ -604,7 +625,7 @@ + if (nconfig.hasserver(serverid)) { + sa=new c_nntp_server_article(serverid,group,atoul(t[1]),atoul(t[2]),atoul(t[3])); + //np->addserverarticle(sa); +- np->articles.insert(t_nntp_server_articles::value_type(sa->serverid,sa)); ++ np->articles.push_back(sa); + counta++; + }else + countdeada++; +@@ -617,7 +638,7 @@ + else if (mode==PART_MODE && nf){//new part mode + if (np && np->articles.empty()) { + midinfo->set_delete(np->messageid); +- nf->parts.erase(np->partnum); ++ nf->parts.removepart(np->partnum); + delete np; + np=NULL; + count--; +@@ -734,7 +755,7 @@ + if (quiet<2){printf("saving cache: %lu parts, %lu files..",totalnum,(ulong)files.size());fflush(stdout);} + c_nntp_file::ptr nf; + t_references::iterator ri; +- t_nntp_file_parts::iterator pi; ++ c_nntp_file_parts::iterator pi; + t_nntp_server_articles::iterator sai; + c_nntp_server_article *sa; + c_nntp_part *np; +@@ -758,11 +779,11 @@ + } + f->putf(".\n");//end REFERENCES_MODE + for(pi = nf->parts.begin();pi!=nf->parts.end();++pi){ +- np=(*pi).second; ++ np=(*pi); + assert(np); + f->putf("%i\t%lu\t%s\n",np->partnum,np->date,np->messageid.c_str());//PART_MODE + for (sai = np->articles.begin(); sai != np->articles.end(); ++sai){ +- sa=(*sai).second; ++ sa=(*sai); + assert(sa); + f->putf("%lu\t%lu\t%lu\t%lu\n",sa->serverid,sa->articlenum,sa->bytes,sa->lines);//SERVER_ARTICLE_MODE + counta++; diff --git a/news/nget/files/patch-cache.h b/news/nget/files/patch-cache.h new file mode 100644 index 000000000000..f498837ba81a --- /dev/null +++ b/news/nget/files/patch-cache.h @@ -0,0 +1,102 @@ +--- cache.h 2004-05-29 16:00:08.000000000 -0700 ++++ cache.h 2005-09-22 22:37:43.000000000 -0700 +@@ -102,7 +102,7 @@ + ulong bytes,lines; + c_nntp_server_article(ulong serverid,const c_group_info::ptr &group,ulong articlenum,ulong bytes,ulong lines); + }; +-typedef multimap t_nntp_server_articles; ++typedef vector t_nntp_server_articles; + typedef pair t_real_server_article; + typedef multimap > t_nntp_server_articles_prioritized; + class c_nntp_part { +@@ -118,7 +118,7 @@ + c_nntp_server_article *highest_sa=NULL; + float highprio=-10000.0,f; + for (;nsai!=articles.end();++nsai) { +- sa=(*nsai).second; ++ sa=(*nsai); + for (t_server_list_range servers = nconfig.getservers(sa->serverid); servers.first!=servers.second; ++servers.first) + if ((f=nconfig.trustsizes->getserverpriority(servers.first->second)) > highprio){ + highest_sa=sa; +@@ -137,7 +137,41 @@ + }; + + +-typedef map t_nntp_file_parts; ++class c_nntp_file_parts : public vector ++{ ++public: ++ bool haspart(int partnum) const { ++ const_iterator i = lower_bound(partnum); ++ return (i != end() && (*i)->partnum == partnum); ++ } ++ ++ c_nntp_part* part(int partnum) { ++ iterator i = lower_bound(partnum); ++ if (i != end() && (*i)->partnum == partnum) ++ return *i; ++ else ++ return NULL; ++ } ++ ++ void addpart(c_nntp_part* p) { ++ iterator i = lower_bound(p->partnum); ++ insert(i, p); ++ } ++ ++ void removepart(int partnum) { ++ iterator i = lower_bound(partnum); ++ if (i != end() && (*i)->partnum == partnum) ++ erase(i); ++ } ++ ++private: ++ iterator lower_bound(int partnum); ++ ++ const_iterator lower_bound(int partnum) const ++ { ++ return ((c_nntp_file_parts*)this)->lower_bound(partnum); ++ } ++}; + + //#define FILEFLAG_READ 1 + +@@ -145,7 +179,7 @@ + + class c_nntp_file : public c_nntp_file_base, public c_refcounted{ + public: +- t_nntp_file_parts parts; ++ c_nntp_file_parts parts; + int have; + // ulong bytes,lines; + ulong flags; +@@ -161,13 +195,13 @@ + bool iscomplete(void) const {return (have>=req) || maybe_a_textreply();} + void get_server_have_map(t_server_have_map &have_map) const; + // ulong banum(void){assert(!parts.empty());return (*parts.begin()).second->articlenum;} +- string bamid(void) const {assert(!parts.empty());return (*parts.begin()).second->messageid;} +- time_t badate(void) const {assert(!parts.empty());return (*parts.begin()).second->date;} ++ string bamid(void) const {assert(!parts.empty());return (*parts.begin())->messageid;} ++ time_t badate(void) const {assert(!parts.empty());return (*parts.begin())->date;} + #define HAPPYSIZEFUNC2(T) ulong T(void) const {\ + ulong b=0;\ +- t_nntp_file_parts::const_iterator nfpi(parts.begin());\ ++ c_nntp_file_parts::const_iterator nfpi(parts.begin());\ + for (;nfpi!=parts.end();++nfpi){\ +- b+=(*nfpi).second->T();\ ++ b+=(*nfpi)->T();\ + }\ + return b;\ + } +@@ -311,9 +345,9 @@ + } + void insert(const c_nntp_file::ptr &f){ + const string &mid=f->bamid(); +- c_nntp_part *p = f->parts.begin()->second; ++ c_nntp_part *p = *(f->parts.begin()); + for (t_nntp_server_articles::iterator sai=p->articles.begin(); sai!=p->articles.end(); ++sai) +- midinfos.find(sai->second->group->group)->second->insert(mid); ++ midinfos.find((*sai)->group->group)->second->insert(mid); + } + void remove(const string &mid){ + for (t_mid_info_list::iterator mili=midinfos.begin(); mili!=midinfos.end(); ++mili) diff --git a/news/nget/files/patch-dupe_file.cc b/news/nget/files/patch-dupe_file.cc new file mode 100644 index 000000000000..ed57f51be70d --- /dev/null +++ b/news/nget/files/patch-dupe_file.cc @@ -0,0 +1,10 @@ +--- dupe_file.cc 2004-05-29 16:00:05.000000000 -0700 ++++ dupe_file.cc 2008-03-02 23:03:01.000000000 -0800 +@@ -25,6 +25,7 @@ + #include + #include + #include ++#include + + void dupe_file_checker::add(const char *filename, ulong size){ + file_match *fm; diff --git a/news/nget/files/patch-grouplist.cc b/news/nget/files/patch-grouplist.cc new file mode 100644 index 000000000000..dc60531ff590 --- /dev/null +++ b/news/nget/files/patch-grouplist.cc @@ -0,0 +1,29 @@ +--- grouplist.cc 2004-12-20 12:44:10.000000000 -0800 ++++ grouplist.cc 2008-03-02 22:53:39.000000000 -0800 +@@ -316,7 +316,7 @@ + return; + int nums=0, numsd=0, num=0, numd=0; + string tmpfn=filename+".tmp"; +- c_file *f=f=dofileopen(tmpfn,"wb"); ++ c_file *f=dofileopen(tmpfn,"wb"); + try { + auto_ptr fcloser(f); + if (debug){printf("saving grouplist: %lu groups..",(ulong)groups.size());fflush(stdout);} +@@ -330,7 +330,7 @@ + f->putf(".\n"); + for (gdi=groups.begin(); gdi!=groups.end(); ++gdi){ + gd=gdi->second; +- char *sep=""; ++ const char *sep=""; + for (set::iterator sii=gd->serverids.begin(); sii!=gd->serverids.end(); ++sii) { + f->putf("%s%lu", sep, *sii); + sep=","; +@@ -339,7 +339,7 @@ + f->putf("\t%s\n",gd->groupname.c_str()); + for (sgdi=gd->servergroups.begin(); sgdi!=gd->servergroups.end(); ++sgdi) { + c_server_group_description::ptr sgd = sgdi->second; +- char *sep=""; ++ const char *sep=""; + for (set::iterator sii=sgd->serverids.begin(); sii!=sgd->serverids.end(); ++sii) { + f->putf("%s%lu", sep, *sii); + sep=","; diff --git a/news/nget/files/patch-lite.h b/news/nget/files/patch-lite.h new file mode 100644 index 000000000000..508bfa633864 --- /dev/null +++ b/news/nget/files/patch-lite.h @@ -0,0 +1,11 @@ +--- lite.h 2004-05-29 16:00:08.000000000 -0700 ++++ lite.h 2008-03-02 23:03:01.000000000 -0800 +@@ -24,6 +24,8 @@ + #endif + + #include ++#include ++ + char * newstrcpy(char *&dest, const char *src); + inline void safefree(char *&p){ + if (p){free(p);p=NULL;} diff --git a/news/nget/files/patch-misc.cc b/news/nget/files/patch-misc.cc new file mode 100644 index 000000000000..19d03c7c4f1e --- /dev/null +++ b/news/nget/files/patch-misc.cc @@ -0,0 +1,20 @@ +--- misc.cc 2004-05-29 16:00:05.000000000 -0700 ++++ misc.cc 2008-03-02 22:53:40.000000000 -0800 +@@ -186,7 +186,7 @@ + // return timestr; + } + +-char *text_month[13]={"Jan", "Feb", "Mar", "Apr", ++const char *text_month[13]={"Jan", "Feb", "Mar", "Apr", + "May", "Jun", "Jul", "Aug", + "Sep", "Oct", "Nov", "Dec" + }; +@@ -251,7 +251,7 @@ + time_t decode_textdate(const char * cbuf, bool local){ + struct tm tblock; + memset(&tblock,0,sizeof(struct tm)); +- char *tdt=NULL; ++ const char *tdt=NULL; + int td_tz=local?0x7FFFFFFF:0; + int yearlen=0; + c_regex_subs rsubs; diff --git a/news/nget/files/patch-myregex.cc b/news/nget/files/patch-myregex.cc new file mode 100644 index 000000000000..cfa87dabc407 --- /dev/null +++ b/news/nget/files/patch-myregex.cc @@ -0,0 +1,10 @@ +--- myregex.cc 2004-05-29 16:00:06.000000000 -0700 ++++ myregex.cc 2008-03-02 23:03:02.000000000 -0800 +@@ -21,6 +21,7 @@ + #endif + #include + #include "myregex.h" ++#include + + + static string regex_match_word_beginning_safe_str; diff --git a/news/nget/files/patch-nget.cc b/news/nget/files/patch-nget.cc new file mode 100644 index 000000000000..6f86a456301a --- /dev/null +++ b/news/nget/files/patch-nget.cc @@ -0,0 +1,22 @@ +--- nget.cc 2005/01/03 22:04:44 1.135 ++++ nget.cc 2008/03/03 06:53:40 1.136 +@@ -93,8 +93,8 @@ + + struct opt_help { + int namelen; +- char *arg; +- char *desc; ++ const char *arg; ++ const char *desc; + }; + static opt_help ohelp[NUM_OPTIONS+1]; + static int olongestlen=0; +@@ -114,7 +114,7 @@ + OPT_MIN_SHORTNAME //sentinel, must be last element. + }; + +-static void addoption(char *longo,int needarg,char shorto,char *adesc,char *desc){ ++static void addoption(const char *longo,int needarg,char shorto,const char *adesc,const char *desc){ + static int cur=0; + assert(cur + #include + #include ++#include + + + typedef map t_rlist;//we are going to use high as the key, and low as the value diff --git a/news/nget/files/patch-par.cc b/news/nget/files/patch-par.cc new file mode 100644 index 000000000000..e1bafa05e3ab --- /dev/null +++ b/news/nget/files/patch-par.cc @@ -0,0 +1,26 @@ +--- par.cc 2004-05-29 16:00:06.000000000 -0700 ++++ par.cc 2005-10-20 20:25:31.000000000 -0700 +@@ -65,7 +65,9 @@ + + void LocalParFiles::addfrompath_par2(const string &path, t_nocase_map *nocase_map){ + c_regex_r parfile_re("^(.+)\\.par2(\\.[0-9]+\\.[0-9]+)?$", REG_EXTENDED|REG_ICASE); +- c_regex_r dupefile_re("^(.+)\\.[0-9]+\\.[0-9]+$"); ++ c_regex_r dupefile1_re("^(.+)\\.[0-9]+$"); ++ c_regex_r dupefile2_re("^(.+)\\.[0-9]+\\.[0-9]+$"); ++ c_regex_r dupefile3_re("^(.+)\\.[0-9]+\\.[0-9]+\\.[0-9]+$"); + static c_regex_r par2pxxre("^(.*).vol[0-9]+\\+[0-9]+$", REG_EXTENDED|REG_ICASE); + c_regex_subs rsubs; + DIR *dir=opendir(path.c_str()); +@@ -89,7 +91,11 @@ + } + if (nocase_map) { + if (strcmp(de->d_name,"..")!=0 && strcmp(de->d_name,".")!=0){ +- if (!dupefile_re.match(de->d_name, &rsubs)) //check for downloaded dupe files, and add them under their original name. ++ if (!dupefile1_re.match(de->d_name, &rsubs)) //check for downloaded dupe files, and add them under their original name. ++ add_to_nocase_map(nocase_map, rsubs.subs(1), de->d_name); ++ if (!dupefile2_re.match(de->d_name, &rsubs)) //check for downloaded dupe files, and add them under their original name. ++ add_to_nocase_map(nocase_map, rsubs.subs(1), de->d_name); ++ if (!dupefile3_re.match(de->d_name, &rsubs)) //check for downloaded dupe files, and add them under their original name. + add_to_nocase_map(nocase_map, rsubs.subs(1), de->d_name); + add_to_nocase_map(nocase_map, de->d_name, de->d_name); + } diff --git a/news/nget/files/patch-path.cc b/news/nget/files/patch-path.cc new file mode 100644 index 000000000000..60e050964936 --- /dev/null +++ b/news/nget/files/patch-path.cc @@ -0,0 +1,10 @@ +--- path.cc 2004-05-29 16:00:06.000000000 -0700 ++++ path.cc 2008-03-02 23:03:02.000000000 -0800 +@@ -21,6 +21,7 @@ + #include + #include "log.h" + #include "_fileconf.h" ++#include + + #ifdef WIN32 + #include diff --git a/news/nget/files/patch-prot_nntp.cc b/news/nget/files/patch-prot_nntp.cc new file mode 100644 index 000000000000..4feaa47aa000 --- /dev/null +++ b/news/nget/files/patch-prot_nntp.cc @@ -0,0 +1,63 @@ +--- prot_nntp.cc 2004-12-20 12:44:11.000000000 -0800 ++++ prot_nntp.cc 2008-03-02 22:53:40.000000000 -0800 +@@ -214,10 +214,9 @@ + *desc = '\0'; + desc++; + desc += strspn(desc, " \t"); +- }else +- desc = ""; ++ } + +- glist->addgroupdesc(connection->server->serverid, cbuf, desc); ++ glist->addgroupdesc(connection->server->serverid, cbuf, desc ? desc : ""); + done++; + } + if(quiet<2){ +@@ -810,7 +816,7 @@ + c_nntp_server_article *sa=NULL; + float prio; + for (sai = part->articles.begin(); sai != part->articles.end(); ++sai){ +- sa=(*sai).second; ++ sa=(*sai); + assert(sa); + for (t_server_list_range servers = nconfig.getservers(sa->serverid); servers.first!=servers.second; ++servers.first) { + const c_server::ptr &s = servers.first->second; +@@ -1012,7 +1018,7 @@ + + void print_nntp_file_info(c_nntp_file::ptr f, t_show_multiserver show_multi) { + char tconvbuf[TCONV_DEF_BUF_LEN]; +- c_nntp_part *p=(*f->parts.begin()).second; ++ c_nntp_part *p=(*f->parts.begin()); + tconv(tconvbuf,TCONV_DEF_BUF_LEN,&p->date); + if (f->iscomplete()) + printf("%i",f->have); +@@ -1161,7 +1167,7 @@ + qtotinfo.doarticle_show_multi=gcache_ismultiserver?SHOW_MULTI_SHORT:NO_SHOW_MULTI; + c_nntp_part *p; + // s_part_u *bp; +- t_nntp_file_parts::iterator curp; ++ c_nntp_file_parts::iterator curp; + char *fn; + if (!options.writelite.empty()) + optionflags |= GETFILES_NODECODE; +@@ -1202,7 +1208,7 @@ + Decoder decoder; + for(curp = f->parts.begin();curp!=f->parts.end();++curp){ + //asprintf(&fn,"%s/%s-%s-%li-%li-%li",nghome.c_str(),host.c_str(),group.c_str(),fgnum,part,num); +- p=(*curp).second; ++ p=(*curp); + if (dlerr){ + qtotinfo.bytesleft-=p->bytes(); + continue; +@@ -1213,9 +1219,9 @@ + usepath=""; + else usepath=fr->temppath.c_str(); + if (optionflags & GETFILES_TEMPSHORTNAMES) +- asprintf(&fn,"%s%lx.%03i",usepath,f->getfileid(),(*curp).first); ++ asprintf(&fn,"%s%lx.%03i",usepath,f->getfileid(),p->partnum); + else +- asprintf(&fn,"%sngettemp-%lx.%03i",usepath,f->getfileid(),(*curp).first); ++ asprintf(&fn,"%sngettemp-%lx.%03i",usepath,f->getfileid(),p->partnum); + } + if (!fexists(fn)){ + ainfo.partreq = f->req; diff --git a/news/nget/files/patch-status.cc b/news/nget/files/patch-status.cc new file mode 100644 index 000000000000..04d622f25a3d --- /dev/null +++ b/news/nget/files/patch-status.cc @@ -0,0 +1,10 @@ +--- status.cc 2004-05-29 16:00:06.000000000 -0700 ++++ status.cc 2008-03-02 23:03:02.000000000 -0800 +@@ -20,6 +20,7 @@ + #include "server.h" + #include + #include ++#include + + static int errorflags=0, warnflags=0, okflags=0; + diff --git a/news/nget/files/patch-stlhelp.h b/news/nget/files/patch-stlhelp.h new file mode 100644 index 000000000000..55f06725fa01 --- /dev/null +++ b/news/nget/files/patch-stlhelp.h @@ -0,0 +1,11 @@ +--- stlhelp.h 2004-05-29 16:00:08.000000000 -0700 ++++ stlhelp.h 2008-03-02 23:03:02.000000000 -0800 +@@ -19,6 +19,8 @@ + #ifndef _STLHELP_H_ + #define _STLHELP_H_ + ++#include ++ + struct eqstr + { + bool operator()(const char* s1, const char* s2) const diff --git a/news/nget/files/patch-termstuff.cc b/news/nget/files/patch-termstuff.cc new file mode 100644 index 000000000000..a47ae6523664 --- /dev/null +++ b/news/nget/files/patch-termstuff.cc @@ -0,0 +1,89 @@ +--- termstuff.cc 2004-05-29 16:00:07.000000000 -0700 ++++ termstuff.cc 2008-03-02 23:38:19.000000000 -0800 +@@ -23,7 +23,15 @@ + #include + #include + +-#ifdef HAVE_WORKING_TERMSTUFF ++#ifdef HAVE_NETBSD_CURSES ++#include ++static struct tinfo *info; ++static char *clr_bol; ++static void my_putchar(char c, void *d) { putchar((int)c); } ++#elif HAVE_NEW_CURSES ++#include ++#elif HAVE_OLD_CURSES ++#include + #include + #endif + +@@ -32,15 +40,22 @@ + //Fake clr_bol function incase we can't use termcap. Assumes that we will be + //writing another line of near the same length after clearing, thus we don't + //really need to clear the whole line, only the end of it. +-void generic_clr_bol(void) { ++static void generic_clr_bol(void) { + printf("\b\b\b\b "); + } + +-voidfunc *clr_bol_func = generic_clr_bol; ++static voidfunc *clr_bol_func = generic_clr_bol; + +-#ifdef HAVE_WORKING_TERMSTUFF +-void tputs_clr_bol(void) { +- if (tputs(clr_bol, 1, putchar)<0) { ++#if defined(HAVE_NETBSD_CURSES) || defined(HAVE_NEW_CURSES) || defined(HAVE_OLD_CURSES) ++static void tputs_clr_bol(void) { ++# ifdef HAVE_NETBSD_CURSES ++ if (t_puts(info, clr_bol, 1, my_putchar, NULL)<0) ++# elif HAVE_NEW_CURSES ++ if (tputs(clr_bol, 1, putchar)<0) ++# elif HAVE_OLD_CURSES ++ if (putp(clr_bol)<0) ++# endif ++ { + generic_clr_bol(); + PDEBUG(DEBUG_MIN, "tputs_clr_bol: error"); + } +@@ -48,18 +63,38 @@ + #endif + + void init_term_stuff(void) { +-#ifdef HAVE_WORKING_TERMSTUFF ++#if defined(HAVE_NETBSD_CURSES) || defined(HAVE_NEW_CURSES) || defined(HAVE_OLD_CURSES) ++# ifdef HAVE_NEW_CURSES + char tbuf[1024]; ++# elif HAVE_OLD_CURSES ++ int err; ++# endif + char *term = getenv("TERM"); + if (!term){ + PDEBUG(DEBUG_MIN, "init_term_stuff: TERM env not set"); + return; + } +- if (tgetent(tbuf, term) != 1){ ++# ifdef HAVE_NETBSD_CURSES ++ if (t_getent(&info, term) != 1) { ++ PDEBUG(DEBUG_MIN, "init_term_stuff: t_getent failure"); ++ return; ++ } ++ if (!(clr_bol = t_agetstr(info, "ce"))) { ++ PDEBUG(DEBUG_MIN, "init_term_stuff: t_agetstr failure"); ++ return; ++ } ++# elif HAVE_NEW_CURSES ++ if (tgetent(tbuf, term) != 1) { + PDEBUG(DEBUG_MIN, "init_term_stuff: tgetent failure"); +-// err(2, "tgetent failure"); + return; + } ++# else /* HAVE_OLD_CURSES */ ++ setupterm(term, 1, &err); ++ if (err != 1) { ++ PDEBUG(DEBUG_MIN, "init_term_stuff: setupterm failure"); ++ return; ++ } ++# endif + clr_bol_func = tputs_clr_bol; + PDEBUG(DEBUG_MIN, "init_term_stuff: using tputs_clr_bol"); + #else -- cgit v1.2.3