[Clam-devel] [PATCH] Enum in DEBUG-mode

Rettenbacher, Bernhard bernhard.rettenbacher at joanneum.at
Wed Jul 25 06:13:06 PDT 2007


Dear CLAM-Developers,

About 1 or 2 months ago, I sent you some patches, one of them was for EAudioFileFormat::FormatFromFilename. You rejected it, because I did break your rules how to handle arrays of structures. Now - as I made a build of the current sources - we had an eye again on this problem:

When calling FormatFromFilename, an array of Enums, containing the possible file extensions, is created. This array is terminated by a {0,0}-pair. In DEBUG-mode, this causes an assertion in Enum::SetValue, because a null string is the stop criterion in the for-loop. So, if the value, you want to set is 0, the code after the for-loop is executed, which is CLAM_ASSERT(false,...). In RELEASE mode, this loop and the assertion are never executed.

Our solution replaces the for loop in Enum::SetValue by a do-while loop, which takes the {0,0}-pair in account.


Cheers,

Bernhard




________________________________
Dipl.-Ing. Bernhard Rettenbacher
JOANNEUM RESEARCH Forschungsgesellschaft mbH
Institut für Angewandte Systemtechnik    Intelligente Akustische Lösungen
Schießstattgasse 14b/1                   A-8010 Graz / AUSTRIA

Tel.: +43 (0)316 876-1634                Fax: +43 (0)316 876-91634
mailto:bernhard.rettenbacher at joanneum.at Web:  <<enum.patch>> http://www.joanneum.at/ias

 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: enum.patch
Type: application/octet-stream
Size: 572 bytes
Desc: enum.patch
URL: <http://lists.clam-project.org/pipermail/clam-devel-clam-project.org/attachments/20070725/8c55d5f0/attachment-0004.obj>


More information about the clam-devel mailing list