Skip to content

Commit

Permalink
Fix compiler warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
teusbenschop committed Aug 31, 2024
1 parent d1fa240 commit 92c990f
Show file tree
Hide file tree
Showing 95 changed files with 281 additions and 19 deletions.
8 changes: 4 additions & 4 deletions checksum/logic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include <filter/string.h>
#include <filter/md5.h>
#include <filter/usfm.h>
#include <webserver/request.h>
#include <database/bibles.h>


// This function reads $data,
Expand Down Expand Up @@ -84,7 +84,7 @@ std::string checksum_logic::get_book (const std::string& bible, int book)


// Returns a proper checksum for the USFM in the $bible.
std::string checksum_logic::get_bible (Webserver_Request& webserver_request, const std::string& bible)
std::string checksum_logic::get_bible (const std::string& bible)
{
std::vector <int> books = database::bibles::get_books (bible);
std::vector <std::string> checksums;
Expand All @@ -98,11 +98,11 @@ std::string checksum_logic::get_bible (Webserver_Request& webserver_request, con


// Returns a proper checksum for the USFM in the array of $bibles.
std::string checksum_logic::get_bibles (Webserver_Request& webserver_request, const std::vector <std::string> & bibles)
std::string checksum_logic::get_bibles (const std::vector <std::string> & bibles)
{
std::vector <std::string> checksums;
for (const auto & bible : bibles) {
checksums.push_back (get_bible (webserver_request, bible));
checksums.push_back (get_bible (bible));
}
std::string checksum = filter::strings::implode (checksums, std::string());
checksum = md5 (checksum);
Expand Down
6 changes: 2 additions & 4 deletions checksum/logic.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,14 @@

#include <config/libraries.h>

class Webserver_Request;

namespace checksum_logic {

std::string send (const std::string & data, bool readwrite);
std::string get (const std::string & data);
std::string get (const std::vector <std::string>& data);
std::string get_chapter (const std::string & bible, int book, int chapter);
std::string get_book (const std::string & bible, int book);
std::string get_bible (Webserver_Request& webserver_request, const std::string & bible);
std::string get_bibles (Webserver_Request& webserver_request, const std::vector <std::string> & bibles);
std::string get_bible (const std::string & bible);
std::string get_bibles (const std::vector <std::string> & bibles);

}
4 changes: 2 additions & 2 deletions sendreceive/bibles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ void sendreceive_bibles ()
// The client compares the two checksums.
// If they match, it means everything is in sync.
bibles = database::bibles::get_bibles ();
std::string client_checksum = checksum_logic::get_bibles (webserver_request, bibles);
std::string client_checksum = checksum_logic::get_bibles (bibles);
post ["a"] = std::to_string (Sync_Logic::bibles_get_total_checksum);
std::string server_checksum = sync_logic.post (post, url, error);
if (!error.empty ()) {
Expand Down Expand Up @@ -326,7 +326,7 @@ void sendreceive_bibles ()

// Compare the checksum of the whole Bible on client and server
// to see if this Bible is in sync.
std::string client_checksum_bible = checksum_logic::get_bible (webserver_request, bible);
std::string client_checksum_bible = checksum_logic::get_bible (bible);
post ["a"] = std::to_string (Sync_Logic::bibles_get_bible_checksum);
post ["b"] = bible;
std::string server_checksum_bible = sync_logic.post (post, url, error);
Expand Down
4 changes: 2 additions & 2 deletions sync/bibles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ std::string sync_bibles (Webserver_Request& webserver_request)
// and returns this checksum to the client.
const std::string& username = webserver_request.session_logic ()->get_username ();
std::vector <std::string> bibles = access_bible::bibles (webserver_request, username);
std::string server_checksum = checksum_logic::get_bibles (webserver_request, bibles);
std::string server_checksum = checksum_logic::get_bibles (bibles);
return server_checksum;
}
case Sync_Logic::bibles_get_bibles:
Expand All @@ -191,7 +191,7 @@ std::string sync_bibles (Webserver_Request& webserver_request)
case Sync_Logic::bibles_get_bible_checksum:
{
// The server responds with the checksum for the whole Bible.
return checksum_logic::get_bible (webserver_request, bible);
return checksum_logic::get_bible (bible);
}
case Sync_Logic::bibles_get_books:
{
Expand Down
1 change: 1 addition & 0 deletions tidy/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#pragma clang diagnostic ignored "-Wassign-enum"
#pragma clang diagnostic ignored "-Wcomma"
#pragma clang diagnostic ignored "-Wconversion"
#pragma clang diagnostic ignored "-Wmissing-field-initializers"
/* config.c
* Read configuration files and manage configuration properties.
*
Expand Down
1 change: 1 addition & 0 deletions tidy/language.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#pragma clang diagnostic ignored "-Wassign-enum"
#pragma clang diagnostic ignored "-Wcomma"
#pragma clang diagnostic ignored "-Wconversion"
#pragma clang diagnostic ignored "-Wignored-qualifiers"
/* language.c -- localization support for HTML Tidy.
Copyright 2015 HTACG
Expand Down
1 change: 1 addition & 0 deletions tidy/lexer.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#pragma clang diagnostic ignored "-Wassign-enum"
#pragma clang diagnostic ignored "-Wcomma"
#pragma clang diagnostic ignored "-Wconversion"
#pragma clang diagnostic ignored "-Wunused-but-set-variable"
/* lexer.c -- Lexer for html parser
(c) 1998-2008 (W3C) MIT, ERCIM, Keio University
Expand Down
1 change: 1 addition & 0 deletions tidy/message.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#pragma clang diagnostic ignored "-Wassign-enum"
#pragma clang diagnostic ignored "-Wcomma"
#pragma clang diagnostic ignored "-Wconversion"
#pragma clang diagnostic ignored "-Wmissing-field-initializers"
/* message.c -- General Message Writing Routines
(c) 1998-2017 (W3C) MIT, ERCIM, Keio University, University of
Expand Down
1 change: 1 addition & 0 deletions tidy/tags.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#pragma clang diagnostic ignored "-Wassign-enum"
#pragma clang diagnostic ignored "-Wcomma"
#pragma clang diagnostic ignored "-Wconversion"
#pragma clang diagnostic ignored "-Wmissing-field-initializers"
/* tags.c
* Recognize HTML tags.
*
Expand Down
3 changes: 3 additions & 0 deletions unittests/archive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

#include <config/libraries.h>
#ifdef HAVE_GTEST
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wsign-compare"
#include "gtest/gtest.h"
#pragma GCC diagnostic pop
#include <unittests/utilities.h>
#include <filter/url.h>
#include <filter/archive.h>
Expand Down
3 changes: 3 additions & 0 deletions unittests/biblegateway.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

#include <config/libraries.h>
#ifdef HAVE_GTEST
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wsign-compare"
#include "gtest/gtest.h"
#pragma GCC diagnostic pop
#include <unittests/utilities.h>
#include <resource/logic.h>

Expand Down
3 changes: 3 additions & 0 deletions unittests/bibleimages.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

#include <config/libraries.h>
#ifdef HAVE_GTEST
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wsign-compare"
#include "gtest/gtest.h"
#pragma GCC diagnostic pop
#include <unittests/utilities.h>
#include <database/bibleimages.h>
#include <filter/url.h>
Expand Down
3 changes: 3 additions & 0 deletions unittests/bibles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

#include <config/libraries.h>
#ifdef HAVE_GTEST
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wsign-compare"
#include "gtest/gtest.h"
#pragma GCC diagnostic pop
#include <unittests/utilities.h>
#include <webserver/request.h>
#include <database/state.h>
Expand Down
3 changes: 3 additions & 0 deletions unittests/books.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

#include <config/libraries.h>
#ifdef HAVE_GTEST
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wsign-compare"
#include "gtest/gtest.h"
#pragma GCC diagnostic pop
#include <unittests/utilities.h>
#include <database/books.h>

Expand Down
3 changes: 3 additions & 0 deletions unittests/cache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

#include <config/libraries.h>
#ifdef HAVE_GTEST
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wsign-compare"
#include "gtest/gtest.h"
#pragma GCC diagnostic pop
#include <unittests/utilities.h>
#include <database/cache.h>
#include <filter/url.h>
Expand Down
3 changes: 3 additions & 0 deletions unittests/check.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

#include <config/libraries.h>
#ifdef HAVE_GTEST
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wsign-compare"
#include "gtest/gtest.h"
#pragma GCC diagnostic pop
#include <unittests/utilities.h>
#include <database/check.h>
#include <database/state.h>
Expand Down
11 changes: 7 additions & 4 deletions unittests/checksum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

#include <config/libraries.h>
#ifdef HAVE_GTEST
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wsign-compare"
#include "gtest/gtest.h"
#pragma GCC diagnostic pop
#include <unittests/utilities.h>
#include <checksum/logic.h>
#include <database/state.h>
Expand Down Expand Up @@ -87,22 +90,22 @@ TEST (checksum, basic)
}
// GetBible1
{
const std::string checksum = checksum_logic::get_bible (webserver_request, "phpunit1");
const std::string checksum = checksum_logic::get_bible ("phpunit1");
EXPECT_EQ ("f9dc679a8712eb6f65b584e9688e9680", checksum);
}
// GetBible2
{
const std::string checksum = checksum_logic::get_bible (webserver_request, "phpunit2");
const std::string checksum = checksum_logic::get_bible ("phpunit2");
EXPECT_EQ ("ee84a85bac14adb35e887c3d89bc80ab", checksum);
}
// GetBibles1
{
const std::string checksum = checksum_logic::get_bibles (webserver_request, {"phpunit1", "phpunit2"});
const std::string checksum = checksum_logic::get_bibles ({"phpunit1", "phpunit2"});
EXPECT_EQ ("440b2008993816f0bc8c557b64fbdaf2", checksum);
}
// GetBibles2
{
const std::string checksum = checksum_logic::get_bibles (webserver_request, {"phpunit3", "phpunit4"});
const std::string checksum = checksum_logic::get_bibles ({"phpunit3", "phpunit4"});
EXPECT_EQ ("020eb29b524d7ba672d9d48bc72db455", checksum);
}
}
Expand Down
3 changes: 3 additions & 0 deletions unittests/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

#include <config/libraries.h>
#ifdef HAVE_GTEST
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wsign-compare"
#include "gtest/gtest.h"
#pragma GCC diagnostic pop
#include <unittests/utilities.h>
#include <client/logic.h>
#include <database/logic.h>
Expand Down
3 changes: 3 additions & 0 deletions unittests/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

#include <config/libraries.h>
#ifdef HAVE_GTEST
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wsign-compare"
#include "gtest/gtest.h"
#pragma GCC diagnostic pop
#include <unittests/utilities.h>
#include <database/config/general.h>
#include <database/config/bible.h>
Expand Down
3 changes: 3 additions & 0 deletions unittests/confirm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

#include <config/libraries.h>
#ifdef HAVE_GTEST
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wsign-compare"
#include "gtest/gtest.h"
#pragma GCC diagnostic pop
#include <unittests/utilities.h>
#include <database/confirm.h>
#include <filter/string.h>
Expand Down
3 changes: 3 additions & 0 deletions unittests/date.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

#include <config/libraries.h>
#ifdef HAVE_GTEST
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wsign-compare"
#include "gtest/gtest.h"
#pragma GCC diagnostic pop
#include <unittests/utilities.h>
#include <filter/date.h>
#include <filter/string.h>
Expand Down
3 changes: 3 additions & 0 deletions unittests/dev.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@
#include <config/libraries.h>
#ifdef HAVE_GTEST
#include <unittests/utilities.h>
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wsign-compare"
#include "gtest/gtest.h"
#pragma GCC diagnostic pop
#include <webserver/webserver.h>


Expand Down
3 changes: 3 additions & 0 deletions unittests/diff.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

#include <config/libraries.h>
#ifdef HAVE_GTEST
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wsign-compare"
#include "gtest/gtest.h"
#pragma GCC diagnostic pop
#include <unittests/utilities.h>
#include <filter/diff.h>
#include <filter/merge.h>
Expand Down
3 changes: 3 additions & 0 deletions unittests/easyenglishbible.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

#include <config/libraries.h>
#ifdef HAVE_GTEST
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wsign-compare"
#include "gtest/gtest.h"
#pragma GCC diagnostic pop
#include <unittests/utilities.h>
#include <resource/logic.h>
#include <filter/string.h>
Expand Down
3 changes: 3 additions & 0 deletions unittests/editone.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

#include <config/libraries.h>
#ifdef HAVE_GTEST
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wsign-compare"
#include "gtest/gtest.h"
#pragma GCC diagnostic pop
#include <unittests/utilities.h>
#include <styles/logic.h>
#include <filter/url.h>
Expand Down
3 changes: 3 additions & 0 deletions unittests/etcbc4.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

#include <config/libraries.h>
#ifdef HAVE_GTEST
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wsign-compare"
#include "gtest/gtest.h"
#pragma GCC diagnostic pop
#include <unittests/utilities.h>
#include <database/etcbc4.h>

Expand Down
3 changes: 3 additions & 0 deletions unittests/export.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

#include <config/libraries.h>
#ifdef HAVE_GTEST
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wsign-compare"
#include "gtest/gtest.h"
#pragma GCC diagnostic pop
#include <unittests/utilities.h>
#include <text/text.h>
#include <esword/text.h>
Expand Down
3 changes: 3 additions & 0 deletions unittests/flate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@

#include <config/libraries.h>
#ifdef HAVE_GTEST
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wsign-compare"
#include "gtest/gtest.h"
#pragma GCC diagnostic pop
#include <unittests/utilities.h>
#include <flate/flate.h>
#include <filter/url.h>
Expand Down
3 changes: 3 additions & 0 deletions unittests/folders.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

#include <config/libraries.h>
#ifdef HAVE_GTEST
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wsign-compare"
#include "gtest/gtest.h"
#pragma GCC diagnostic pop
#include <unittests/utilities.h>
#include <filter/url.h>

Expand Down
3 changes: 3 additions & 0 deletions unittests/french.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

#include <config/libraries.h>
#ifdef HAVE_GTEST
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wsign-compare"
#include "gtest/gtest.h"
#pragma GCC diagnostic pop
#include <unittests/utilities.h>
#include <checks/french.h>
#include <database/check.h>
Expand Down
3 changes: 3 additions & 0 deletions unittests/gbs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

#include <config/libraries.h>
#ifdef HAVE_GTEST
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wsign-compare"
#include "gtest/gtest.h"
#pragma GCC diagnostic pop
#include <unittests/utilities.h>
#include <resource/logic.h>
#include <resource/external.h>
Expand Down
Loading

0 comments on commit 92c990f

Please sign in to comment.