[MPlayer-dev-eng] ctype.h functions on win32

Gianluigi Tiesi mplayer at netfarm.it
Sun Oct 14 03:06:39 CEST 2007



I made this little prog to check:

#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>


int main(void)
{
    int i = 0, res = 0;
    for (i = -512; i <= 512; i++)
    {
        res = isspace(i);
        if (res) printf("%d = %d\n", i, res);
    }
    return 0;
}

now results:
[Linux]
9 = 8192
10 = 8192
11 = 8192
12 = 8192
13 = 8192
32 = 8192
275 = 8192
277 = 8192
279 = 8192
281 = 8192
283 = 8192
321 = 8192

[MSVC]
-512 = 8
-510 = 8
-509 = 8
-503 = 8
-496 = 8
-494 = 8
-492 = 8
-489 = 8
-488 = 8
-483 = 8
-481 = 8
-479 = 8
-477 = 8
-471 = 8
-470 = 8
-469 = 8
-465 = 8
-462 = 8
-461 = 8
-456 = 8
-455 = 8
-453 = 8
-447 = 8
-445 = 8
-444 = 8
-439 = 8
-434 = 8
-433 = 8
-431 = 8
-430 = 8
-426 = 8
-422 = 8
-421 = 8
-415 = 8
-413 = 8
-412 = 8
-408 = 8
-407 = 8
-406 = 8
-405 = 8
-402 = 8
-398 = 8
-397 = 8
-391 = 8
-389 = 8
-387 = 8
-385 = 8
-373 = 8
-372 = 8
-370 = 8
-367 = 8
-364 = 8
-355 = 8
-351 = 8
-349 = 8
-346 = 8
-343 = 8
-341 = 8
-338 = 8
-333 = 8
-328 = 8
-324 = 8
-321 = 8
-318 = 8
-310 = 8
-307 = 8
-304 = 8
-303 = 8
-302 = 8
-300 = 8
-299 = 8
-298 = 8
-294 = 8
-293 = 8
-291 = 8
-289 = 8
-287 = 8
-278 = 8
-275 = 8
-272 = 8
-271 = 8
-269 = 8
-267 = 8
-265 = 8
-257 = 8
-256 = 8
-254 = 8
-249 = 8
-247 = 8
-245 = 8
-242 = 8
-238 = 8
-236 = 8
-234 = 8
-231 = 8
-228 = 8
-226 = 8
-225 = 8
-219 = 8
-215 = 8
-213 = 8
-208 = 8
-206 = 8
-205 = 8
-204 = 8
-196 = 8
-195 = 8
-194 = 8
-191 = 8
-190 = 8
-185 = 8
-183 = 8
-181 = 8
-148 = 8
-147 = 8
-142 = 8
-141 = 8
-136 = 8
-132 = 8
9 = 8
10 = 8
11 = 8
12 = 8
13 = 8
32 = 8
266 = 8
267 = 8
268 = 8
269 = 8
270 = 8
289 = 8
417 = 8

[mingw32]
-503 = 8
-502 = 8
-501 = 8
-500 = 8
-499 = 8
-480 = 8
-247 = 8
-246 = 8
-245 = 8
-244 = 8
-243 = 8
-224 = 8
9 = 8
10 = 8
11 = 8
12 = 8
13 = 8
32 = 8
265 = 8
266 = 8
267 = 8
268 = 8
269 = 8

---

As you see the only reasonabe results is the range 9-13 + 32
for values < -127 or > 256 the result is impredictable
and different on other plaform, yes a signed char should fall
out of this 
also islower() and the others have a strange behavior on win32

but an user reported me that using utf8 it gets wrong results
I'm waiting for the problematic sample

I hade some crashes in msvcrt 8, but I don't remember how
since I've forced the compiler to use unsigned char
as default for non qualified char declarations

I have not looked deeply at all calls
but if an uft8 is placed in a >8bit capable var
that obiviously would trigger an isspace() == true
on values that are not currently spaces
utf8 large code point is 10FFFF

Bye

-- 
Gianluigi Tiesi <sherpya at netfarm.it>
EDP Project Leader
Netfarm S.r.l. - http://www.netfarm.it/
Free Software: http://oss.netfarm.it/



More information about the MPlayer-dev-eng mailing list