new compiler warning in master

2016-04-09 Thread Uwe Stöhr

Compiling current git master I get

  InsetSpace.cpp
D:\LyXGit\Master\src\insets\InsetSeparator.cpp(213): warning C4244: 
'+=': conversion from 'double' to 'int', possible loss of data


This was introduced by commit
http://www.lyx.org/trac/changeset/d4ca8d74041094f623cc891a30b4dc537137431c/lyxgit 



Enrico, could you please have a look?

btw. do I have to document something new after your patch?

thanks and regards
Uwe


Re: new compiler warning in master

2016-03-05 Thread Jean-Marc Lasgouttes

Le 05/03/2016 18:51, Uwe Stöhr a écrit :

Am 04.03.2016 um 22:08 schrieb Jean-Marc Lasgouttes:


I can test it but what should I do to verify that it works?


I think it is safe. Just confirm that the warnings are gone.


I can confirmed that the warning is gone.
+1


Great. I pushed it.

JMarc



Re: new compiler warning in master

2016-03-05 Thread Uwe Stöhr

Am 04.03.2016 um 22:08 schrieb Jean-Marc Lasgouttes:


I can test it but what should I do to verify that it works?


I think it is safe. Just confirm that the warnings are gone.


I can confirmed that the warning is gone.
+1

thanks and regards
Uwe


Re: new compiler warning in master

2016-03-04 Thread Jean-Marc Lasgouttes

Le 04/03/2016 01:21, Uwe Stöhr a écrit :

Am 04.03.2016 um 00:26 schrieb Jean-Marc Lasgouttes:


In the meantime I pushed (and then reverted) my patch by mistake.


This fixed the warnings I got.


What about this one?


I can test it but what should I do to verify that it works?


I think it is safe. Just confirm that the warnings are gone.

JMarc



Re: new compiler warning in master

2016-03-04 Thread Enrico Forestieri
On Fri, Mar 04, 2016 at 12:26:11AM +0100, Jean-Marc Lasgouttes wrote:

> Le 04/03/2016 00:14, Jean-Marc Lasgouttes a écrit :
> >>>Nope.
> >>
> >>The attached patch does the trick for me.
> >
> >THe warnings you see are not the same as Uwe's warnings.
> 
> In the meantime I pushed (and then reverted) my patch by mistake.
> 
> What about this one?

This also works for me, of course.

-- 
Enrico


Re: new compiler warning in master

2016-03-03 Thread Uwe Stöhr

Am 04.03.2016 um 00:26 schrieb Jean-Marc Lasgouttes:


In the meantime I pushed (and then reverted) my patch by mistake.


This fixed the warnings I got.


What about this one?


I can test it but what should I do to verify that it works?

regards Uwe


Re: new compiler warning in master

2016-03-03 Thread Jean-Marc Lasgouttes

Le 04/03/2016 00:14, Jean-Marc Lasgouttes a écrit :

Nope.


The attached patch does the trick for me.


THe warnings you see are not the same as Uwe's warnings.


In the meantime I pushed (and then reverted) my patch by mistake.

What about this one?

JMarc



>From 6aad5f2430d8bbeab1a0f5773aadd8646d3af5c0 Mon Sep 17 00:00:00 2001
From: Jean-Marc Lasgouttes 
Date: Mon, 29 Feb 2016 13:06:23 +0100
Subject: [PATCH] Better handling of different int sizes when computing row crc

---
 src/ParagraphMetrics.cpp | 13 +++--
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/src/ParagraphMetrics.cpp b/src/ParagraphMetrics.cpp
index ad217cf..5666091 100644
--- a/src/ParagraphMetrics.cpp
+++ b/src/ParagraphMetrics.cpp
@@ -100,13 +100,14 @@ size_t ParagraphMetrics::computeRowSignature(Row const & row,
 		}
 	}
 
+	pos_type const b1[] = { row.sel_beg, row.sel_end };
+	crc.process_bytes(b1, sizeof(b1));
+
 	Dimension const & d = row.dimension();
-	char_type const b[] = { static_cast(row.sel_beg),
-	static_cast(row.sel_end),
-	row.begin_margin_sel,
-	row.end_margin_sel,
-	d.wid, d.asc, d.des };
-	crc.process_bytes(b, sizeof(b));
+	int const b2[] = { row.begin_margin_sel,
+	   row.end_margin_sel,
+	   d.wid, d.asc, d.des };
+	crc.process_bytes(b2, sizeof(b2));
 	crc.process_bytes(, sizeof(row.separator));
 
 	return crc.checksum();
-- 
2.5.0



Re: new compiler warning in master

2016-03-03 Thread Jean-Marc Lasgouttes

Le 03/03/2016 23:14, Enrico Forestieri a écrit :

On Thu, Mar 03, 2016 at 10:45:59PM +0100, Enrico Forestieri wrote:


On Wed, Mar 02, 2016 at 11:50:01PM +0100, Jean-Marc Lasgouttes wrote:


Le 28/02/2016 21:32, Uwe Stöhr a écrit :

I recompiled LyX completely and get now this warning:

ParagraphMetrics.cpp
D:\LyXGit\Master\src\ParagraphMetrics.cpp(108): warning C4838:
conversion from 'const int' to 'const lyx::char_type' requires a
narrowing conversion


I think the following patch fixes the issue.


Nope.


The attached patch does the trick for me.


THe warnings you see are not the same as Uwe's warnings.

JMarc



Re: new compiler warning in master

2016-03-03 Thread Enrico Forestieri
On Thu, Mar 03, 2016 at 10:45:59PM +0100, Enrico Forestieri wrote:

> On Wed, Mar 02, 2016 at 11:50:01PM +0100, Jean-Marc Lasgouttes wrote:
> 
> > Le 28/02/2016 21:32, Uwe Stöhr a écrit :
> > >I recompiled LyX completely and get now this warning:
> > >
> > >ParagraphMetrics.cpp
> > >D:\LyXGit\Master\src\ParagraphMetrics.cpp(108): warning C4838:
> > >conversion from 'const int' to 'const lyx::char_type' requires a
> > >narrowing conversion
> > 
> > I think the following patch fixes the issue.
> 
> Nope.

The attached patch does the trick for me.

-- 
Enrico
diff --git a/src/ParagraphMetrics.cpp b/src/ParagraphMetrics.cpp
index ad217cf..4a06e15 100644
--- a/src/ParagraphMetrics.cpp
+++ b/src/ParagraphMetrics.cpp
@@ -105,7 +105,9 @@ size_t ParagraphMetrics::computeRowSignature(Row const & 
row,
static_cast(row.sel_end),
row.begin_margin_sel,
row.end_margin_sel,
-   d.wid, d.asc, d.des };
+   static_cast(d.wid),
+   static_cast(d.asc),
+   static_cast(d.des) };
crc.process_bytes(b, sizeof(b));
crc.process_bytes(, sizeof(row.separator));
 


Re: new compiler warning in master

2016-03-03 Thread Enrico Forestieri
On Wed, Mar 02, 2016 at 11:50:01PM +0100, Jean-Marc Lasgouttes wrote:

> Le 28/02/2016 21:32, Uwe Stöhr a écrit :
> >I recompiled LyX completely and get now this warning:
> >
> >ParagraphMetrics.cpp
> >D:\LyXGit\Master\src\ParagraphMetrics.cpp(108): warning C4838:
> >conversion from 'const int' to 'const lyx::char_type' requires a
> >narrowing conversion
> 
> I think the following patch fixes the issue.

Nope.

This is without the patch:

  CXX  ParagraphMetrics.o
../../src/ParagraphMetrics.cpp: In member function ‘size_t 
lyx::ParagraphMetrics::computeRowSignature(const lyx::Row&, const 
lyx::BufferParams&) const’:
../../src/ParagraphMetrics.cpp:108:46: warning: narrowing conversion of 
‘(int)d.lyx::Dimension::wid’ from ‘int’ to ‘lyx::char_type {aka unsigned int}’ 
inside { } [-Wnarrowing]
  d.wid, d.asc, d.des };
  ^
../../src/ParagraphMetrics.cpp:108:46: warning: narrowing conversion of 
‘(int)d.lyx::Dimension::asc’ from ‘int’ to ‘lyx::char_type {aka unsigned int}’ 
inside { } [-Wnarrowing]
../../src/ParagraphMetrics.cpp:108:46: warning: narrowing conversion of 
‘(int)d.lyx::Dimension::des’ from ‘int’ to ‘lyx::char_type {aka unsigned int}’ 
inside { } [-Wnarrowing]


and this is with the patch:


  CXX  ParagraphMetrics.o
../../src/ParagraphMetrics.cpp: In member function ‘size_t 
lyx::ParagraphMetrics::computeRowSignature(const lyx::Row&, const 
lyx::BufferParams&) const’:
../../src/ParagraphMetrics.cpp:109:47: warning: narrowing conversion of 
‘(int)d.lyx::Dimension::wid’ from ‘int’ to ‘lyx::char_type {aka unsigned int}’ 
inside { } [-Wnarrowing]
   d.wid, d.asc, d.des };
   ^
../../src/ParagraphMetrics.cpp:109:47: warning: narrowing conversion of 
‘(int)d.lyx::Dimension::asc’ from ‘int’ to ‘lyx::char_type {aka unsigned int}’ 
inside { } [-Wnarrowing]
../../src/ParagraphMetrics.cpp:109:47: warning: narrowing conversion of 
‘(int)d.lyx::Dimension::des’ from ‘int’ to ‘lyx::char_type {aka unsigned int}’ 
inside { } [-Wnarrowing]


-- 
Enrico


Re: new compiler warning in master

2016-03-02 Thread Jean-Marc Lasgouttes

Le 28/02/2016 21:32, Uwe Stöhr a écrit :

I recompiled LyX completely and get now this warning:

ParagraphMetrics.cpp
D:\LyXGit\Master\src\ParagraphMetrics.cpp(108): warning C4838:
conversion from 'const int' to 'const lyx::char_type' requires a
narrowing conversion


I think the following patch fixes the issue.

JMarc

>From 7d163d4e78e9878b42a36018862a25b211c1a41a Mon Sep 17 00:00:00 2001
From: Jean-Marc Lasgouttes 
Date: Mon, 29 Feb 2016 13:06:23 +0100
Subject: [PATCH] Better handling of different int sizes when computing row crc

---
 src/ParagraphMetrics.cpp | 13 +++--
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/src/ParagraphMetrics.cpp b/src/ParagraphMetrics.cpp
index ad217cf..5a15158 100644
--- a/src/ParagraphMetrics.cpp
+++ b/src/ParagraphMetrics.cpp
@@ -100,13 +100,14 @@ size_t ParagraphMetrics::computeRowSignature(Row const & row,
 		}
 	}
 
+	pos_type const b1[] = { row.sel_beg, row.sel_end };
+	crc.process_bytes(b1, sizeof(b1));
+
 	Dimension const & d = row.dimension();
-	char_type const b[] = { static_cast(row.sel_beg),
-	static_cast(row.sel_end),
-	row.begin_margin_sel,
-	row.end_margin_sel,
-	d.wid, d.asc, d.des };
-	crc.process_bytes(b, sizeof(b));
+	char_type const b2[] = { row.begin_margin_sel,
+	 row.end_margin_sel,
+	 d.wid, d.asc, d.des };
+	crc.process_bytes(b2, sizeof(b2));
 	crc.process_bytes(, sizeof(row.separator));
 
 	return crc.checksum();
-- 
2.5.0



Re: new compiler warning in master

2016-02-29 Thread Jean-Marc Lasgouttes

Le 28/02/16 21:32, Uwe Stöhr a écrit :

I recompiled LyX completely and get now this warning:

ParagraphMetrics.cpp
D:\LyXGit\Master\src\ParagraphMetrics.cpp(108): warning C4838:
conversion from 'const int' to 'const lyx::char_type' requires a
narrowing conversion


I see the problem indeed. I'll try to come up with a patch soon, but I 
do not know what kind of internet access I will have in the coming week.


JMarc



new compiler warning in master

2016-02-28 Thread Uwe Stöhr

I recompiled LyX completely and get now this warning:

ParagraphMetrics.cpp
D:\LyXGit\Master\src\ParagraphMetrics.cpp(108): warning C4838: 
conversion from 'const int' to 'const lyx::char_type' requires a 
narrowing conversion


regards Uwe