Magic number hunt

classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

Magic number hunt

Johannes Wienke-3
Hi,

now that I can post on this list... ;)

I noticed that we got approx. 3 billion lines containing the magic
numbers 255, 256, 65535 and 65536. We should move them to some
constants, but I don't know to which header. For the digikam core there
is the globals.h, but as far as I can see, this is not included in the
image editor plugins. Any ideas where to place these constants?

Johannes


_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel

signature.asc (268 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Magic number hunt

Gilles Caulier-4
set all constants in global.h and include it to dimg.h. This one is
used everywhere.

note : in kipi-plugins, i can find a lots of kdebug() without debug space.

Gilles.

2009/10/26 Johannes Wienke <[hidden email]>:

> Hi,
>
> now that I can post on this list... ;)
>
> I noticed that we got approx. 3 billion lines containing the magic numbers
> 255, 256, 65535 and 65536. We should move them to some constants, but I
> don't know to which header. For the digikam core there is the globals.h, but
> as far as I can see, this is not included in the image editor plugins. Any
> ideas where to place these constants?
>
> Johannes
>
>
> _______________________________________________
> Digikam-devel mailing list
> [hidden email]
> https://mail.kde.org/mailman/listinfo/digikam-devel
>
>
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

Re: Magic number hunt

Johannes Wienke-3
Am 26.10.2009 20:40 schrieb Gilles Caulier:
> set all constants in global.h and include it to dimg.h. This one is
> used everywhere.

Ok.

> note : in kipi-plugins, i can find a lots of kdebug() without debug space.

Yes, I provided a default area code in the cmake file. If you need a
special area code you can still specify it.

Can I remove the colon (:) from the mailing list's title? Otherwise I
will have the same posting problem every time I reply to a message from
the list.

Johannes.


_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel

signature.asc (268 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Magic number hunt

Gilles Caulier-4
2009/10/26 Johannes Wienke <[hidden email]>:

> Am 26.10.2009 20:40 schrieb Gilles Caulier:
>>
>> set all constants in global.h and include it to dimg.h. This one is
>> used everywhere.
>
> Ok.
>
>> note : in kipi-plugins, i can find a lots of kdebug() without debug space.
>
> Yes, I provided a default area code in the cmake file. If you need a special
> area code you can still specify it.
>

No, you don't understand me. A lots of kDebug() call need to be
registered in debug namespace, typicaly kipi-plugins running space. No
more.

Look in new shwup plugin for ex...

> Can I remove the colon (:) from the mailing list's title? Otherwise I will
> have the same posting problem every time I reply to a message from the list.

yes, no pb...

Gilles
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

Re: Magic number hunt

Johannes Wienke-3
Hi,

Am 26.10.2009 21:13 schrieb Gilles Caulier:

> 2009/10/26 Johannes Wienke <[hidden email]>:
>> Am 26.10.2009 20:40 schrieb Gilles Caulier:
>>> set all constants in global.h and include it to dimg.h. This one is
>>> used everywhere.
>> Ok.
>>
>>> note : in kipi-plugins, i can find a lots of kdebug() without debug space.
>> Yes, I provided a default area code in the cmake file. If you need a special
>> area code you can still specify it.
>>
>
> No, you don't understand me. A lots of kDebug() call need to be
> registered in debug namespace, typicaly kipi-plugins running space. No
> more.
>
> Look in new shwup plugin for ex...
I don't get what you mean.

I replaced every kDebug(51000) with kDebug() but provided a the default
kipi-plugins area code via a compiler flag in the CMakeLists.txt:

SET(AREA_CODE_GENERAL "51000")
SET(AREA_CODE_LOADING "51001")
ADD_DEFINITIONS(-DKDE_DEFAULT_DEBUG_AREA=${AREA_CODE_GENERAL})
ADD_DEFINITIONS(-DAREA_CODE_GENERAL=${AREA_CODE_GENERAL})
ADD_DEFINITIONS(-DAREA_CODE_LOADING=${AREA_CODE_LOADING})

This ensures that all calls to kDebug, kWarn etc. are still sent to
debug area 51000 or 51001.

Or what do you mean?

Johannes


_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel

signature.asc (268 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Magic number hunt

Gilles Caulier-4
Lol. and this one :

http://lxr.kde.org/source/extragear/graphics/kipi-plugins/shwup/swwindow.cpp#363

Try to grep kDebug() on whole kipi-plugins... (:=)))

Gilles

2009/10/26 Johannes Wienke <[hidden email]>:

> Hi,
>
> Am 26.10.2009 21:13 schrieb Gilles Caulier:
>>
>> 2009/10/26 Johannes Wienke <[hidden email]>:
>>>
>>> Am 26.10.2009 20:40 schrieb Gilles Caulier:
>>>>
>>>> set all constants in global.h and include it to dimg.h. This one is
>>>> used everywhere.
>>>
>>> Ok.
>>>
>>>> note : in kipi-plugins, i can find a lots of kdebug() without debug
>>>> space.
>>>
>>> Yes, I provided a default area code in the cmake file. If you need a
>>> special
>>> area code you can still specify it.
>>>
>>
>> No, you don't understand me. A lots of kDebug() call need to be
>> registered in debug namespace, typicaly kipi-plugins running space. No
>> more.
>>
>> Look in new shwup plugin for ex...
>
> I don't get what you mean.
>
> I replaced every kDebug(51000) with kDebug() but provided a the default
> kipi-plugins area code via a compiler flag in the CMakeLists.txt:
>
> SET(AREA_CODE_GENERAL "51000")
> SET(AREA_CODE_LOADING "51001")
> ADD_DEFINITIONS(-DKDE_DEFAULT_DEBUG_AREA=${AREA_CODE_GENERAL})
> ADD_DEFINITIONS(-DAREA_CODE_GENERAL=${AREA_CODE_GENERAL})
> ADD_DEFINITIONS(-DAREA_CODE_LOADING=${AREA_CODE_LOADING})
>
> This ensures that all calls to kDebug, kWarn etc. are still sent to debug
> area 51000 or 51001.
>
> Or what do you mean?
>
> Johannes
>
>
> _______________________________________________
> Digikam-devel mailing list
> [hidden email]
> https://mail.kde.org/mailman/listinfo/digikam-devel
>
>
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

Re: Magic number hunt

Johannes Wienke-3
Am 26.10.2009 21:31 schrieb Gilles Caulier:
> Lol. and this one :
>
> http://lxr.kde.org/source/extragear/graphics/kipi-plugins/shwup/swwindow.cpp#363

What about this line? *confused*

> Try to grep kDebug() on whole kipi-plugins... (:=)))

Eeeeh, sorry, still don't get it? The remove red eyes tool still has got
some area codes in the calls. Somehow they must have gotten through my
regex.

Johannes


_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel

signature.asc (268 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Magic number hunt

Gilles Caulier-4
I suspect that you commit to wrap debug space drop a lot of kdebug,
because i remember to have fixed all kdebug() calls everywhere in
kipi-plugins.

2009/10/26 Johannes Wienke <[hidden email]>:
> Am 26.10.2009 21:31 schrieb Gilles Caulier:
>>
>> Lol. and this one :
>>
>>
>> http://lxr.kde.org/source/extragear/graphics/kipi-plugins/shwup/swwindow.cpp#363
>
> What about this line? *confused*

well, this like must use kipi-plugins run debug space....

>
>> Try to grep kDebug() on whole kipi-plugins... (:=)))
>
> Eeeeh, sorry, still don't get it? The remove red eyes tool still has got
> some area codes in the calls. Somehow they must have gotten through my
> regex.

Look all others plugins. There are a lots of too...

Gilles
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

Re: Magic number hunt

Johannes Wienke-2
Am 26.10.2009 21:42 schrieb Gilles Caulier:
> I suspect that you commit to wrap debug space drop a lot of kdebug,
> because i remember to have fixed all kdebug() calls everywhere in
> kipi-plugins.

With "fixed" you mean "adding the area code"? Then take a look at the
link below.

> 2009/10/26 Johannes Wienke <[hidden email]>:
>> Am 26.10.2009 21:31 schrieb Gilles Caulier:
>>> Lol. and this one :
>>>
>>>
>>> http://lxr.kde.org/source/extragear/graphics/kipi-plugins/shwup/swwindow.cpp#363
>> What about this line? *confused*
>
> well, this like must use kipi-plugins run debug space....

Not, with the -D option for the compiler it must not:
http://www.kdedevelopers.org/node/3171

Johannes


_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel

signature.asc (268 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Magic number hunt

Gilles Caulier-4
Ok, now i understand. great. it's more simple. Sorry for the sound...

Gilles

2009/10/26 Johannes Wienke <[hidden email]>:

> Am 26.10.2009 21:42 schrieb Gilles Caulier:
>>
>> I suspect that you commit to wrap debug space drop a lot of kdebug,
>> because i remember to have fixed all kdebug() calls everywhere in
>> kipi-plugins.
>
> With "fixed" you mean "adding the area code"? Then take a look at the link
> below.
>
>> 2009/10/26 Johannes Wienke <[hidden email]>:
>>>
>>> Am 26.10.2009 21:31 schrieb Gilles Caulier:
>>>>
>>>> Lol. and this one :
>>>>
>>>>
>>>>
>>>> http://lxr.kde.org/source/extragear/graphics/kipi-plugins/shwup/swwindow.cpp#363
>>>
>>> What about this line? *confused*
>>
>> well, this like must use kipi-plugins run debug space....
>
> Not, with the -D option for the compiler it must not:
> http://www.kdedevelopers.org/node/3171
>
> Johannes
>
>
> _______________________________________________
> Digikam-devel mailing list
> [hidden email]
> https://mail.kde.org/mailman/listinfo/digikam-devel
>
>
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

Re: Magic number hunt

Johannes Wienke-3
Am 26.10.2009 21:54 schrieb Gilles Caulier:
> Ok, now i understand. great. it's more simple. Sorry for the sound...

No problem. Should we do the same for digikam, too? Even though we
already have constants for the area codes there, it would simplify the code.

Johannes


_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel

signature.asc (268 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Magic number hunt

Gilles Caulier-4
I think yes...

Gilles

2009/10/26 Johannes Wienke <[hidden email]>:

> Am 26.10.2009 21:54 schrieb Gilles Caulier:
>>
>> Ok, now i understand. great. it's more simple. Sorry for the sound...
>
> No problem. Should we do the same for digikam, too? Even though we already
> have constants for the area codes there, it would simplify the code.
>
> Johannes
>
>
> _______________________________________________
> Digikam-devel mailing list
> [hidden email]
> https://mail.kde.org/mailman/listinfo/digikam-devel
>
>
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel