Fix build warnings

For pimpl with anonymous namespace, see https://stackoverflow.com/questions/39684438
This commit is contained in:
wangqr 2019-09-06 13:58:56 -04:00
parent 5dd201bc2d
commit c2c44f1ad2
16 changed files with 37 additions and 38 deletions

View file

@ -59,7 +59,7 @@ script:
./build/version.sh .;
mkdir build-dir;
cd build-dir;
cmake -DCMAKE_CXX_FLAGS='-Wall -Wextra -pedantic -std=gnu++11' ..;
cmake -DCMAKE_CXX_FLAGS='-Wall -Wextra -Wno-unused-parameter -pedantic' ..;
make -j2;
fi

View file

@ -41,14 +41,14 @@ public:
void FillBuffer(void *buf, int64_t start, int64_t count64) const override {
auto count = static_cast<size_t>(count64);
assert(count == count64);
assert(count64 >= 0 && count == static_cast<uint64_t>(count64));
src_buf.resize(count * src_bytes_per_sample * channels);
source->GetAudio(src_buf.data(), start, count);
auto dest = static_cast<int16_t*>(buf);
for (int64_t i = 0; i < count * channels; ++i) {
for (size_t i = 0; i < count * channels; ++i) {
int64_t sample = 0;
// 8 bits per sample is assumed to be unsigned with a bias of 127,
@ -85,7 +85,7 @@ public:
void FillBuffer(void *buf, int64_t start, int64_t count64) const override {
auto count = static_cast<size_t>(count64);
assert(count == count64);
assert(count64 >= 0 && count == static_cast<uint64_t>(count64));
src_buf.resize(count * channels);
source->GetAudio(&src_buf[0], start, count);
@ -119,7 +119,7 @@ public:
void FillBuffer(void *buf, int64_t start, int64_t count64) const override {
auto count = static_cast<size_t>(count64);
assert(count == count64);
assert(count64 >= 0 && count == static_cast<uint64_t>(count64));
src_buf.resize(count * src_channels);
source->GetAudio(&src_buf[0], start, count);

View file

@ -128,8 +128,9 @@ public:
/// Get the current Selection colour
wxColour Selection() const { return focused ? sel_focused_colour : sel_colour; }
};
}
class AudioDisplayScrollbar final : public AudioDisplayInteractionObject {
class AudioDisplay::AudioDisplayScrollbar final : public AudioDisplayInteractionObject {
static const int height = 15;
static const int min_width = 10;
@ -267,9 +268,9 @@ public:
}
};
const int AudioDisplayScrollbar::min_width;
const int AudioDisplay::AudioDisplayScrollbar::min_width;
class AudioDisplayTimeline final : public AudioDisplayInteractionObject {
class AudioDisplay::AudioDisplayTimeline final : public AudioDisplayInteractionObject {
int duration = 0; ///< Total duration in ms
double ms_per_pixel = 1.0; ///< Milliseconds per pixel
int pixel_left = 0; ///< Leftmost visible pixel (i.e. scroll position)
@ -478,6 +479,7 @@ public:
}
};
namespace {
class AudioStyleRangeMerger final : public AudioRenderingStyleRanges {
typedef std::map<int, AudioRenderingStyle> style_map;
public:

View file

@ -47,11 +47,6 @@ class AudioRenderer;
class AudioRendererBitmapProvider;
class TimeRange;
// Helper classes used in implementation of the audio display
namespace {
class AudioDisplayScrollbar;
class AudioDisplayTimeline;
}
class AudioDisplayInteractionObject;
class AudioMarkerInteractionObject;
@ -79,9 +74,11 @@ class AudioDisplay: public wxWindow {
agi::AudioProvider *provider = nullptr;
/// Scrollbar helper object
class AudioDisplayScrollbar;
std::unique_ptr<AudioDisplayScrollbar> scrollbar;
/// Timeline helper object
class AudioDisplayTimeline;
std::unique_ptr<AudioDisplayTimeline> timeline;
/// The interaction object for the last-dragged audio marker

View file

@ -390,7 +390,7 @@ int AudioTimingControllerKaraoke::MoveMarker(KaraokeMarker *marker, int new_posi
void AudioTimingControllerKaraoke::AnnounceChanges(int syl) {
if (syl < 0) return;
if (syl == cur_syl || syl == cur_syl + 1) {
if (static_cast<unsigned>(syl) == cur_syl || static_cast<unsigned>(syl) == cur_syl + 1) {
AnnounceUpdatedPrimaryRange();
AnnounceUpdatedStyleRanges();
}

View file

@ -744,8 +744,8 @@ namespace Automation4 {
, can_modify(can_modify)
, can_set_undo(can_set_undo)
{
for (auto& line : ass->Info)
lines.push_back(nullptr);
// for (auto& line : ass->Info) lines.push_back(nullptr);
lines.insert(lines.end(), ass->Info.size(), nullptr);
for (auto& line : ass->Styles)
lines.push_back(&line);
for (auto& line : ass->Events)

View file

@ -24,7 +24,7 @@
#include <boost/gil/gil_all.hpp>
#endif
AGI_DEFINE_EVENT(EVT_COLOR, agi::Color);
AGI_DEFINE_EVENT(EVT_COLOR, agi::Color)
ColourButton::ColourButton(wxWindow *parent, wxSize const& size, bool alpha, agi::Color col, wxValidator const& validator)
: wxButton(parent, -1, "", wxDefaultPosition, wxSize(size.GetWidth() + 6, size.GetHeight() + 6), 0, validator)

View file

@ -22,7 +22,7 @@
/// Emitted by ColourButton when the user picks a new color, with the chosen
/// color set to the event payload
AGI_DECLARE_EVENT(EVT_COLOR, agi::Color);
AGI_DECLARE_EVENT(EVT_COLOR, agi::Color)
/// A button which displays a currently-selected color and lets the user pick
/// a new color when clicked

View file

@ -143,7 +143,7 @@ void DialogAutosave::Populate(std::map<wxString, AutosaveFile> &files_map, std::
auto it = files_map.find(name);
if (it == files_map.end())
it = files_map.insert({name, AutosaveFile{name}}).first;
it = files_map.insert({name, AutosaveFile{name, std::vector<Version>()}}).first;
it->second.versions.push_back(Version{wxFileName(directory, fn).GetFullPath(), date, agi::wxformat(name_fmt, date.Format())});
} while (dir.GetNext(&fn));
}

View file

@ -131,7 +131,6 @@ bool update_video_properties(AssFile *file, const AsyncVideoProvider *new_provid
return true;
case MISMATCH_RESAMPLE:
// Fallthrough to prompt if the AR changed
if (!ar_changed) {
ResampleResolution(file, {
{0, 0, 0, 0},
@ -141,6 +140,8 @@ bool update_video_properties(AssFile *file, const AsyncVideoProvider *new_provid
});
return true;
}
// Fallthrough
// to prompt if the AR changed
case MISMATCH_PROMPT:
int res = prompt(parent, ar_changed, sx, sy, vx, vy);

View file

@ -52,10 +52,9 @@
#include <GL/gl.h>
#endif
namespace {
/// @class OpenGLTextGlyph
/// @brief Struct storing the information needed to draw a glyph
struct OpenGLTextGlyph {
struct OpenGLText::OpenGLTextGlyph {
wxString str; ///< String containing the glyph(s) this is for
int tex = 0; ///< OpenGL texture to draw for this glyph
float x1 = 0; ///< Left x coordinate of this glyph in the containing texture
@ -108,7 +107,7 @@ struct OpenGLTextGlyph {
/// @class OpenGLTextTexture
/// @brief OpenGL texture which stores one or more glyphs as sprites
class OpenGLTextTexture final : boost::noncopyable {
class OpenGLText::OpenGLTextTexture final : boost::noncopyable {
int x = 0; ///< Next x coordinate at which a glyph can be inserted
int y = 0; ///< Next y coordinate at which a glyph can be inserted
int nextY = 0; ///< Y coordinate of the next line; tracked due to that lines
@ -217,8 +216,6 @@ public:
}
};
}
OpenGLText::OpenGLText() { }
OpenGLText::~OpenGLText() { }
@ -286,12 +283,12 @@ void OpenGLText::GetExtent(std::string const& text, int &w, int &h) {
}
}
OpenGLTextGlyph const& OpenGLText::GetGlyph(int i) {
OpenGLText::OpenGLTextGlyph const& OpenGLText::GetGlyph(int i) {
auto res = glyphs.find(i);
return res != glyphs.end() ? res->second : CreateGlyph(i);
}
OpenGLTextGlyph const& OpenGLText::CreateGlyph(int n) {
OpenGLText::OpenGLTextGlyph const& OpenGLText::CreateGlyph(int n) {
OpenGLTextGlyph &glyph = glyphs.emplace(n, OpenGLTextGlyph(n, font)).first->second;
// Insert into some texture

View file

@ -34,16 +34,13 @@
#include <wx/font.h>
namespace {
struct OpenGLTextGlyph;
class OpenGLTextTexture;
}
namespace agi { struct Color; }
typedef boost::container::map<int, OpenGLTextGlyph> glyphMap;
class OpenGLText {
struct OpenGLTextGlyph;
class OpenGLTextTexture;
typedef boost::container::map<int, OpenGLTextGlyph> glyphMap;
float r = 1.f, g = 1.f, b = 1.f, a = 1.f;
int fontSize = 0;

View file

@ -52,10 +52,12 @@ namespace {
{nullptr}
};
#ifdef __WXMAC__
const char *added_hotkeys_minimize[][3] = {
{"app/minimize", "Default", "Ctrl-M"},
{nullptr}
};
#endif
void migrate_hotkeys(const char *added[][3]) {
auto hk_map = hotkey::inst->GetHotkeyMap();

View file

@ -233,6 +233,7 @@ void ResampleResolution(AssFile *ass, ResampleSettings settings) {
switch (settings.ar_mode) {
case ResampleARMode::RemoveBorder:
border_horizontally = !border_horizontally;
// fallthrough
case ResampleARMode::AddBorder:
if (border_horizontally) // Wider/Shorter
settings.margin[LEFT] = settings.margin[RIGHT] = (settings.source_y * new_ar - settings.source_x) / 2;

View file

@ -92,7 +92,7 @@ void CSRISubtitlesProvider::DrawSubtitles(VideoFrame &dst, double time) {
csri_frame frame;
if (dst.flipped) {
frame.planes[0] = dst.data.data() + (dst.height-1) * dst.width * 4;
frame.strides[0] = -(signed)dst.width * 4;
frame.strides[0] = -(ptrdiff_t)dst.width * 4;
}
else {
frame.planes[0] = dst.data.data();
@ -100,7 +100,7 @@ void CSRISubtitlesProvider::DrawSubtitles(VideoFrame &dst, double time) {
}
frame.pixfmt = CSRI_F_BGR_;
csri_fmt format = { frame.pixfmt, dst.width, dst.height };
csri_fmt format = { frame.pixfmt, (unsigned)dst.width, (unsigned)dst.height };
std::lock_guard<std::mutex> lock(csri_mutex);
if (!csri_request_fmt(instance.get(), &format))

View file

@ -47,7 +47,8 @@ IntValidator::IntValidator(int val, bool allow_negative)
}
IntValidator::IntValidator(IntValidator const& rgt)
: value(rgt.value)
: wxValidator(rgt)
, value(rgt.value)
, allow_negative(rgt.allow_negative)
{
SetWindow(rgt.GetWindow());
@ -96,7 +97,8 @@ DoubleValidator::DoubleValidator(double *val, double min, double max)
}
DoubleValidator::DoubleValidator(DoubleValidator const& rgt)
: value(rgt.value)
: wxValidator(rgt)
, value(rgt.value)
, min(rgt.min)
, max(rgt.max)
, decimal_sep(rgt.decimal_sep)