2 Copyright © 1995-2004, 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 *****************************************************************************/
49 AROS_LIBBASE_EXT_DECL(struct Library
*,IFFParseBase
)
60 DEBUG_GOODID(bug("theid: 0x%08lx [%c%c%c%c]\n",
61 id
, theId
[0], theId
[1], theId
[2], theId
[3]));
63 /* If the ID starts with a space, but is not all spaces, then invalid */
64 if((theId
[0] == 0x20) && (id
!= 0x20202020))
66 DEBUG_GOODID(bug("badid 1\n"));
71 Check whether the ID is within the allowed character ranges.
75 if( (theId
[0] < 0x20) || (theId
[0] > 0x7e))
77 DEBUG_GOODID(bug("badid 2\n"));
80 if( (theId
[1] < 0x20) || (theId
[1] > 0x7e))
82 DEBUG_GOODID(bug("badid 3\n"));
85 if( (theId
[2] < 0x20) || (theId
[2] > 0x7e))
87 DEBUG_GOODID(bug("badid 4\n"));
90 if( (theId
[3] < 0x20) || (theId
[3] > 0x7e))
92 DEBUG_GOODID(bug("badid 5\n"));
96 DEBUG_GOODID(bug("goodid\n"));