Fix build warnings

This commit is contained in:
wangqr 2019-05-11 21:36:34 -04:00
parent c76e410d30
commit ba54e8d12f
6 changed files with 12 additions and 21 deletions

View file

@ -8,7 +8,6 @@ git:
addons:
apt:
sources:
- sourceline: 'ppa:ubuntu-toolchain-r/test'
- sourceline: 'deb https://apt.kitware.com/ubuntu/ xenial main'
key_url: 'https://apt.kitware.com/keys/kitware-archive-latest.asc'
packages:

View file

@ -559,8 +559,7 @@ DialogColorPicker::DialogColorPicker(wxWindow *parent, agi::Color initial_color,
ass_input = new wxTextCtrl(this, -1);
wxSize colorinput_size = ass_input->GetSizeFromTextSize(GetTextExtent(wxS("&H10117B&")));
ass_input->SetMinSize(colorinput_size);
ass_input->SetSize(colorinput_size);
ass_input->SetInitialSize(colorinput_size);
wxSizer *rgb_box = new wxStaticBoxSizer(wxHORIZONTAL, this, _("RGB color"));
wxSizer *hsl_box = new wxStaticBoxSizer(wxVERTICAL, this, _("HSL color"));

View file

@ -110,8 +110,7 @@ int ShowEbuExportConfigurationDialog(wxWindow *owner, EbuExportSettings &s) {
wxRadioBox *tv_standard_box = new wxRadioBox(&d, -1, _("TV standard"), wxDefaultPosition, wxDefaultSize, 6, tv_standards, 0, wxRA_SPECIFY_ROWS);
wxTextCtrl *timecode_offset_entry = new wxTextCtrl(&d, -1, "00:00:00:00");
timecode_offset_entry->SetMinSize(timecode_offset_entry->GetSizeFromTextSize(timecode_offset_entry->GetTextExtent(wxS("00:00:00:00"))));
timecode_offset_entry->SetSize(timecode_offset_entry->GetSizeFromTextSize(timecode_offset_entry->GetTextExtent(wxS("00:00:00:00"))));
timecode_offset_entry->SetInitialSize(timecode_offset_entry->GetSizeFromTextSize(timecode_offset_entry->GetTextExtent(wxS("00:00:00:00"))));
wxCheckBox *inclusive_end_times_check = new wxCheckBox(&d, -1, _("Out-times are inclusive"));
wxString text_encodings[] = {
@ -132,8 +131,7 @@ int ShowEbuExportConfigurationDialog(wxWindow *owner, EbuExportSettings &s) {
};
wxSpinCtrl *max_line_length_ctrl = new wxSpinCtrl(&d, -1, wxString());
max_line_length_ctrl->SetMinSize(max_line_length_ctrl->GetSizeFromTextSize(max_line_length_ctrl->GetTextExtent(wxS("00"))));
max_line_length_ctrl->SetSize(max_line_length_ctrl->GetSizeFromTextSize(max_line_length_ctrl->GetTextExtent(wxS("00"))));
max_line_length_ctrl->SetInitialSize(max_line_length_ctrl->GetSizeFromTextSize(max_line_length_ctrl->GetTextExtent(wxS("00"))));
wxComboBox *wrap_mode_ctrl = new wxComboBox(&d, -1, wrap_modes[0], wxDefaultPosition, wxDefaultSize, 4, wrap_modes, wxCB_DROPDOWN | wxCB_READONLY);
wxCheckBox *translate_alignments_check = new wxCheckBox(&d, -1, _("Translate alignments"));

View file

@ -201,8 +201,7 @@ DialogStyleEditor::DialogStyleEditor(wxWindow *parent, AssStyle *style, agi::Con
margin[i] = new wxSpinCtrl(this, -1, std::to_wstring(style->Margin[i]),
wxDefaultPosition, wxDefaultSize,
wxSP_ARROW_KEYS, 0, 9999, style->Margin[i]);
margin[i]->SetMinSize(margin[i]->GetSizeFromTextSize(GetTextExtent(wxS("0000"))));
margin[i]->SetSize(margin[i]->GetSizeFromTextSize(GetTextExtent(wxS("0000"))));
margin[i]->SetInitialSize(margin[i]->GetSizeFromTextSize(GetTextExtent(wxS("0000"))));
}
Alignment = new wxRadioBox(this, -1, _("Alignment"), wxDefaultPosition, wxDefaultSize, 9, alignValues, 3, wxRA_SPECIFY_COLS);

View file

@ -143,8 +143,7 @@ SubsEditBox::SubsEditBox(wxWindow *parent, agi::Context *context)
top_sizer->Add(effect_box, 3, wxALIGN_CENTER, 5);
char_count = new wxTextCtrl(this, -1, "0", wxDefaultPosition, wxDefaultSize, wxTE_READONLY | wxTE_CENTER);
char_count->SetMinSize(char_count->GetSizeFromTextSize(GetTextExtent(wxS("000"))));
char_count->SetSize(char_count->GetSizeFromTextSize(GetTextExtent(wxS("000"))));
char_count->SetInitialSize(char_count->GetSizeFromTextSize(GetTextExtent(wxS("000"))));
char_count->SetToolTip(_("Number of characters in the longest line of this subtitle."));
top_sizer->Add(char_count, 0, wxALIGN_CENTER, 5);
@ -152,8 +151,7 @@ SubsEditBox::SubsEditBox(wxWindow *parent, agi::Context *context)
middle_left_sizer = new wxBoxSizer(wxHORIZONTAL);
layer = new wxSpinCtrl(this,-1,"",wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS | wxTE_PROCESS_ENTER,0,0x7FFFFFFF,0);
layer->SetMinSize(layer->GetSizeFromTextSize(GetTextExtent(wxS("0"))));
layer->SetSize(layer->GetSizeFromTextSize(GetTextExtent(wxS("0"))));
layer->SetInitialSize(layer->GetSizeFromTextSize(GetTextExtent(wxS("0"))));
layer->SetToolTip(_("Layer number"));
middle_left_sizer->Add(layer, wxSizerFlags().Center());
middle_left_sizer->AddSpacer(5);
@ -252,8 +250,7 @@ SubsEditBox::~SubsEditBox() {
wxTextCtrl *SubsEditBox::MakeMarginCtrl(wxString const& tooltip, int margin, wxString const& commit_msg) {
wxTextCtrl *ctrl = new wxTextCtrl(this, -1, "", wxDefaultPosition, wxDefaultSize, wxTE_CENTRE | wxTE_PROCESS_ENTER, IntValidator());
ctrl->SetMinSize(ctrl->GetSizeFromTextSize(GetTextExtent(wxS("0000"))));
ctrl->SetSize(ctrl->GetSizeFromTextSize(GetTextExtent(wxS("0000"))));
ctrl->SetInitialSize(ctrl->GetSizeFromTextSize(GetTextExtent(wxS("0000"))));
ctrl->SetMaxLength(4);
ctrl->SetToolTip(tooltip);
middle_left_sizer->Add(ctrl, wxSizerFlags().Center());
@ -269,8 +266,7 @@ wxTextCtrl *SubsEditBox::MakeMarginCtrl(wxString const& tooltip, int margin, wxS
TimeEdit *SubsEditBox::MakeTimeCtrl(wxString const& tooltip, TimeField field) {
TimeEdit *ctrl = new TimeEdit(this, -1, c, "", wxDefaultSize, field == TIME_END);
ctrl->SetMinSize(ctrl->GetSizeFromTextSize(GetTextExtent(wxS("0:00:00.000"))));
ctrl->SetSize(ctrl->GetSizeFromTextSize(GetTextExtent(wxS("0:00:00.000"))));
ctrl->SetInitialSize(ctrl->GetSizeFromTextSize(GetTextExtent(wxS("0:00:00.000"))));
ctrl->SetToolTip(tooltip);
Bind(wxEVT_TEXT, [=](wxCommandEvent&) { CommitTimes(field); }, ctrl->GetId());
ctrl->Bind(wxEVT_CHAR_HOOK, time_edit_char_hook);

View file

@ -36,7 +36,7 @@ static const char *get_errstr()
if (!FormatMessageA(
FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
NULL, err, 0, msg, sizeof(msg), NULL))
strcpy(msg, "Unknown Error");
strcpy_s(msg, sizeof(msg), "Unknown Error");
else {
size_t msglen = strlen(msg) - 1;
if (msg[msglen] == '\n')
@ -141,7 +141,7 @@ static void csrilib_enum_dir(const wchar_t *dir)
HANDLE res;
wchar_t buf[MAX_PATH];
_snwprintf(buf, sizeof(buf) / sizeof(buf[0]), L"%ls\\*", dir);
swprintf_s(buf, sizeof(buf) / sizeof(buf[0]), L"%ls\\*", dir);
res = FindFirstFileW(buf, &data);
if (res == INVALID_HANDLE_VALUE) {
subhelp_log(CSRI_LOG_WARNING, "ignoring directory \"%ls\": %s",
@ -153,7 +153,7 @@ static void csrilib_enum_dir(const wchar_t *dir)
do {
if (data.cFileName[0] == '.')
continue;
_snwprintf(buf, sizeof(buf) / sizeof(buf[0]),
swprintf_s(buf, sizeof(buf) / sizeof(buf[0]),
L"%ls\\%ls", dir, data.cFileName);
csrilib_load(buf);
} while (FindNextFileW(res, &data));
@ -169,7 +169,7 @@ void csrilib_os_init()
slash = wcsrchr(filename, L'\\');
slash = slash ? slash + 1 : filename;
*slash = L'\0';
wcsncpy(slash, L"csri", filename + MAX_PATH - slash);
wcscpy_s(slash, filename + MAX_PATH - slash, L"csri");
csrilib_enum_dir(filename);
}