A simple question about compiler warning

Forum for questions and support relating to the 1.24.x releases only.
Locked
User avatar
Normando
Posts: 219
Joined: Sun Aug 17, 2008 5:34 am
Location: Rosario - Argentina

A simple question about compiler warning

Post by Normando »

Hello all (again)!

I have compiled ZM, and get this warning:

Code: Select all

zm_image.cpp: In member function 'void Image::Blend(const Image&, int) const':
zm_image.cpp:779: warning: operation on 'pdest' may be undefined
and this is the code at line 779:

Code: Select all

*pdest++ = (*blend_ptr)[*pdest][*psrc++];
I am concerned about this, because I read the implications, and the results can not be as espected.

Here is a FAQ about this issue, but I don't know how to modify this, because I don't know what reach with it.

http://c-faq.com/expr/evalorder2.html


Another piece of warning is:

Code: Select all

zm_mpeg.cpp: In member function 'void VideoStream::SetupCodec(int, int, int, int, double)':
zm_mpeg.cpp:108: warning: converting to 'int' from 'double'
The function is:

Code: Select all

void VideoStream::SetupCodec( int colours, int width, int height, int bitrate, double frame_rate )
As you can see the argument "frame_rate" is declared as double, but within the function, the following expresion is used:

Code: Select all

c->time_base.den = frame_rate;
I was fixed changing to:

Code: Select all

c->time_base.den = (int)(frame_rate);
Is this correct?

Thank you
mattyo
Posts: 3
Joined: Wed Mar 31, 2010 1:57 pm

Re: A simple question about compiler warning

Post by mattyo »

Hi....
Normando wrote:

Code: Select all

zm_image.cpp: In member function 'void Image::Blend(const Image&, int) const':
zm_image.cpp:779: warning: operation on 'pdest' may be undefined
and this is the code at line 779:

Code: Select all

*pdest++ = (*blend_ptr)[*pdest][*psrc++];
I was wondering about this warning, too. I'm guessing the intent of that code is:

Code: Select all

*pdest = (*blend_ptr)[*pdest][*psrc++];
pdest++;
So, that's what I replaced it with. I don't know yet how it will work.


I did not experience the other warning you mentioned. Perhaps this is because I am compiling the source from the svn repo, or maybe it's just compiler differences.
User avatar
Normando
Posts: 219
Joined: Sun Aug 17, 2008 5:34 am
Location: Rosario - Argentina

Post by Normando »

Hi mttyo.

Thanks for the reply. I will test your code change.

I am using:

Code: Select all

cpp-4.1.2-48.el5
gcc-4.1.2-48.el5
gcc-c++-4.1.2-48.el5
autoconf-2.61-1
automake-1.9.6-2.3.el5
libtool-1.5.22-7.el5_4

and the latest zm code from svn repo (3117)
Locked