From 67c3067f1a615fd6ff0b332c2a526d052442913d Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Tue, 25 Feb 2014 22:22:41 +0100 Subject: fix -Wmissing-field-initializers warnings Reported-By: gcc Git-Dch: Ignore --- methods/ftp.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'methods') diff --git a/methods/ftp.cc b/methods/ftp.cc index 621f48476..5a87ded1c 100644 --- a/methods/ftp.cc +++ b/methods/ftp.cc @@ -56,9 +56,9 @@ struct AFMap }; #ifndef AF_INET6 -struct AFMap AFMap[] = {{AF_INET,1},{}}; +struct AFMap AFMap[] = {{AF_INET,1},{0, 0}}; #else -struct AFMap AFMap[] = {{AF_INET,1},{AF_INET6,2},{}}; +struct AFMap AFMap[] = {{AF_INET,1},{AF_INET6,2},{0, 0}}; #endif unsigned long TimeOut = 120; -- cgit v1.2.3 From 6298ff8b6492e2071a8f2ca7669a3aeef0fb29c7 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Tue, 25 Feb 2014 22:30:39 +0100 Subject: fix -Wformat= warnings about size_t != %lu on e.g. armel Git-Dch: Ignore Reported-By: gcc --- methods/rred.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'methods') diff --git a/methods/rred.cc b/methods/rred.cc index fe7ef7322..7169fc731 100644 --- a/methods/rred.cc +++ b/methods/rred.cc @@ -469,7 +469,7 @@ class Patch { void write_diff(FILE *f) { - size_t line = 0; + unsigned long long line = 0; std::list::reverse_iterator ch; for (ch = filechanges.rbegin(); ch != filechanges.rend(); ++ch) { line += ch->offset + ch->del_cnt; @@ -482,11 +482,11 @@ class Patch { line -= ch->del_cnt; if (ch->add_cnt > 0) { if (ch->del_cnt == 0) { - fprintf(f, "%lua\n", line); + fprintf(f, "%llua\n", line); } else if (ch->del_cnt == 1) { - fprintf(f, "%luc\n", line+1); + fprintf(f, "%lluc\n", line+1); } else { - fprintf(f, "%lu,%luc\n", line+1, line+ch->del_cnt); + fprintf(f, "%llu,%lluc\n", line+1, line+ch->del_cnt); } mg_i = ch; @@ -496,9 +496,9 @@ class Patch { fprintf(f, ".\n"); } else if (ch->del_cnt == 1) { - fprintf(f, "%lud\n", line+1); + fprintf(f, "%llud\n", line+1); } else if (ch->del_cnt > 1) { - fprintf(f, "%lu,%lud\n", line+1, line+ch->del_cnt); + fprintf(f, "%llu,%llud\n", line+1, line+ch->del_cnt); } line -= ch->offset; } -- cgit v1.2.3 From d3e8fbb395f57954acd7a2095f02ce530a05ec6a Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Thu, 27 Feb 2014 01:20:53 +0100 Subject: =?UTF-8?q?warning:=20extra=20=E2=80=98;=E2=80=99=20[-Wpedantic]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Git-Dch: Ignore Reported-By: gcc -Wpedantic --- methods/cdrom.cc | 2 +- methods/http.cc | 6 +++--- methods/https.cc | 2 +- methods/mirror.cc | 28 ++++++++++++++-------------- methods/rsh.cc | 2 +- methods/server.cc | 20 ++++++++++---------- methods/server.h | 2 +- 7 files changed, 31 insertions(+), 31 deletions(-) (limited to 'methods') diff --git a/methods/cdrom.cc b/methods/cdrom.cc index 22d4b9164..3c14d9dfb 100644 --- a/methods/cdrom.cc +++ b/methods/cdrom.cc @@ -62,7 +62,7 @@ CDROMMethod::CDROMMethod() : pkgAcqMethod("1.0",SingleInstance | LocalOnly | MountedByApt(false) { UdevCdroms.Dlopen(); -}; +} /*}}}*/ // CDROMMethod::Exit - Unmount the disc if necessary /*{{{*/ // --------------------------------------------------------------------- diff --git a/methods/http.cc b/methods/http.cc index 42b31beeb..16c6d19e1 100644 --- a/methods/http.cc +++ b/methods/http.cc @@ -61,7 +61,7 @@ unsigned long long CircleBuf::BwReadLimit=0; unsigned long long CircleBuf::BwTickReadData=0; struct timeval CircleBuf::BwReadTick={0,0}; const unsigned int CircleBuf::BW_HZ=10; - + // CircleBuf::CircleBuf - Circular input buffer /*{{{*/ // --------------------------------------------------------------------- /* */ @@ -87,8 +87,8 @@ void CircleBuf::Reset() { delete Hash; Hash = new Hashes; - } -}; + } +} /*}}}*/ // CircleBuf::Read - Read from a FD into the circular buffer /*{{{*/ // --------------------------------------------------------------------- diff --git a/methods/https.cc b/methods/https.cc index febe6a0f0..b0c7ee71d 100644 --- a/methods/https.cc +++ b/methods/https.cc @@ -432,7 +432,7 @@ bool HttpsMethod::Fetch(FetchItem *Itm) delete File; return true; -}; +} int main() { diff --git a/methods/mirror.cc b/methods/mirror.cc index 085f3717b..977eddcf5 100644 --- a/methods/mirror.cc +++ b/methods/mirror.cc @@ -60,7 +60,7 @@ using namespace std; MirrorMethod::MirrorMethod() : HttpMethod(), DownloadedMirrorFile(false), Debug(false) { -}; +} // HttpMethod::Configuration - Handle a configuration message /*{{{*/ // --------------------------------------------------------------------- @@ -90,17 +90,17 @@ bool MirrorMethod::Clean(string Dir) pkgSourceList list; list.ReadMainList(); - DIR *D = opendir(Dir.c_str()); + DIR *D = opendir(Dir.c_str()); if (D == 0) return _error->Errno("opendir",_("Unable to read %s"),Dir.c_str()); - + string StartDir = SafeGetCWD(); if (chdir(Dir.c_str()) != 0) { closedir(D); return _error->Errno("chdir",_("Unable to change to %s"),Dir.c_str()); } - + for (struct dirent *Dir = readdir(D); Dir != 0; Dir = readdir(D)) { // Skip some files.. @@ -123,23 +123,23 @@ bool MirrorMethod::Clean(string Dir) // nothing found, nuke it if (I == list.end()) unlink(Dir->d_name); - }; + } closedir(D); if (chdir(StartDir.c_str()) != 0) return _error->Errno("chdir",_("Unable to change to %s"),StartDir.c_str()); - return true; + return true; } bool MirrorMethod::DownloadMirrorFile(string mirror_uri_str) { - // not that great to use pkgAcquire here, but we do not have + // not that great to use pkgAcquire here, but we do not have // any other way right now string fetch = BaseUri; fetch.replace(0,strlen("mirror://"),"http://"); -#if 0 // no need for this, the getArchitectures() will also include the main +#if 0 // no need for this, the getArchitectures() will also include the main // arch // append main architecture fetch += "?arch=" + _config->Find("Apt::Architecture"); @@ -173,7 +173,7 @@ bool MirrorMethod::DownloadMirrorFile(string mirror_uri_str) if(Debug) clog << "MirrorMethod::DownloadMirrorFile() success: " << res << endl; - + return res; } @@ -187,13 +187,13 @@ bool MirrorMethod::RandomizeMirrorFile(string mirror_file) if (!FileExists(mirror_file)) return false; - // read + // read ifstream in(mirror_file.c_str()); while ( !in.eof() ) { getline(in, line); content.push_back(line); } - + // we want the file to be random for each different machine, but also // "stable" on the same machine. this is to avoid running into out-of-sync // issues (i.e. Release/Release.gpg different on each mirror) @@ -422,10 +422,10 @@ bool MirrorMethod::Fetch(FetchItem *Itm) if(Debug) clog << "Fetch: " << Itm->Uri << endl << endl; - + // now run the real fetcher return HttpMethod::Fetch(Itm); -}; +} void MirrorMethod::Fail(string Err,bool Transient) { @@ -437,7 +437,7 @@ void MirrorMethod::Fail(string Err,bool Transient) // try the next mirror on fail (if its not a expected failure, // e.g. translations are ok to ignore) - if (!Queue->FailIgnore && TryNextMirror()) + if (!Queue->FailIgnore && TryNextMirror()) return; // all mirrors failed, so bail out diff --git a/methods/rsh.cc b/methods/rsh.cc index 550f77eca..f065f6b89 100644 --- a/methods/rsh.cc +++ b/methods/rsh.cc @@ -368,7 +368,7 @@ RSHMethod::RSHMethod() : pkgAcqMethod("1.0",SendConfig) signal(SIGINT,SigTerm); Server = 0; FailFd = -1; -}; +} /*}}}*/ // RSHMethod::Configuration - Handle a configuration message /*{{{*/ // --------------------------------------------------------------------- diff --git a/methods/server.cc b/methods/server.cc index ef90c809c..90e83d1af 100644 --- a/methods/server.cc +++ b/methods/server.cc @@ -119,10 +119,10 @@ bool ServerState::HeaderLine(string Line) string::size_type Pos2 = Pos; while (Pos2 < Line.length() && isspace(Line[Pos2]) != 0) Pos2++; - + string Tag = string(Line,0,Pos); string Val = string(Line,Pos2); - + if (stringcasecmp(Tag.c_str(),Tag.c_str()+4,"HTTP") == 0) { // Evil servers return no version @@ -159,14 +159,14 @@ bool ServerState::HeaderLine(string Line) } return true; - } - + } + if (stringcasecmp(Tag,"Content-Length:") == 0) { if (Encoding == Closes) Encoding = Stream; HaveContent = true; - + // The length is already set from the Content-Range header if (StartPos != 0) return true; @@ -184,7 +184,7 @@ bool ServerState::HeaderLine(string Line) HaveContent = true; return true; } - + if (stringcasecmp(Tag,"Content-Range:") == 0) { HaveContent = true; @@ -201,12 +201,12 @@ bool ServerState::HeaderLine(string Line) return _error->Error(_("This HTTP server has broken range support")); return true; } - + if (stringcasecmp(Tag,"Transfer-Encoding:") == 0) { HaveContent = true; if (stringcasecmp(Val,"chunked") == 0) - Encoding = Chunked; + Encoding = Chunked; return true; } @@ -218,7 +218,7 @@ bool ServerState::HeaderLine(string Line) Persistent = true; return true; } - + if (stringcasecmp(Tag,"Last-Modified:") == 0) { if (RFC1123StrToTime(Val.c_str(), Date) == false) @@ -413,7 +413,7 @@ bool ServerMethod::Fetch(FetchItem *) } return true; -}; +} /*}}}*/ // ServerMethod::Loop - Main loop /*{{{*/ int ServerMethod::Loop() diff --git a/methods/server.h b/methods/server.h index 2b81e6173..f1db9adf7 100644 --- a/methods/server.h +++ b/methods/server.h @@ -62,7 +62,7 @@ struct ServerState /** \brief IO error while retrieving */ RUN_HEADERS_IO_ERROR, /** \brief Parse error after retrieving */ - RUN_HEADERS_PARSE_ERROR, + RUN_HEADERS_PARSE_ERROR }; /** \brief Get the headers before the data */ RunHeadersResult RunHeaders(FileFd * const File); -- cgit v1.2.3 From 3de8f956d5fcf023ab65f88579cd77121694d872 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Thu, 27 Feb 2014 01:26:29 +0100 Subject: StartPos is always positive for http/https MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit server.cc: In member function ‘bool ServerState::HeaderLine(std::string)’: server.cc:198:72: warning: format ‘%llu’ expects argument of type ‘long long unsigned int*’, but argument 3 has type ‘long long int*’ [-Wformat=] else if (sscanf(Val.c_str(),"bytes %llu-%*u/%llu",&StartPos,&Size) != 2) Git-Dch: Ignore Reported-By: gcc -Wpedantic --- methods/http.cc | 9 ++------- methods/server.h | 2 +- 2 files changed, 3 insertions(+), 8 deletions(-) (limited to 'methods') diff --git a/methods/http.cc b/methods/http.cc index 16c6d19e1..e1bb2e130 100644 --- a/methods/http.cc +++ b/methods/http.cc @@ -484,13 +484,8 @@ bool HttpServerState::InitHashes(FileFd &File) /*{{{*/ In.Hash = new Hashes; // Set the expected size and read file for the hashes - if (StartPos >= 0) - { - File.Truncate(StartPos); - - return In.Hash->AddFD(File, StartPos); - } - return true; + File.Truncate(StartPos); + return In.Hash->AddFD(File, StartPos); } /*}}}*/ Hashes * HttpServerState::GetHashes() /*{{{*/ diff --git a/methods/server.h b/methods/server.h index f1db9adf7..b4870698f 100644 --- a/methods/server.h +++ b/methods/server.h @@ -32,7 +32,7 @@ struct ServerState // These are some statistics from the last parsed header lines unsigned long long Size; - signed long long StartPos; + unsigned long long StartPos; time_t Date; bool HaveContent; enum {Chunked,Stream,Closes} Encoding; -- cgit v1.2.3 From 655122418d714f342b5d9789f45f8035f3fe8b9a Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sat, 1 Mar 2014 15:11:42 +0100 Subject: =?UTF-8?q?warning:=20unused=20parameter=20=E2=80=98foo=E2=80=99?= =?UTF-8?q?=20[-Wunused-parameter]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reported-By: gcc -Wunused-parameter Git-Dch: Ignore --- methods/ftp.cc | 2 +- methods/gzip.cc | 2 +- methods/https.cc | 8 ++++---- methods/https.h | 16 ++++++++-------- methods/mirror.cc | 2 +- methods/rsh.cc | 4 ++-- 6 files changed, 17 insertions(+), 17 deletions(-) (limited to 'methods') diff --git a/methods/ftp.cc b/methods/ftp.cc index 5a87ded1c..4108b2da3 100644 --- a/methods/ftp.cc +++ b/methods/ftp.cc @@ -1098,7 +1098,7 @@ bool FtpMethod::Fetch(FetchItem *Itm) } /*}}}*/ -int main(int argc,const char *argv[]) +int main(int, const char *argv[]) { setlocale(LC_ALL, ""); diff --git a/methods/gzip.cc b/methods/gzip.cc index a2844e969..3269ffbb8 100644 --- a/methods/gzip.cc +++ b/methods/gzip.cc @@ -120,7 +120,7 @@ bool GzipMethod::Fetch(FetchItem *Itm) } /*}}}*/ -int main(int argc, char *argv[]) +int main(int, char *argv[]) { setlocale(LC_ALL, ""); diff --git a/methods/https.cc b/methods/https.cc index b0c7ee71d..041214179 100644 --- a/methods/https.cc +++ b/methods/https.cc @@ -83,9 +83,9 @@ HttpsMethod::write_data(void *buffer, size_t size, size_t nmemb, void *userp) return size*nmemb; } -int -HttpsMethod::progress_callback(void *clientp, double dltotal, double dlnow, - double ultotal, double ulnow) +int +HttpsMethod::progress_callback(void *clientp, double dltotal, double /*dlnow*/, + double /*ultotal*/, double /*ulnow*/) { HttpsMethod *me = (HttpsMethod *)clientp; if(dltotal > 0 && me->Res.Size == 0) { @@ -95,7 +95,7 @@ HttpsMethod::progress_callback(void *clientp, double dltotal, double dlnow, } // HttpsServerState::HttpsServerState - Constructor /*{{{*/ -HttpsServerState::HttpsServerState(URI Srv,HttpsMethod *Owner) : ServerState(Srv, NULL) +HttpsServerState::HttpsServerState(URI Srv,HttpsMethod * /*Owner*/) : ServerState(Srv, NULL) { TimeOut = _config->FindI("Acquire::https::Timeout",TimeOut); Reset(); diff --git a/methods/https.h b/methods/https.h index ab0dd3407..3199b29f2 100644 --- a/methods/https.h +++ b/methods/https.h @@ -25,23 +25,23 @@ class FileFd; class HttpsServerState : public ServerState { protected: - virtual bool ReadHeaderLines(std::string &Data) { return false; } - virtual bool LoadNextResponse(bool const ToFile, FileFd * const File) { return false; } + virtual bool ReadHeaderLines(std::string &/*Data*/) { return false; } + virtual bool LoadNextResponse(bool const /*ToFile*/, FileFd * const /*File*/) { return false; } public: - virtual bool WriteResponse(std::string const &Data) { return false; } + virtual bool WriteResponse(std::string const &/*Data*/) { return false; } /** \brief Transfer the data from the socket */ - virtual bool RunData(FileFd * const File) { return false; } + virtual bool RunData(FileFd * const /*File*/) { return false; } virtual bool Open() { return false; } virtual bool IsOpen() { return false; } virtual bool Close() { return false; } - virtual bool InitHashes(FileFd &File) { return false; } + virtual bool InitHashes(FileFd &/*File*/) { return false; } virtual Hashes * GetHashes() { return NULL; } - virtual bool Die(FileFd &File) { return false; } - virtual bool Flush(FileFd * const File) { return false; } - virtual bool Go(bool ToFile, FileFd * const File) { return false; } + virtual bool Die(FileFd &/*File*/) { return false; } + virtual bool Flush(FileFd * const /*File*/) { return false; } + virtual bool Go(bool /*ToFile*/, FileFd * const /*File*/) { return false; } HttpsServerState(URI Srv, HttpsMethod *Owner); virtual ~HttpsServerState() {Close();}; diff --git a/methods/mirror.cc b/methods/mirror.cc index 977eddcf5..b30636758 100644 --- a/methods/mirror.cc +++ b/methods/mirror.cc @@ -132,7 +132,7 @@ bool MirrorMethod::Clean(string Dir) } -bool MirrorMethod::DownloadMirrorFile(string mirror_uri_str) +bool MirrorMethod::DownloadMirrorFile(string /*mirror_uri_str*/) { // not that great to use pkgAcquire here, but we do not have // any other way right now diff --git a/methods/rsh.cc b/methods/rsh.cc index f065f6b89..8088cac38 100644 --- a/methods/rsh.cc +++ b/methods/rsh.cc @@ -390,7 +390,7 @@ bool RSHMethod::Configuration(std::string Message) // RSHMethod::SigTerm - Clean up and timestamp the files on exit /*{{{*/ // --------------------------------------------------------------------- /* */ -void RSHMethod::SigTerm(int sig) +void RSHMethod::SigTerm(int) { if (FailFd == -1) _exit(100); @@ -519,7 +519,7 @@ bool RSHMethod::Fetch(FetchItem *Itm) } /*}}}*/ -int main(int argc, const char *argv[]) +int main(int, const char *argv[]) { setlocale(LC_ALL, ""); -- cgit v1.2.3 From 453b82a388013e522b3a1b9fcd6ed0810dab1f4f Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Wed, 5 Mar 2014 22:11:25 +0100 Subject: cleanup headers and especially #includes everywhere Beside being a bit cleaner it hopefully also resolves oddball problems I have with high levels of parallel jobs. Git-Dch: Ignore Reported-By: iwyu (include-what-you-use) --- methods/cdrom.cc | 4 ++-- methods/connect.cc | 2 +- methods/copy.cc | 3 ++- methods/file.cc | 3 ++- methods/ftp.cc | 5 +++++ methods/ftp.h | 2 ++ methods/gpgv.cc | 16 +++++++++------- methods/gzip.cc | 14 ++++++++------ methods/http.cc | 13 +++++-------- methods/http.h | 4 ++++ methods/http_main.cc | 5 ----- methods/https.cc | 9 +++++---- methods/https.h | 7 ++++++- methods/mirror.cc | 10 +++++----- methods/mirror.h | 2 ++ methods/rred.cc | 5 ++--- methods/rsh.cc | 4 ++++ methods/rsh.h | 2 ++ methods/server.cc | 27 +++++++++++---------------- methods/server.h | 3 +++ 20 files changed, 80 insertions(+), 60 deletions(-) (limited to 'methods') diff --git a/methods/cdrom.cc b/methods/cdrom.cc index 3c14d9dfb..74e2ecc6b 100644 --- a/methods/cdrom.cc +++ b/methods/cdrom.cc @@ -19,9 +19,9 @@ #include #include +#include +#include #include -#include -#include #include #include diff --git a/methods/connect.cc b/methods/connect.cc index d9c9a1dd4..e2cbf4f5c 100644 --- a/methods/connect.cc +++ b/methods/connect.cc @@ -23,7 +23,7 @@ #include #include #include - +#include #include #include diff --git a/methods/copy.cc b/methods/copy.cc index f2a8f9ed8..d59f032ff 100644 --- a/methods/copy.cc +++ b/methods/copy.cc @@ -17,9 +17,10 @@ #include #include +#include #include #include -#include + #include /*}}}*/ diff --git a/methods/file.cc b/methods/file.cc index 3d0687c5b..12db62203 100644 --- a/methods/file.cc +++ b/methods/file.cc @@ -21,8 +21,9 @@ #include #include +#include #include -#include + #include /*}}}*/ diff --git a/methods/ftp.cc b/methods/ftp.cc index 4108b2da3..66787a7be 100644 --- a/methods/ftp.cc +++ b/methods/ftp.cc @@ -23,7 +23,11 @@ #include #include #include +#include +#include +#include +#include #include #include #include @@ -42,6 +46,7 @@ #include "rfc2553emu.h" #include "connect.h" #include "ftp.h" + #include /*}}}*/ diff --git a/methods/ftp.h b/methods/ftp.h index 8055c389f..119d0c7e8 100644 --- a/methods/ftp.h +++ b/methods/ftp.h @@ -12,6 +12,8 @@ #include +#include +#include #include class FTPConn diff --git a/methods/gpgv.cc b/methods/gpgv.cc index 25bf64ddd..ae521a2ed 100644 --- a/methods/gpgv.cc +++ b/methods/gpgv.cc @@ -1,19 +1,21 @@ #include -#include #include -#include -#include -#include #include +#include #include +#include -#include -#include +#include #include +#include +#include +#include +#include #include +#include #include -#include +#include #include #include diff --git a/methods/gzip.cc b/methods/gzip.cc index 3269ffbb8..ace5e9f71 100644 --- a/methods/gzip.cc +++ b/methods/gzip.cc @@ -11,17 +11,19 @@ // Include Files /*{{{*/ #include -#include -#include #include -#include +#include +#include #include +#include +#include +#include #include #include -#include -#include -#include +#include +#include + #include /*}}}*/ diff --git a/methods/http.cc b/methods/http.cc index e1bb2e130..82f16e9b2 100644 --- a/methods/http.cc +++ b/methods/http.cc @@ -33,24 +33,21 @@ #include #include #include +#include +#include +#include +#include +#include #include #include #include -#include #include #include -#include -#include #include -#include - -// Internet stuff -#include #include "config.h" #include "connect.h" -#include "rfc2553emu.h" #include "http.h" #include diff --git a/methods/http.h b/methods/http.h index 450a42eed..5406ce4a7 100644 --- a/methods/http.h +++ b/methods/http.h @@ -12,14 +12,18 @@ #define APT_HTTP_H #include +#include #include +#include +#include #include "server.h" using std::cout; using std::endl; +class FileFd; class HttpMethod; class Hashes; diff --git a/methods/http_main.cc b/methods/http_main.cc index 2ca91bfc9..3b346a514 100644 --- a/methods/http_main.cc +++ b/methods/http_main.cc @@ -1,14 +1,9 @@ #include -#include -#include #include -#include "connect.h" -#include "rfc2553emu.h" #include "http.h" - int main() { setlocale(LC_ALL, ""); diff --git a/methods/https.cc b/methods/https.cc index 041214179..c4aff8f38 100644 --- a/methods/https.cc +++ b/methods/https.cc @@ -18,19 +18,20 @@ #include #include #include +#include +#include #include #include #include -#include #include -#include -#include #include #include +#include +#include -#include "config.h" #include "https.h" + #include /*}}}*/ using namespace std; diff --git a/methods/https.h b/methods/https.h index 3199b29f2..faac8a3cd 100644 --- a/methods/https.h +++ b/methods/https.h @@ -11,14 +11,19 @@ #ifndef APT_HTTPS_H #define APT_HTTPS_H -#include +#include + #include +#include +#include +#include #include "server.h" using std::cout; using std::endl; +class Hashes; class HttpsMethod; class FileFd; diff --git a/methods/mirror.cc b/methods/mirror.cc index b30636758..d3aef91bc 100644 --- a/methods/mirror.cc +++ b/methods/mirror.cc @@ -16,18 +16,18 @@ #include #include #include -#include #include #include #include +#include +#include +#include +#include #include -#include #include - -#include +#include #include -#include #include #include diff --git a/methods/mirror.h b/methods/mirror.h index 1dd9f2ec6..6c0ce370e 100644 --- a/methods/mirror.h +++ b/methods/mirror.h @@ -11,6 +11,8 @@ #ifndef APT_MIRROR_H #define APT_MIRROR_H +#include + #include #include #include diff --git a/methods/rred.cc b/methods/rred.cc index 7169fc731..cabb3c456 100644 --- a/methods/rred.cc +++ b/methods/rred.cc @@ -8,19 +8,18 @@ #include #include -#include #include #include #include #include #include +#include +#include #include #include #include -#include -#include #include #include #include diff --git a/methods/rsh.cc b/methods/rsh.cc index 8088cac38..bd46d2515 100644 --- a/methods/rsh.cc +++ b/methods/rsh.cc @@ -17,7 +17,11 @@ #include #include #include +#include +#include +#include +#include #include #include #include diff --git a/methods/rsh.h b/methods/rsh.h index d7efa3f06..c2c06acfe 100644 --- a/methods/rsh.h +++ b/methods/rsh.h @@ -11,6 +11,8 @@ #define APT_RSH_H #include +#include + #include class Hashes; diff --git a/methods/server.cc b/methods/server.cc index 90e83d1af..5a13f18a7 100644 --- a/methods/server.cc +++ b/methods/server.cc @@ -10,32 +10,27 @@ // Include Files /*{{{*/ #include -#include #include #include #include -#include -#include +#include +#include -#include +#include +#include +#include +#include #include #include +#include #include -#include -#include -#include -#include -#include #include +#include #include +#include +#include -// Internet stuff -#include - -#include "config.h" -#include "connect.h" -#include "rfc2553emu.h" -#include "http.h" +#include "server.h" #include /*}}}*/ diff --git a/methods/server.h b/methods/server.h index b4870698f..d1e151f8a 100644 --- a/methods/server.h +++ b/methods/server.h @@ -12,7 +12,10 @@ #define APT_SERVER_H #include +#include +#include +#include #include using std::cout; -- cgit v1.2.3 From a02db58fd50ef7fc2f0284852c6b3f98e458a232 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Thu, 6 Mar 2014 00:33:10 +0100 Subject: follow method attribute suggestions by gcc Git-Dch: Ignore Reported-By: gcc -Wsuggest-attribute={pure,const,noreturn} --- methods/ftp.h | 2 +- methods/http.cc | 4 ++-- methods/rsh.h | 2 +- methods/server.h | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) (limited to 'methods') diff --git a/methods/ftp.h b/methods/ftp.h index 119d0c7e8..dd92f0086 100644 --- a/methods/ftp.h +++ b/methods/ftp.h @@ -78,7 +78,7 @@ class FtpMethod : public pkgAcqMethod static std::string FailFile; static int FailFd; static time_t FailTime; - static void SigTerm(int); + static APT_NORETURN void SigTerm(int); public: diff --git a/methods/http.cc b/methods/http.cc index 82f16e9b2..ed6e3517d 100644 --- a/methods/http.cc +++ b/methods/http.cc @@ -470,7 +470,7 @@ bool HttpServerState::WriteResponse(const std::string &Data) /*{{{*/ return Out.Read(Data); } /*}}}*/ -bool HttpServerState::IsOpen() /*{{{*/ +APT_PURE bool HttpServerState::IsOpen() /*{{{*/ { return (ServerFd != -1); } @@ -485,7 +485,7 @@ bool HttpServerState::InitHashes(FileFd &File) /*{{{*/ return In.Hash->AddFD(File, StartPos); } /*}}}*/ -Hashes * HttpServerState::GetHashes() /*{{{*/ +APT_PURE Hashes * HttpServerState::GetHashes() /*{{{*/ { return In.Hash; } diff --git a/methods/rsh.h b/methods/rsh.h index c2c06acfe..dd259e744 100644 --- a/methods/rsh.h +++ b/methods/rsh.h @@ -64,7 +64,7 @@ class RSHMethod : public pkgAcqMethod static std::string FailFile; static int FailFd; static time_t FailTime; - static void SigTerm(int); + static APT_NORETURN void SigTerm(int); public: diff --git a/methods/server.h b/methods/server.h index d1e151f8a..0f45ab994 100644 --- a/methods/server.h +++ b/methods/server.h @@ -129,7 +129,7 @@ class ServerMethod : public pkgAcqMethod static std::string FailFile; static int FailFd; static time_t FailTime; - static void SigTerm(int); + static APT_NORETURN void SigTerm(int); virtual bool Configuration(std::string Message); virtual bool Flush() { return Server->Flush(File); }; -- cgit v1.2.3 From 0ec6b98b24939100a6d4c333abe5bc62a4455f9f Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Wed, 12 Mar 2014 14:24:41 +0100 Subject: add a config option to switch uncompress methods to compress Not very useful in the normal operation of work, but handy for tests. Git-Dch: Ignore --- methods/gzip.cc | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) (limited to 'methods') diff --git a/methods/gzip.cc b/methods/gzip.cc index ace5e9f71..df3f8828f 100644 --- a/methods/gzip.cc +++ b/methods/gzip.cc @@ -11,6 +11,7 @@ // Include Files /*{{{*/ #include +#include #include #include #include @@ -60,17 +61,25 @@ bool GzipMethod::Fetch(FetchItem *Itm) return _error->Error("Extraction of file %s requires unknown compressor %s", Path.c_str(), Prog); // Open the source and destination files - FileFd From; - From.Open(Path, FileFd::ReadOnly, *compressor); - - if(From.FileSize() == 0) - return _error->Error(_("Empty files can't be valid archives")); - - FileFd To(Itm->DestFile,FileFd::WriteAtomic); + FileFd From, To; + if (_config->FindB("Method::Compress", false) == false) + { + From.Open(Path, FileFd::ReadOnly, *compressor); + if(From.FileSize() == 0) + return _error->Error(_("Empty files can't be valid archives")); + To.Open(Itm->DestFile, FileFd::WriteAtomic); + } + else + { + From.Open(Path, FileFd::ReadOnly); + To.Open(Itm->DestFile, FileFd::WriteOnly | FileFd::Create | FileFd::Empty, *compressor); + } To.EraseOnFailure(); - if (_error->PendingError() == true) + + if (From.IsOpen() == false || From.Failed() == true || + To.IsOpen() == false || To.Failed() == true) return false; - + // Read data from source, generate checksums and write Hashes Hash; bool Failed = false; -- cgit v1.2.3