build went through without compiler errors, but had to make some changes with guesses

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

build went through without compiler errors, but had to make some changes with guesses

Peter Kovacs-3
Hi all,

I am proudly did finish a build tonight.

However I did2 additional Code changes. I do not trust my choice. :P

Both changes targetet to make the compiler happy, and to make a best
shot correctness.

But I do not understand what I changed, I probably did it wrong. :-D


1) packagepixeliterator.hxx line 611

Error:

const int remainder( x(d.x) % num_intraword_positions );

Explanaition: x is an int while d.x is also int because d is a
vigra:Diff2D. The compiler wants to caculate something but interprets x
as a functioncall thus fails.

Fix:

I gave the compiler a valid formula. I thought maybe t is a dif and we
want to move. I decided at random for negative move. Probable positive
(+) would be more wise. Now that I think of it.

But I realy dont know f it is the right way.

const int remainder( (x-d.x) % num_intraword_positions );


2)svptext.cxx in SvpGlyphPeer::RemovingGlyph

Error:

if( rGlyphData.ExtDataRef().mpData != Format::NONE ) -> c++ compile
error: ISO C++ forbids comparison between pointer and integer
<https://stackoverflow.com/questions/2263681/c-compile-error-iso-c-forbids-comparison-between-pointer-and-integer>
Explanation: Format::NONE = 0, so I did not get the -fpermissive flag to
work. So I looked at the code. An alternative that probable makes sense
is to check at this point if something is at all in
rGlyphData.ExtDataRef().mpData.
So instead of checking against Format::None I check now against NULL,
Which the compiler accepted.

I will now try to find out what damage my guesses did. If you have any
Idea how to check or any insight on where I changed code I am gratefull.


One last comment the code in both cases, I miss to see the beauty. I
mean packagepiceliterator has the antipattern of Copy And Paste, while
SvpGlyphPeer::RemovingGlyph tries to delete content from another class.
And that class looks generic, due to the void object I think rGlyphData
itself does not know what it is storing.

I do not like both codeparts.

All the best
Peter
Reply | Threaded
Open this post in threaded view
|

Re: build went through without compiler errors, but had to make some changes with guesses

Don Lewis-2
On 14 Nov, Peter Kovacs wrote:

> Hi all,
>
> I am proudly did finish a build tonight.
>
> However I did2 additional Code changes. I do not trust my choice. :P
>
> Both changes targetet to make the compiler happy, and to make a best
> shot correctness.
>
> But I do not understand what I changed, I probably did it wrong. :-D
>
>
> 1) packagepixeliterator.hxx line 611
>
> Error:
>
> const int remainder( x(d.x) % num_intraword_positions );
>
> Explanaition: x is an int while d.x is also int because d is a
> vigra:Diff2D. The compiler wants to caculate something but interprets x
> as a functioncall thus fails.

I wonder how this ever worked ... maybe this code is never used so
older compilers ignored it.

> Fix:
>
> I gave the compiler a valid formula. I thought maybe t is a dif and we
> want to move. I decided at random for negative move. Probable positive
> (+) would be more wise. Now that I think of it.
>
> But I realy dont know f it is the right way.
>
> const int remainder( (x-d.x) % num_intraword_positions );

Based on the similar set( value_type v, difference_type const & d )
code further down, it looks like + should be used instead of -.


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: build went through without compiler errors, but had to make some changes with guesses

Peter Kovacs-3
I am currently reviewing when the code is used. If it is never used i would like to drop the code without replacement.

Will change the formula to x+d.x if it compiles again I check this one into subversion, only to be on the save side.
Documentation will then be done via bugzilla.


Am 14. November 2017 23:42:39 MEZ schrieb Don Lewis <[hidden email]>:

>On 14 Nov, Peter Kovacs wrote:
>> Hi all,
>>
>> I am proudly did finish a build tonight.
>>
>> However I did2 additional Code changes. I do not trust my choice. :P
>>
>> Both changes targetet to make the compiler happy, and to make a best
>> shot correctness.
>>
>> But I do not understand what I changed, I probably did it wrong. :-D
>>
>>
>> 1) packagepixeliterator.hxx line 611
>>
>> Error:
>>
>> const int remainder( x(d.x) % num_intraword_positions );
>>
>> Explanaition: x is an int while d.x is also int because d is a
>> vigra:Diff2D. The compiler wants to caculate something but interprets
>x
>> as a functioncall thus fails.
>
>I wonder how this ever worked ... maybe this code is never used so
>older compilers ignored it.
>
>> Fix:
>>
>> I gave the compiler a valid formula. I thought maybe t is a dif and
>we
>> want to move. I decided at random for negative move. Probable
>positive
>> (+) would be more wise. Now that I think of it.
>>
>> But I realy dont know f it is the right way.
>>
>> const int remainder( (x-d.x) % num_intraword_positions );
>
>Based on the similar set( value_type v, difference_type const & d )
>code further down, it looks like + should be used instead of -.
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [hidden email]
>For additional commands, e-mail: [hidden email]

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]