Skip to content

Commit

Permalink
Variable name contains "%" will crash LISA maps [Windows only] #2239
Browse files Browse the repository at this point in the history
  • Loading branch information
lixun910 committed Oct 16, 2020
1 parent a63b501 commit 1a3569b
Show file tree
Hide file tree
Showing 27 changed files with 195 additions and 256 deletions.
2 changes: 1 addition & 1 deletion DataViewer/DataViewerDeleteColDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ void DataViewerDeleteColDlg::OnDelete( wxCommandEvent& ev )
int idx = selections[i];
wxString nm = name_to_nm[m_field->GetString(idx)];
int col = table_int->FindColId(nm);
wxLogMessage(nm);
wxLogMessage("%s", nm);

try{
table_int->DeleteCol(col);
Expand Down
2 changes: 1 addition & 1 deletion DataViewer/DataViewerEditFieldPropertiesDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ void DataViewerEditFieldPropertiesDlg::OnCellChanging( wxGridEvent& ev )
wxString msg;
msg << "changing row " << row << ", col " << col << " from ";
msg << cur_str << " to " << new_str;
wxLogMessage(msg);
wxLogMessage("%s", msg);

GdaConst::FieldType type = GdaConst::unknown_type;
wxString type_str = field_grid->GetCellValue(row, COL_T);
Expand Down
2 changes: 1 addition & 1 deletion DialogTools/AddIdVariable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ void AddIdVariable::OnOkClick( wxCommandEvent& event )
return;
}

wxLogMessage(wxString::Format("Try to insert unique id (integer, %s) column in table.", new_id_var_name));
wxLogMessage("%s", wxString::Format("Try to insert unique id (integer, %s) column in table.", new_id_var_name));

int col_insert_pos = 0;
int add_pos = table_int->InsertCol(GdaConst::long64_type,new_id_var_name, col_insert_pos);
Expand Down
6 changes: 3 additions & 3 deletions DialogTools/CatClassifDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -949,8 +949,8 @@ CatClassifState* CatClassifPanel::PromptNew(const CatClassifDef& ccd,
}

wxLogMessage("In CatClassifPanel::PromptNew");
wxLogMessage(_("suggested title:") + suggested_title);
wxLogMessage(_("field name:") + field_name);
wxLogMessage("%s", _("suggested title:") + suggested_title);
wxLogMessage("%s", _("field name:") + field_name);

if (success || (prompt_title_dlg == false && !new_title.IsEmpty()) ) {
cc_data = ccd;
Expand Down Expand Up @@ -1205,7 +1205,7 @@ void CatClassifPanel::OnAssocVarChoice(wxCommandEvent& ev)

wxString cur_fc_str = assoc_var_choice->GetStringSelection();

wxLogMessage(cur_fc_str);
wxLogMessage("%s", cur_fc_str);

bool is_tm_var = table_int->IsColTimeVariant(cur_fc_str);
if (is_tm_var)
Expand Down
6 changes: 3 additions & 3 deletions DialogTools/ConnectDatasourceDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -773,7 +773,7 @@ void ConnectDatasourceDlg::OnOkClick( wxCommandEvent& event )
GdaFrame* gda_frame = GdaFrame::GetGdaFrame();
if (gda_frame) {
gda_frame->OpenProject(ds_file_path.GetFullPath());
wxLogMessage(_("Open project file:") + ds_file_path.GetFullPath());
wxLogMessage("%s", _("Open project file:") + ds_file_path.GetFullPath());
try {
Project* project = gda_frame->GetProject();
wxString layer_name;
Expand Down Expand Up @@ -847,8 +847,8 @@ void ConnectDatasourceDlg::OnOkClick( wxCommandEvent& event )
if (layer_name.IsEmpty())
layer_name = layername;

wxLogMessage(_("Open Datasource:") + datasource->ToString());
wxLogMessage(_("Open Layer:") + layername);
wxLogMessage("%s", _("Open Datasource:") + datasource->ToString());
wxLogMessage("%s", _("Open Layer:") + layername);

SaveRecentDataSource(datasource, layer_name);

Expand Down
8 changes: 4 additions & 4 deletions DialogTools/CreateGridDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ void CreateGridDlg::OnCEdit1Updated( wxCommandEvent& event )
wxLogMessage("In CreateGridDlg::OnCEdit1Updated()");
if (!isCreated) return;
wxString input = m_lower_x->GetValue();
wxLogMessage(input);
wxLogMessage("%s", input);
input.ToDouble(&m_xBot);
EnableItems();

Expand All @@ -481,7 +481,7 @@ void CreateGridDlg::OnCEdit2Updated( wxCommandEvent& event )
wxLogMessage("In CreateGridDlg::OnCEdit2Updated()");
if (!isCreated) return;
wxString input = m_lower_y->GetValue();
wxLogMessage(input);
wxLogMessage("%s", input);
input.ToDouble(&m_yBot);
EnableItems();
}
Expand All @@ -491,7 +491,7 @@ void CreateGridDlg::OnCEdit3Updated( wxCommandEvent& event )
wxLogMessage("In CreateGridDlg::OnCEdit3Updated()");
if (!isCreated) return;
wxString input = m_upper_x->GetValue();
wxLogMessage(input);
wxLogMessage("%s", input);
input.ToDouble(&m_xTop);
EnableItems();
}
Expand All @@ -501,7 +501,7 @@ void CreateGridDlg::OnCEdit4Updated( wxCommandEvent& event )
wxLogMessage("In CreateGridDlg::OnCEdit4Updated()");
if (!isCreated) return;
wxString input = m_upper_y->GetValue();
wxLogMessage(input);
wxLogMessage("%s", input);
input.ToDouble(&m_yTop);
EnableItems();
}
30 changes: 1 addition & 29 deletions DialogTools/CreatingWeightDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -568,8 +568,6 @@ void CreatingWeightDlg::OnCThresholdTextEdit( wxCommandEvent& event )
wxString val = m_threshold->GetValue();
val.Trim(false);
val.Trim(true);

wxLogMessage(val);

int dist_var_type = m_nb_distance_variables->GetSelection();
if (dist_var_type == 0) {
Expand Down Expand Up @@ -612,8 +610,6 @@ void CreatingWeightDlg::OnCBandwidthThresholdTextEdit( wxCommandEvent& event )
wxString val = m_manu_bandwidth->GetValue();
val.Trim(false);
val.Trim(true);

wxLogMessage(val);

int dist_var_type = m_nb_distance_variables->GetSelection();
if (dist_var_type == 0) {
Expand Down Expand Up @@ -661,18 +657,12 @@ void CreatingWeightDlg::OnCThresholdSliderUpdated( wxCommandEvent& event )
if (m_threshold_val > 0) {
FindWindow(XRCID("wxID_OK"))->Enable(true);
}
wxString str_val;
str_val << m_threshold_val;
wxLogMessage(str_val);
} else {
m_threshold_val_multivars = (m_sliderdistance->GetValue() * (m_thres_max_multivars-m_thres_min_multivars)/100.0) + m_thres_min_multivars;
m_threshold->ChangeValue( wxString::Format("%f", (double) m_threshold_val_multivars));
if (m_threshold_val_multivars > 0) {
FindWindow(XRCID("wxID_OK"))->Enable(true);
}
wxString str_val;
str_val << m_threshold_val_multivars;
wxLogMessage(str_val);
}
}

Expand All @@ -689,18 +679,12 @@ void CreatingWeightDlg::OnCBandwidthThresholdSliderUpdated( wxCommandEvent& even
if (m_bandwidth_thres_val > 0) {
m_btn_ok->Enable(true);
}
wxString str_val;
str_val << m_bandwidth_thres_val;
wxLogMessage(str_val);
} else {
m_bandwidth_thres_val_multivars = (m_bandwidth_slider->GetValue() * (m_thres_max_multivars-m_thres_min_multivars)/100.0) + m_thres_min_multivars;
m_manu_bandwidth->ChangeValue( wxString::Format("%f", (double) m_bandwidth_thres_val_multivars));
if (m_bandwidth_thres_val_multivars > 0) {
m_btn_ok->Enable(true);
}
wxString str_val;
str_val << m_bandwidth_thres_val_multivars;
wxLogMessage(str_val);
}
}

Expand Down Expand Up @@ -1043,10 +1027,6 @@ void CreatingWeightDlg::OnXSelected(wxCommandEvent& event )
UpdateTmSelEnableState();
UpdateThresholdValues();
UpdateCreateButtonState();

wxString msg;
msg << _("selected:") << m_X->GetSelection();
wxLogMessage(msg);
}

void CreatingWeightDlg::OnYSelected(wxCommandEvent& event )
Expand All @@ -1066,10 +1046,6 @@ void CreatingWeightDlg::OnYSelected(wxCommandEvent& event )
UpdateTmSelEnableState();
UpdateThresholdValues();
UpdateCreateButtonState();

wxString msg;
msg << "selected:" << m_Y->GetSelection();
wxLogMessage(msg);
}

void CreatingWeightDlg::OnXTmSelected(wxCommandEvent& event )
Expand Down Expand Up @@ -1159,10 +1135,6 @@ void CreatingWeightDlg::OnIdVariableSelected( wxCommandEvent& event )
UpdateThresholdValuesMultiVars();
}
UpdateCreateButtonState();

wxString msg;
msg << _("selected:") << m_id_field->GetSelection();
wxLogMessage(msg);
}

double CreatingWeightDlg::GetBandwidth()
Expand Down Expand Up @@ -1457,7 +1429,7 @@ void CreatingWeightDlg::CreateWeights()
project->SetWorkingDir(new_dir);
}
wxLogMessage("CreateWeights()");
wxLogMessage(outputfile);
wxLogMessage("%s", outputfile);

// 1/2 case social weights:
if (m_nb_weights_type->GetSelection() == 1 &&
Expand Down
2 changes: 1 addition & 1 deletion DialogTools/ExportCsvDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ void ExportCsvDlg::OnOkClick( wxCommandEvent& event )
}
}

wxLogMessage(_("csv file:") + new_csv);
wxLogMessage("%s", _("csv file:") + new_csv);
#ifdef __WIN32__
std::ofstream out_file(new_csv.wc_str(),std::ios::out | std::ios::binary);
#else
Expand Down
2 changes: 1 addition & 1 deletion DialogTools/ExportDataDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ void ExportDataDlg::OnOkClick( wxCommandEvent& event )
datasource_name = ds_name;
GdaConst::DataSourceType ds_type = datasource->GetType();

wxLogMessage(_("ds:") + ds_name);
wxLogMessage("%s", _("ds:") + ds_name);
if (ds_name.length() <= 0 ) {
wxMessageDialog dlg(this, _("Please specify a valid data source name."),
_("Warning"), wxOK | wxICON_WARNING);
Expand Down
14 changes: 7 additions & 7 deletions DialogTools/FieldNameCorrectionDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ wxString ScrolledWidgetsPane::TruncateFieldName(const wxString& old_name,
int max_len)
{
wxLogMessage("ScrolledWidgetsPane::TruncateFieldName");
wxLogMessage(old_name);
wxLogMessage("%s", old_name);
if (GdaConst::datasrc_field_lens.find(ds_type) ==
GdaConst::datasrc_field_lens.end())
{
Expand All @@ -446,14 +446,14 @@ wxString ScrolledWidgetsPane::TruncateFieldName(const wxString& old_name,
new_name << old_name.substr(0, front_chars) << separator
<< old_name.substr(str_len - back_chars);

wxLogMessage(new_name);
wxLogMessage("%s", new_name);
return new_name;
}

wxString ScrolledWidgetsPane::RemoveIllegalChars(const wxString& old_name)
{
wxLogMessage("ScrolledWidgetsPane::RemoveIllegalChars");
wxLogMessage(old_name);
wxLogMessage("%s", old_name);
if (GdaConst::datasrc_field_illegal_regex.find(ds_type) ==
GdaConst::datasrc_field_illegal_regex.end())
{
Expand All @@ -469,15 +469,15 @@ wxString ScrolledWidgetsPane::RemoveIllegalChars(const wxString& old_name)

if (new_name.size()==0) new_name = "NONAME";

wxLogMessage(new_name);
wxLogMessage("%s", new_name);
return new_name;
}


wxString ScrolledWidgetsPane::RenameDupFieldName(const wxString& old_name)
{
wxLogMessage("ScrolledWidgetsPane::RenameDupFieldName");
wxLogMessage(old_name);
wxLogMessage("%s", old_name);

wxString new_name(old_name);

Expand Down Expand Up @@ -509,14 +509,14 @@ wxString ScrolledWidgetsPane::RenameDupFieldName(const wxString& old_name)
new_name = first_part + "_" + last_part;
}
}
wxLogMessage(new_name);
wxLogMessage("%s", new_name);
return new_name;
}

bool ScrolledWidgetsPane::IsFieldNameValid(const wxString& col_name)
{
wxLogMessage("ScrolledWidgetsPane::IsFieldNameValid");
//wxLogMessage(col_name);
//wxLogMessage("%s", col_name);

if ( GdaConst::datasrc_field_lens.find(ds_type) ==
GdaConst::datasrc_field_lens.end() )
Expand Down
21 changes: 9 additions & 12 deletions DialogTools/FieldNewCalcSheetDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ void FieldNewCalcSheetDlg::CreateControls()
{
wxXmlResource::Get()->LoadDialog(this, GetParent(), "IDD_FIELDCALC_SHEET");
m_note = XRCCTRL(*this, "ID_NOTEBOOK", wxNotebook);
}
}

void FieldNewCalcSheetDlg::OnPageChange( wxBookCtrlEvent& event )
{
Expand All @@ -122,25 +122,22 @@ void FieldNewCalcSheetDlg::OnPageChange( wxBookCtrlEvent& event )
else if (tab_idx == 5)
var_sel_idx = pDT->m_result->GetCurrentSelection();

{
{
/*
pSpecial->m_result->SetSelection(var_sel_idx);
pSpecial->m_result->SetSelection(var_sel_idx);
pSpecial->InitFieldChoices();
pUni->m_result->SetSelection(var_sel_idx);
pUni->m_result->SetSelection(var_sel_idx);
pUni->InitFieldChoices();
pBin->m_result->SetSelection(var_sel_idx);
pBin->m_result->SetSelection(var_sel_idx);
pBin->InitFieldChoices();
pLag->m_result->SetSelection(var_sel_idx);
pLag->m_result->SetSelection(var_sel_idx);
pLag->InitFieldChoices();
pRate->m_result->SetSelection(var_sel_idx);
pRate->m_result->SetSelection(var_sel_idx);
pRate->InitFieldChoices();
pDT->m_result->SetSelection(var_sel_idx);
pDT->InitFieldChoices();
pDT->m_result->SetSelection(var_sel_idx);
pDT->InitFieldChoices();
*/
}
wxString msg;
msg << "page idx: " << var_sel_idx;
wxLogMessage(msg);
}

void FieldNewCalcSheetDlg::OnApplyClick( wxCommandEvent& event )
Expand Down
8 changes: 4 additions & 4 deletions DialogTools/RegressionDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ void RegressionDlg::OnRunClick( wxCommandEvent& event )

wxString m_Yname = m_dependent->GetValue();

wxLogMessage(_("y:") + m_Yname);
wxLogMessage("%s", _("y:") + m_Yname);

// Y and X's data
//wxString st;
Expand All @@ -305,7 +305,7 @@ void RegressionDlg::OnRunClick( wxCommandEvent& event )

for (int i=0; i < m_independentlist->GetCount(); i++) {
wxString nm = name_to_nm[m_independentlist->GetString(i)];
wxLogMessage(nm);
wxLogMessage("%s", nm);

int col = table_int->FindColId(nm);
if (col == wxNOT_FOUND) {
Expand Down Expand Up @@ -839,15 +839,15 @@ void RegressionDlg::SetupXNames(bool m_constant_term)
}
void RegressionDlg::OnViewResultsClick( wxCommandEvent& event )
{
wxLogMessage(_("Click RegressionDlg::OnViewResultsClick"));
wxLogMessage("Click RegressionDlg::OnViewResultsClick");
if (m_OpenDump) {
GdaFrame::GetGdaFrame()->DisplayRegression(logReport);
}
}

void RegressionDlg::OnSaveToTxtFileClick( wxCommandEvent& event )
{
wxLogMessage(_("Click RegressionDlg::OnSaveToTxtFileClick"));
wxLogMessage("Click RegressionDlg::OnSaveToTxtFileClick");

if (!m_OpenDump)
return;
Expand Down
2 changes: 1 addition & 1 deletion DialogTools/ReportBugDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ void ReportBugDlg::OnOkClick(wxCommandEvent& event)

wxLogMessage("Submit Bug Report Error:");
wxLogMessage("title:");
wxLogMessage(title);
wxLogMessage("%s", title);
}

void ReportBugDlg::OnCancelClick(wxCommandEvent& event)
Expand Down
Loading

0 comments on commit 1a3569b

Please sign in to comment.