C++11 and general tidying.
authorCarl Hetherington <cth@carlh.net>
Fri, 21 Jan 2022 22:38:14 +0000 (23:38 +0100)
committerCarl Hetherington <cth@carlh.net>
Wed, 9 Mar 2022 16:04:02 +0000 (17:04 +0100)
src/lib/internet.cc
src/lib/internet.h
src/wx/christie_certificate_panel.cc
src/wx/download_certificate_dialog.cc
src/wx/screen_dialog.cc
src/wx/screen_dialog.h

index ca72399f3f547076bafcceb707dfa7f7e44d70e2..4fb6c7cb3132132c255042273f631a8e17bfb628 100644 (file)
@@ -113,7 +113,7 @@ get_from_url (string url, bool pasv, bool skip_pasv_ip, ScopedTemporary& temp)
        /* Maximum time is 20s */
        curl_easy_setopt (curl, CURLOPT_TIMEOUT, 20);
 
-       CURLcode const cr = curl_easy_perform (curl);
+       auto const cr = curl_easy_perform (curl);
 
        temp.close ();
        curl_easy_cleanup (curl);
@@ -121,7 +121,7 @@ get_from_url (string url, bool pasv, bool skip_pasv_ip, ScopedTemporary& temp)
                return String::compose (_("Download failed (%1 error %2)"), url, (int) cr);
        }
 
-       return optional<string>();
+       return {};
 }
 
 
index 25513e6667d8e0489ebc4557d848b97ed99cbe7e..f3cd2c6b4f908b63f6fba2c4331e643f8fb16c4c 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2014-2021 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2014-2022 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
@@ -18,8 +18,9 @@
 
 */
 
-#include <boost/optional.hpp>
+
 #include <boost/filesystem.hpp>
+#include <boost/optional.hpp>
 
 
 class ScopedTemporary;
index ab131e015cf0ba95135cef0693e38e2b2b743634..4d9b1fcb71ab81961832a312519f13a5258f2576 100644 (file)
@@ -68,7 +68,7 @@ ChristieCertificatePanel::do_download ()
        if (error) {
                all_errors = *error;
 
-               string const url = String::compose ("%1IMB-S2/IMB-S2_%2_sha256.pem", prefix, serial);
+               auto const url = String::compose ("%1IMB-S2/IMB-S2_%2_sha256.pem", prefix, serial);
 
                error = get_from_url (url, true, false, boost::bind(&DownloadCertificatePanel::load_certificate_from_chain, this, _1));
                if (error) {
index 627223c460d77d10c8b5d086645119db47efd343..4a80dc9c03b0b4cb3e7ddaa22a9dd126e9ee6131 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2014-2018 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2014-2022 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
 
 */
 
-#include "dolby_doremi_certificate_panel.h"
+
 #include "barco_alchemy_certificate_panel.h"
 #include "christie_certificate_panel.h"
+#include "dcpomatic_button.h"
+#include "dolby_doremi_certificate_panel.h"
+#include "download_certificate_dialog.h"
 #include "gdc_certificate_panel.h"
 #include "qube_certificate_panel.h"
-#include "download_certificate_dialog.h"
 #include "static_text.h"
 #include "wx_util.h"
-#include "dcpomatic_button.h"
+
 
 using boost::optional;
 
+
 DownloadCertificateDialog::DownloadCertificateDialog (wxWindow* parent)
        : wxDialog (parent, wxID_ANY, _("Download certificate"))
 {
-       wxBoxSizer* sizer = new wxBoxSizer (wxVERTICAL);
+       auto sizer = new wxBoxSizer (wxVERTICAL);
 
        _notebook = new wxNotebook (this, wxID_ANY);
        sizer->Add (_notebook, 1, wxEXPAND | wxALL, DCPOMATIC_DIALOG_BORDER);
@@ -43,7 +46,7 @@ DownloadCertificateDialog::DownloadCertificateDialog (wxWindow* parent)
 
        _message = new StaticText (this, wxT (""));
        sizer->Add (_message, 0, wxALL, DCPOMATIC_SIZER_GAP);
-       wxFont font = _message->GetFont();
+       auto font = _message->GetFont();
        font.SetStyle (wxFONTSTYLE_ITALIC);
        font.SetPointSize (font.GetPointSize() - 1);
        _message->SetFont (font);
@@ -59,7 +62,7 @@ DownloadCertificateDialog::DownloadCertificateDialog (wxWindow* parent)
                _notebook->AddPage (i, i->name(), true);
        }
 
-       wxSizer* buttons = CreateSeparatedButtonSizer (wxOK | wxCANCEL);
+       auto buttons = CreateSeparatedButtonSizer (wxOK | wxCANCEL);
        if (buttons) {
                sizer->Add (buttons, wxSizerFlags().Expand().DoubleBorder());
        }
@@ -77,36 +80,40 @@ DownloadCertificateDialog::DownloadCertificateDialog (wxWindow* parent)
        setup_sensitivity ();
 }
 
+
 DownloadCertificateDialog::~DownloadCertificateDialog ()
 {
        _notebook->Unbind (wxEVT_NOTEBOOK_PAGE_CHANGED, &DownloadCertificateDialog::page_changed, this);
 }
 
+
 void
 DownloadCertificateDialog::download ()
 {
        _pages[_notebook->GetSelection()]->download ();
 }
 
+
 dcp::Certificate
 DownloadCertificateDialog::certificate () const
 {
-       optional<dcp::Certificate> c = _pages[_notebook->GetSelection()]->certificate ();
+       auto c = _pages[_notebook->GetSelection()]->certificate ();
        DCPOMATIC_ASSERT (c);
-       return c.get ();
+       return *c;
 }
 
 void
 DownloadCertificateDialog::setup_sensitivity ()
 {
-       DownloadCertificatePanel* p = _pages[_notebook->GetSelection()];
+       auto p = _pages[_notebook->GetSelection()];
        _download->Enable (p->ready_to_download ());
-       wxButton* ok = dynamic_cast<wxButton *> (FindWindowById (wxID_OK, this));
+       auto ok = dynamic_cast<wxButton *> (FindWindowById (wxID_OK, this));
        if (ok) {
                ok->Enable (static_cast<bool>(p->certificate ()));
        }
 }
 
+
 void
 DownloadCertificateDialog::page_changed (wxNotebookEvent& ev)
 {
index 8da8f061e7c93d47871b49efc02a8a55fdca9401..3148d09d91218dc43c1bef4c36f573b2902681a0 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2012-2021 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2012-2022 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
@@ -132,7 +132,7 @@ ScreenDialog::ScreenDialog (
         size.SetHeight (-1);
 
        add_label_to_sizer (_sizer, this, _("Recipient certificate"), true, wxGBPosition(r, 0));
-       wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
+       auto s = new wxBoxSizer (wxHORIZONTAL);
        _recipient_thumbprint = new StaticText (this, wxT (""), wxDefaultPosition, size);
        _recipient_thumbprint->SetFont (font);
        set_recipient (recipient);
index 2c2d8b8bfe45536a65e56a61d45c3e6f45adc00d..49e4d092a6721a747fecd1f548c2850975c827d1 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2012-2021 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2012-2022 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.