You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openoffice.apache.org by Pavel Janík <Pa...@Janik.cz> on 2012/11/29 20:54:20 UTC

WaE: sw/source/filter/ww8 compiler warnings

Hi,

current trunk issues few warnings in sw/source/filter/ww8:

cc1plus: warnings being treated as errors
/Users/pavel/BUILD/BuildDir/ooo_trunk_src/sw/source/filter/ww8/ww8par3.cxx: In member function ‘SwNumRule* WW8ListManager::GetNumRule(int)’:
/Users/pavel/BUILD/BuildDir/ooo_trunk_src/sw/source/filter/ww8/ww8par3.cxx:1125: warning: comparison between signed and unsigned integer expressions
make: *** [/Users/pavel/BUILD/BuildDir/ooo_trunk_src/solver/350/unxmacxi.pro/workdir/CxxObject/sw/source/filter/ww8/ww8par3.o] Error 1

cc1plus: warnings being treated as errors
/Users/pavel/BUILD/BuildDir/ooo_trunk_src/sw/source/filter/ww8/wrtww8.cxx: In member function ‘void WW8_WrtBookmarks::MoveFieldMarks(sal_uLong, sal_uLong)’:
/Users/pavel/BUILD/BuildDir/ooo_trunk_src/sw/source/filter/ww8/wrtww8.cxx:317: warning: comparison between signed and unsigned integer expressions
/Users/pavel/BUILD/BuildDir/ooo_trunk_src/sw/source/filter/ww8/wrtww8.cxx: In member function ‘int WW8Export::CollectGrfsOfBullets() const’:
/Users/pavel/BUILD/BuildDir/ooo_trunk_src/sw/source/filter/ww8/wrtww8.cxx:1452: warning: comparison between signed and unsigned integer expressions
/Users/pavel/BUILD/BuildDir/ooo_trunk_src/sw/source/filter/ww8/wrtww8.cxx: In member function ‘int WW8Export::GetGrfIndex(const SvxBrushItem&)’:
/Users/pavel/BUILD/BuildDir/ooo_trunk_src/sw/source/filter/ww8/wrtww8.cxx:1535: warning: comparison between signed and unsigned integer expressions
make: *** [/Users/pavel/BUILD/BuildDir/ooo_trunk_src/solver/350/unxmacxi.pro/workdir/CxxObject/sw/source/filter/ww8/wrtww8.o] Error 1

The following patch "fixes" these issues, but I'd like to see author committing the change:

===================================================================
--- wrtww8.cxx	(revision 1415339)
+++ wrtww8.cxx	(working copy)
@@ -314,7 +314,7 @@
     {
         if (aItr->second)
         {
-            if (aItr->second->first == nFrom)
+            if (aItr->second->first == static_cast<long>(nFrom))
             {
                 aItr->second->second.first = true;
                 aItr->second->first = nTo;
@@ -1449,7 +1449,7 @@
 				if ( pGrf )
 				{
 					bool bHas = false;
-					for (int i = 0; i < m_vecBulletPic.size(); ++i)
+					for (unsigned int i = 0; i < m_vecBulletPic.size(); ++i)
 					{
 						if (m_vecBulletPic[i]->GetChecksum() == pGrf->GetChecksum())
 						{
@@ -1532,7 +1532,7 @@
 	int nIndex = -1;
 	if ( rBrush.GetGraphic() )
 	{
-		for (int i = 0; i < m_vecBulletPic.size(); ++i)
+		for (unsigned int i = 0; i < m_vecBulletPic.size(); ++i)
 		{
 			if (m_vecBulletPic[i]->GetChecksum() == rBrush.GetGraphic()->GetChecksum())
 			{
Index: ww8par3.cxx
===================================================================
--- ww8par3.cxx	(revision 1415339)
+++ ww8par3.cxx	(working copy)
@@ -1122,7 +1122,7 @@
 
 SwNumRule* WW8ListManager::GetNumRule(int i)
 {
-	if ( i >= 0 && i < maLSTInfos.size() )
+	if ( i >= 0 && static_cast<sal_Size>(i) < maLSTInfos.size() )
 		return maLSTInfos[i]->pNumRule;
 	else
 		return 0;


-- 
Pavel Janík




Re: WaE: sw/source/filter/ww8 compiler warnings

Posted by Pavel Janík <Pa...@Janik.cz>.
On Dec 4, 2012, at 3:14 AM, chengjh wrote:

> Sure,Pavel, after I have a clean build for this module, I get this warning
> too, and I have already committed the change and don't find any other
> warning..From that,I think my environment on Mac OS X 10.5.8 can identify
> the same warning set with yours, but level is still less than yours because
> I didn't catch any compile errors caused by these warnings.

This is because I have turned on "Warnings Are Errors", WAE with --enable-werror.
-- 
Pavel Janík




Re: WaE: sw/source/filter/ww8 compiler warnings

Posted by chengjh <ch...@apache.org>.
Sure,Pavel, after I have a clean build for this module, I get this warning
too, and I have already committed the change and don't find any other
warning..From that,I think my environment on Mac OS X 10.5.8 can identify
the same warning set with yours, but level is still less than yours because
I didn't catch any compile errors caused by these warnings.Before that,for
there are many output logs during build, the warning messages are mixed
among the output info,easily ignored if not leading to compile error. Now,I
use this way "$build > out.txt" to filter other output info and only
warnings left on the screen. Thus, I can get the compile warnings obviously.

I attach my configure parameter for your comparison. If you think this way
is valuable for other developers, could you please composite them and add
to the build guide as "attention items" when doing AOO build, especially
individual module build, to avoid the same issue in the future?Thanks.

./configure --with-dmake-url="
http://dmake.apache-extras.org.codespot.com/files/dmake-4.12.1.tar.bz2" \
                      --with-epm-url="
http://ftp.easysw.com/pub/epm/3.7/epm-3.7-source.tar.gz" \
                      --disable-mozilla --disable-build-mozilla
--enable-verbose --enable-category-b \
                      --enable-minimizer --enable-presenter-console
--enable-wiki-publisher --disable-odk

On Tue, Dec 4, 2012 at 3:28 AM, Pavel Janík <Pa...@janik.cz> wrote:

> Hi!
>
> On Dec 3, 2012, at 4:18 PM, chengjh wrote:
>
> > I committed some changes to solve the found warnings...Please help to
> > verify again..And I will have a check to the whole sw module to see
> whether
> > any missed warning is still existing.thanks.
>
> thanks. The module is almost clean now.
>
> I only see:
>
> sw/source/filter/ww8/ww8par3.cxx:1125: warning: comparison is always true
> due to limited range of data type
>
> SwNumRule* WW8ListManager::GetNumRule(sal_uInt16 i)
> {
>         if ( i >= 0 && i < maLSTInfos.size() )
>
>
> surely i>=0 when it is unsigned.
> --
> Pavel Janík
>
>
>
>


-- 

Best Regards,Jianhong Cheng

Re: WaE: sw/source/filter/ww8 compiler warnings

Posted by Pavel Janík <Pa...@Janik.cz>.
Hi!

On Dec 3, 2012, at 4:18 PM, chengjh wrote:

> I committed some changes to solve the found warnings...Please help to
> verify again..And I will have a check to the whole sw module to see whether
> any missed warning is still existing.thanks.

thanks. The module is almost clean now.

I only see:

sw/source/filter/ww8/ww8par3.cxx:1125: warning: comparison is always true due to limited range of data type

SwNumRule* WW8ListManager::GetNumRule(sal_uInt16 i)
{
	if ( i >= 0 && i < maLSTInfos.size() )


surely i>=0 when it is unsigned.
-- 
Pavel Janík




Re: WaE: sw/source/filter/ww8 compiler warnings

Posted by chengjh <ch...@apache.org>.
Hi Pavel,

I committed some changes to solve the found warnings...Please help to
verify again..And I will have a check to the whole sw module to see whether
any missed warning is still existing.thanks.

On Fri, Nov 30, 2012 at 3:54 AM, Pavel Janík <Pa...@janik.cz> wrote:

> Hi,
>
> current trunk issues few warnings in sw/source/filter/ww8:
>
> cc1plus: warnings being treated as errors
> /Users/pavel/BUILD/BuildDir/ooo_trunk_src/sw/source/filter/ww8/ww8par3.cxx:
> In member function ‘SwNumRule* WW8ListManager::GetNumRule(int)’:
> /Users/pavel/BUILD/BuildDir/ooo_trunk_src/sw/source/filter/ww8/ww8par3.cxx:1125:
> warning: comparison between signed and unsigned integer expressions
> make: *** [/Users/pavel/BUILD/BuildDir/ooo_trunk_src/solver/350/
> unxmacxi.pro/workdir/CxxObject/sw/source/filter/ww8/ww8par3.o] Error 1
>
> cc1plus: warnings being treated as errors
> /Users/pavel/BUILD/BuildDir/ooo_trunk_src/sw/source/filter/ww8/wrtww8.cxx:
> In member function ‘void WW8_WrtBookmarks::MoveFieldMarks(sal_uLong,
> sal_uLong)’:
> /Users/pavel/BUILD/BuildDir/ooo_trunk_src/sw/source/filter/ww8/wrtww8.cxx:317:
> warning: comparison between signed and unsigned integer expressions
> /Users/pavel/BUILD/BuildDir/ooo_trunk_src/sw/source/filter/ww8/wrtww8.cxx:
> In member function ‘int WW8Export::CollectGrfsOfBullets() const’:
> /Users/pavel/BUILD/BuildDir/ooo_trunk_src/sw/source/filter/ww8/wrtww8.cxx:1452:
> warning: comparison between signed and unsigned integer expressions
> /Users/pavel/BUILD/BuildDir/ooo_trunk_src/sw/source/filter/ww8/wrtww8.cxx:
> In member function ‘int WW8Export::GetGrfIndex(const SvxBrushItem&)’:
> /Users/pavel/BUILD/BuildDir/ooo_trunk_src/sw/source/filter/ww8/wrtww8.cxx:1535:
> warning: comparison between signed and unsigned integer expressions
> make: *** [/Users/pavel/BUILD/BuildDir/ooo_trunk_src/solver/350/
> unxmacxi.pro/workdir/CxxObject/sw/source/filter/ww8/wrtww8.o] Error 1
>
> The following patch "fixes" these issues, but I'd like to see author
> committing the change:
>
> ===================================================================
> --- wrtww8.cxx  (revision 1415339)
> +++ wrtww8.cxx  (working copy)
> @@ -314,7 +314,7 @@
>      {
>          if (aItr->second)
>          {
> -            if (aItr->second->first == nFrom)
> +            if (aItr->second->first == static_cast<long>(nFrom))
>              {
>                  aItr->second->second.first = true;
>                  aItr->second->first = nTo;
> @@ -1449,7 +1449,7 @@
>                                 if ( pGrf )
>                                 {
>                                         bool bHas = false;
> -                                       for (int i = 0; i <
> m_vecBulletPic.size(); ++i)
> +                                       for (unsigned int i = 0; i <
> m_vecBulletPic.size(); ++i)
>                                         {
>                                                 if
> (m_vecBulletPic[i]->GetChecksum() == pGrf->GetChecksum())
>                                                 {
> @@ -1532,7 +1532,7 @@
>         int nIndex = -1;
>         if ( rBrush.GetGraphic() )
>         {
> -               for (int i = 0; i < m_vecBulletPic.size(); ++i)
> +               for (unsigned int i = 0; i < m_vecBulletPic.size(); ++i)
>                 {
>                         if (m_vecBulletPic[i]->GetChecksum() ==
> rBrush.GetGraphic()->GetChecksum())
>                         {
> Index: ww8par3.cxx
> ===================================================================
> --- ww8par3.cxx (revision 1415339)
> +++ ww8par3.cxx (working copy)
> @@ -1122,7 +1122,7 @@
>
>  SwNumRule* WW8ListManager::GetNumRule(int i)
>  {
> -       if ( i >= 0 && i < maLSTInfos.size() )
> +       if ( i >= 0 && static_cast<sal_Size>(i) < maLSTInfos.size() )
>                 return maLSTInfos[i]->pNumRule;
>         else
>                 return 0;
>
>
> --
> Pavel Janík
>
>
>
>


-- 

Best Regards,Jianhong Cheng

Re: WaE: sw/source/filter/ww8 compiler warnings

Posted by chengjh <ch...@apache.org>.
Hi Pavel, this is unnecessary checking, and it will be revised soon..Thanks
for your care.

On Sat, Dec 1, 2012 at 3:19 AM, Pavel Janík <Pa...@janik.cz> wrote:

>
> On Nov 30, 2012, at 8:16 PM, Pavel Janík wrote:
>
> >
> > On Nov 30, 2012, at 12:04 PM, chengjh wrote:
> >
> >> I will have a look.....
> >
> > Next one:
> >
> >
> /Users/pavel/BUILD/BuildDir/ooo_trunk_src/sw/source/filter/ww8/ww8graf.cxx:2749:
> warning: comparison between signed and unsigned integer expressions
>
> What does this code mean?
>
>         if(pObject)
>         {
>                 sal_uInt16 nCount = pObject ? pObject->GetUserDataCount()
> : 0;
>
> ?
> --
> Pavel Janík
>
>
>
>


-- 

Best Regards,Jianhong Cheng

Re: WaE: sw/source/filter/ww8 compiler warnings

Posted by Pavel Janík <Pa...@Janik.cz>.
On Nov 30, 2012, at 8:16 PM, Pavel Janík wrote:

> 
> On Nov 30, 2012, at 12:04 PM, chengjh wrote:
> 
>> I will have a look.....
> 
> Next one:
> 
> /Users/pavel/BUILD/BuildDir/ooo_trunk_src/sw/source/filter/ww8/ww8graf.cxx:2749: warning: comparison between signed and unsigned integer expressions

What does this code mean?

	if(pObject)
	{
		sal_uInt16 nCount = pObject ? pObject->GetUserDataCount() : 0;

?
-- 
Pavel Janík




Re: WaE: sw/source/filter/ww8 compiler warnings

Posted by Pavel Janík <Pa...@Janik.cz>.
On Nov 30, 2012, at 12:04 PM, chengjh wrote:

> I will have a look.....

Next one:

/Users/pavel/BUILD/BuildDir/ooo_trunk_src/sw/source/filter/ww8/ww8graf.cxx:2749: warning: comparison between signed and unsigned integer expressions

-- 
Pavel Janík




Re: WaE: sw/source/filter/ww8 compiler warnings

Posted by chengjh <ch...@apache.org>.
I will have a look.....

On Fri, Nov 30, 2012 at 3:54 AM, Pavel Janík <Pa...@janik.cz> wrote:

> Hi,
>
> current trunk issues few warnings in sw/source/filter/ww8:
>
> cc1plus: warnings being treated as errors
> /Users/pavel/BUILD/BuildDir/ooo_trunk_src/sw/source/filter/ww8/ww8par3.cxx:
> In member function ‘SwNumRule* WW8ListManager::GetNumRule(int)’:
> /Users/pavel/BUILD/BuildDir/ooo_trunk_src/sw/source/filter/ww8/ww8par3.cxx:1125:
> warning: comparison between signed and unsigned integer expressions
> make: *** [/Users/pavel/BUILD/BuildDir/ooo_trunk_src/solver/350/
> unxmacxi.pro/workdir/CxxObject/sw/source/filter/ww8/ww8par3.o] Error 1
>
> cc1plus: warnings being treated as errors
> /Users/pavel/BUILD/BuildDir/ooo_trunk_src/sw/source/filter/ww8/wrtww8.cxx:
> In member function ‘void WW8_WrtBookmarks::MoveFieldMarks(sal_uLong,
> sal_uLong)’:
> /Users/pavel/BUILD/BuildDir/ooo_trunk_src/sw/source/filter/ww8/wrtww8.cxx:317:
> warning: comparison between signed and unsigned integer expressions
> /Users/pavel/BUILD/BuildDir/ooo_trunk_src/sw/source/filter/ww8/wrtww8.cxx:
> In member function ‘int WW8Export::CollectGrfsOfBullets() const’:
> /Users/pavel/BUILD/BuildDir/ooo_trunk_src/sw/source/filter/ww8/wrtww8.cxx:1452:
> warning: comparison between signed and unsigned integer expressions
> /Users/pavel/BUILD/BuildDir/ooo_trunk_src/sw/source/filter/ww8/wrtww8.cxx:
> In member function ‘int WW8Export::GetGrfIndex(const SvxBrushItem&)’:
> /Users/pavel/BUILD/BuildDir/ooo_trunk_src/sw/source/filter/ww8/wrtww8.cxx:1535:
> warning: comparison between signed and unsigned integer expressions
> make: *** [/Users/pavel/BUILD/BuildDir/ooo_trunk_src/solver/350/
> unxmacxi.pro/workdir/CxxObject/sw/source/filter/ww8/wrtww8.o] Error 1
>
> The following patch "fixes" these issues, but I'd like to see author
> committing the change:
>
> ===================================================================
> --- wrtww8.cxx  (revision 1415339)
> +++ wrtww8.cxx  (working copy)
> @@ -314,7 +314,7 @@
>      {
>          if (aItr->second)
>          {
> -            if (aItr->second->first == nFrom)
> +            if (aItr->second->first == static_cast<long>(nFrom))
>              {
>                  aItr->second->second.first = true;
>                  aItr->second->first = nTo;
> @@ -1449,7 +1449,7 @@
>                                 if ( pGrf )
>                                 {
>                                         bool bHas = false;
> -                                       for (int i = 0; i <
> m_vecBulletPic.size(); ++i)
> +                                       for (unsigned int i = 0; i <
> m_vecBulletPic.size(); ++i)
>                                         {
>                                                 if
> (m_vecBulletPic[i]->GetChecksum() == pGrf->GetChecksum())
>                                                 {
> @@ -1532,7 +1532,7 @@
>         int nIndex = -1;
>         if ( rBrush.GetGraphic() )
>         {
> -               for (int i = 0; i < m_vecBulletPic.size(); ++i)
> +               for (unsigned int i = 0; i < m_vecBulletPic.size(); ++i)
>                 {
>                         if (m_vecBulletPic[i]->GetChecksum() ==
> rBrush.GetGraphic()->GetChecksum())
>                         {
> Index: ww8par3.cxx
> ===================================================================
> --- ww8par3.cxx (revision 1415339)
> +++ ww8par3.cxx (working copy)
> @@ -1122,7 +1122,7 @@
>
>  SwNumRule* WW8ListManager::GetNumRule(int i)
>  {
> -       if ( i >= 0 && i < maLSTInfos.size() )
> +       if ( i >= 0 && static_cast<sal_Size>(i) < maLSTInfos.size() )
>                 return maLSTInfos[i]->pNumRule;
>         else
>                 return 0;
>
>
> --
> Pavel Janík
>
>
>
>


-- 

Best Regards,Jianhong Cheng