Overview
Comment: | glibc breaks when trying to use stdio.h and wchar.h. This is stupid, as it's possible you don't ever output a wchar_t and just need wcscmp, but this forces us to always use wprintf when we need a wchar_t somewhere in the file. glibc really is a nightmare. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
0889c2fc55b921f3fe36cd9c8e1c04d3 |
User & Date: | js on 2008-11-26 21:35:03 |
Other Links: | manifest | tags |
Context
2008-11-27
| ||
16:14 | Add lower and upper for OFString. check-in: 2cbf759299 user: js tags: trunk | |
2008-11-26
| ||
21:35 |
glibc breaks when trying to use stdio.h and wchar.h. This is stupid, as it's possible you don't ever output a wchar_t and just need wcscmp, but this forces us to always use wprintf when we need a wchar_t somewhere in the file. glibc really is a nightmare. check-in: 0889c2fc55 user: js tags: trunk | |
21:12 | mbstowcs/wcstombs returns the size of bytes exluding \0, thus add 1. check-in: baeaca9124 user: js tags: trunk | |
Changes
Modified tests/OFList/OFList.m from [cbcfa7ab84] to [e9fc459af1].
1 2 3 4 5 6 7 8 9 10 11 | /* * Copyright (c) 2008 * Jonathan Schleifer <js@webkeks.org> * * All rights reserved. * * This file is part of libobjfw. It may be distributed under the terms of the * Q Public License 1.0, which can be found in the file LICENSE included in * the packaging of this file. */ | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | /* * Copyright (c) 2008 * Jonathan Schleifer <js@webkeks.org> * * All rights reserved. * * This file is part of libobjfw. It may be distributed under the terms of the * Q Public License 1.0, which can be found in the file LICENSE included in * the packaging of this file. */ #define _ISOC99_SOURCE #import <string.h> #import <wchar.h> #import "OFString.h" #import "OFList.h" /* TODO: Do real checks */ const wchar_t *strings[] = { |
︙ | ︙ | |||
35 36 37 38 39 40 41 | [list addNew: [OFString newFromWideCString: strings[0]]]; [list addNew: [OFString newFromWideCString: strings[1]]]; [list addNew: [OFString newFromWideCString: strings[2]]]; for (iter = [list first], i = 0; iter != nil; iter = [iter next], i++) if (!wcscmp([(OFString*)[iter data] wideCString], strings[i])) | | | | | | | | 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | [list addNew: [OFString newFromWideCString: strings[0]]]; [list addNew: [OFString newFromWideCString: strings[1]]]; [list addNew: [OFString newFromWideCString: strings[2]]]; for (iter = [list first], i = 0; iter != nil; iter = [iter next], i++) if (!wcscmp([(OFString*)[iter data] wideCString], strings[i])) wprintf(L"Element %zu is expected element. GOOD!\n", i); else { wprintf(L"Element %zu is not expected element!\n", i); return 1; } if (!wcscmp([(OFString*)[[list first] data] wideCString], strings[0])) wprintf(L"First element is expected element. GOOD!\n"); else { wprintf(L"First element is not expected element!\n"); return 1; } if (!wcscmp([(OFString*)[[list last] data] wideCString], strings[2])) wprintf(L"Last element is expected element. GOOD!\n"); else { wprintf(L"Last element is not expected element!\n"); return 1; } [list freeIncludingData]; return 0; } |
Modified tests/OFXMLFactory/OFXMLFactory.m from [29fddc8f27] to [20703f949d].
1 2 3 4 5 6 7 8 9 10 11 | /* * Copyright (c) 2008 * Jonathan Schleifer <js@webkeks.org> * * All rights reserved. * * This file is part of libobjfw. It may be distributed under the terms of the * Q Public License 1.0, which can be found in the file LICENSE included in * the packaging of this file. */ | | > > | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | /* * Copyright (c) 2008 * Jonathan Schleifer <js@webkeks.org> * * All rights reserved. * * This file is part of libobjfw. It may be distributed under the terms of the * Q Public License 1.0, which can be found in the file LICENSE included in * the packaging of this file. */ #define _ISOC99_SOURCE #import <stdlib.h> #import <string.h> #import <wchar.h> #import "OFXMLFactory.h" inline void check_result(char *result, const char *should) { /* Use wprintf here so we don't mix printf and wprintf! */ if (!strcmp(result, should)) wprintf(L"%s is expected result\n", result); else { wprintf(L"%s is NOT expected result!\n", result); exit(1); } free(result); } inline void |
︙ | ︙ | |||
220 221 222 223 224 225 226 | int main() { test_escape(); test_create_stanza(); test_concat(); | | | 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 | int main() { test_escape(); test_create_stanza(); test_concat(); wprintf(L"== Now testing with wide C strings ==\n"); test_escape_wide(); test_create_stanza_wide(); test_concat_wide(); return 0; } |