2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
7 #include <aros/debug.h>
8 #include "iffparse_intern.h"
10 #define DEBUG_GOODID(x) ;
12 /*****************************************************************************
15 #include <proto/iffparse.h>
17 AROS_LH1(LONG
, GoodID
,
20 AROS_LHA(LONG
, id
, D0
),
23 struct Library
*, IFFParseBase
, 43, IFFParse
)
26 Determines whether an ID is valid according to the IFF specification.
29 id - An IFF chunk ID to be tested.
36 Assumes input to be in local byte order.
46 *****************************************************************************/
59 DEBUG_GOODID(bug("theid: 0x%08lx [%c%c%c%c]\n",
60 id
, theId
[0], theId
[1], theId
[2], theId
[3]));
62 /* If the ID starts with a space, but is not all spaces, then invalid */
63 if((theId
[0] == 0x20) && (id
!= 0x20202020))
65 DEBUG_GOODID(bug("badid 1\n"));
70 Check whether the ID is within the allowed character ranges.
74 if( (theId
[0] < 0x20) || (theId
[0] > 0x7e))
76 DEBUG_GOODID(bug("badid 2\n"));
79 if( (theId
[1] < 0x20) || (theId
[1] > 0x7e))
81 DEBUG_GOODID(bug("badid 3\n"));
84 if( (theId
[2] < 0x20) || (theId
[2] > 0x7e))
86 DEBUG_GOODID(bug("badid 4\n"));
89 if( (theId
[3] < 0x20) || (theId
[3] > 0x7e))
91 DEBUG_GOODID(bug("badid 5\n"));
95 DEBUG_GOODID(bug("goodid\n"));