2 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
8 #include <proto/exec.h>
9 #include <dos/dosextens.h>
12 #include <aros/debug.h>
14 BSTR
C2BSTR(CONST_STRPTR src
)
18 dst
= AllocVec(strlen(src
) + 2, MEMF_ANY
);
25 char *BSTR2C(BSTR srcs
)
27 UBYTE
*src
= BADDR(srcs
);
30 dst
= AllocVec(src
[0] + 1, MEMF_ANY
);
33 memcpy (dst
, src
+ 1, src
[0]);
38 BOOL
CMPBSTR(BSTR s1
, BSTR s2
)
40 UBYTE
*ss1
= BADDR(s1
);
41 UBYTE
*ss2
= BADDR(s2
);
42 return memcmp(ss1
, ss2
, ss1
[0] + 1);
44 BOOL
CMPCBSTR(CONST_STRPTR s1
, BSTR s2
)
46 UBYTE
*ss2
= BADDR(s2
);
47 LONG len
= strlen(s1
);
50 return memcmp(s1
, ss2
+ 1, len
);
53 BOOL
CMPICBSTR(CONST_STRPTR s1
, BSTR s2
)
55 int length
= strlen(s1
);
57 if (length
!= AROS_BSTR_strlen(s2
))
60 return strnicmp(s1
, AROS_BSTR_ADDR(s2
), length
);
63 BOOL
CMPNICBSTR(CONST_STRPTR s1
, BSTR s2
, UBYTE length
)
65 if (AROS_BSTR_strlen(s2
) < length
|| strlen(s1
) < length
)
67 return strnicmp(s1
, AROS_BSTR_ADDR(s2
), length
);
70 void BSTR2CINLINE(char *s
)
73 memmove(s
, s
+ 1, len
);
77 void fixfib(struct FileInfoBlock
*fib
)
79 BSTR2CINLINE(fib
->fib_FileName
);
80 BSTR2CINLINE(fib
->fib_Comment
);