Angus Leeming wrote:
> Jean-Marc Lasgouttes wrote:
>> Angus> The attached patch squashes the warnings below. I believe that
>> Angus> it completes Jean-Marc's recent attempt to squash all the
>> Angus> warnings over which we have control.
>> I wonder why I missed these. I remember though being surprised to have
>> few things to fix...
> I have a script that strips out most of the noise from my build log.
> Attached. Thereafter, I got rid of a heap of "virtual functions without
> virtual destructor" warnings in the Qt headers by a simple sed command
> and that left the remaining warnings.
>> Concerning the sprintf warning, isn't it possible to use %l instead of
>> a cast?
> I'll try tomorrow.
Actually, I got rid of sprintf entirely and used
convert<string>(column).c_str()
Buffer overflows are an unnecessary evil.
Committing now...
--
Angus
Index: src/BufferView_pimpl.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/BufferView_pimpl.C,v
retrieving revision 1.595
diff -u -p -r1.595 BufferView_pimpl.C
--- src/BufferView_pimpl.C 15 Sep 2005 13:55:45 -0000 1.595
+++ src/BufferView_pimpl.C 5 Oct 2005 08:23:33 -0000
@@ -268,7 +268,7 @@ bool BufferView::Pimpl::loadLyXFile(stri
// Fall through to new load. (Asger)
}
- Buffer * b;
+ Buffer * b = 0;
if (found) {
b = bufferlist.newBuffer(s);
Index: src/text.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/text.C,v
retrieving revision 1.630
diff -u -p -r1.630 text.C
--- src/text.C 3 Oct 2005 12:13:58 -0000 1.630
+++ src/text.C 5 Oct 2005 08:23:34 -0000
@@ -1002,7 +1002,8 @@ void LyXText::setHeightOfRow(pit_type co
if (bv_owner->text() == this) {
if (pit == 0 && row.pos() == 0)
maxasc += 20;
- if (pit + 1 == pars_.size() && row.endpos() == par.size())
+ if (pit + 1 == pit_type(pars_.size()) &&
+ row.endpos() == par.size())
maxdesc += 20;
}
Index: src/frontends/xforms/FormGraphics.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/FormGraphics.C,v
retrieving revision 1.133
diff -u -p -r1.133 FormGraphics.C
--- src/frontends/xforms/FormGraphics.C 16 Jul 2005 16:57:55 -0000 1.133
+++ src/frontends/xforms/FormGraphics.C 5 Oct 2005 08:23:34 -0000
@@ -285,15 +285,15 @@ void FormGraphics::build()
extra_->form);
// set the right default unit
+ defaultUnit = "cm";
switch (lyxrc.default_papersize) {
- case PAPER_DEFAULT: break;
case PAPER_USLETTER:
case PAPER_USLEGAL:
- case PAPER_USEXECUTIVE: defaultUnit = "in"; break;
- case PAPER_A3:
- case PAPER_A4:
- case PAPER_A5:
- case PAPER_B5: defaultUnit = "cm"; break;
+ case PAPER_USEXECUTIVE:
+ defaultUnit = "in";
+ break;
+ default:
+ break;
}
}
Index: src/frontends/xforms/FormParagraph.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/FormParagraph.C,v
retrieving revision 1.106
diff -u -p -r1.106 FormParagraph.C
--- src/frontends/xforms/FormParagraph.C 16 Jul 2005 16:57:55 -0000 1.106
+++ src/frontends/xforms/FormParagraph.C 5 Oct 2005 08:23:34 -0000
@@ -49,13 +49,6 @@ using support::rtrim;
namespace frontend {
-namespace {
-
-string defaultUnit("cm");
-
-} // namespace anon
-
-
typedef FormController<ControlParagraph, FormView<FD_paragraph> > base_class;
FormParagraph::FormParagraph(Dialog & parent)
@@ -106,22 +99,6 @@ void FormParagraph::build()
remove_if(units_vec.begin(), units_vec.end(),
bind(contains<char>, _1, '%'));
units_vec.erase(del, units_vec.end());
-
- // set default unit for custom length
- switch (lyxrc.default_papersize) {
- case PAPER_DEFAULT:
- case PAPER_USLETTER:
- case PAPER_USLEGAL:
- case PAPER_USEXECUTIVE:
- defaultUnit = "in";
- break;
- case PAPER_A3:
- case PAPER_A4:
- case PAPER_A5:
- case PAPER_B5:
- defaultUnit = "cm";
- break;
- }
}
Index: src/frontends/xforms/FormTabular.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/FormTabular.C,v
retrieving revision 1.84
diff -u -p -r1.84 FormTabular.C
--- src/frontends/xforms/FormTabular.C 3 Dec 2004 13:57:49 -0000 1.84
+++ src/frontends/xforms/FormTabular.C 5 Oct 2005 08:23:34 -0000
@@ -20,6 +20,7 @@
#include "controllers/ControlTabular.h"
#include "controllers/helper_funcs.h"
+#include "support/convert.h"
#include "support/lstrings.h"
#include "lyx_forms.h"
@@ -152,7 +153,6 @@ void FormTabular::update()
LyXTabular const & tabular = controller().tabular();
int align;
- char buf[12];
LyXLength pwidth;
string special;
@@ -164,12 +164,12 @@ void FormTabular::update()
fl_activate_object(cell_options_->input_special_multialign);
fl_activate_object(column_options_->input_column_width);
fl_activate_object(column_options_->choice_value_column_width);
- sprintf(buf, "%d", column);
- fl_set_input(dialog_->input_tabular_column, buf);
+ fl_set_input(dialog_->input_tabular_column,
+ convert<string>(column).c_str());
fl_deactivate_object(dialog_->input_tabular_column);
LyXTabular::row_type row = tabular.row_of_cell(cell);
- sprintf(buf, "%d", row + 1);
- fl_set_input(dialog_->input_tabular_row, buf);
+ fl_set_input(dialog_->input_tabular_row,
+ convert<string>(row + 1).c_str());
fl_deactivate_object(dialog_->input_tabular_row);
if (tabular.isMultiColumn(cell)) {
fl_set_button(cell_options_->check_multicolumn, 1);
Index: src/frontends/xforms/FormVSpace.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/FormVSpace.C,v
retrieving revision 1.11
diff -u -p -r1.11 FormVSpace.C
--- src/frontends/xforms/FormVSpace.C 16 Jul 2005 16:57:55 -0000 1.11
+++ src/frontends/xforms/FormVSpace.C 5 Oct 2005 08:23:34 -0000
@@ -213,6 +213,7 @@ void FormVSpace::build()
tooltips().init(dialog_->choice_space, str);
// set default unit for custom length
+ defaultUnit = "cm";
switch (lyxrc.default_papersize) {
case PAPER_DEFAULT:
case PAPER_USLETTER:
@@ -220,11 +221,7 @@ void FormVSpace::build()
case PAPER_USEXECUTIVE:
defaultUnit = "in";
break;
- case PAPER_A3:
- case PAPER_A4:
- case PAPER_A5:
- case PAPER_B5:
- defaultUnit = "cm";
+ default:
break;
}
}