Overview
Comment: | Rename cString to getCString, as this needs to be generated. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
9c420c6cc3bff0175bc3affc7ff7d80d |
User & Date: | js on 2008-12-06 15:14:05 |
Other Links: | manifest | tags |
Context
2008-12-06
| ||
15:22 | Change OFFile API, add OFStream protocol. check-in: f32e7ed452 user: js tags: trunk | |
15:14 | Rename cString to getCString, as this needs to be generated. check-in: 9c420c6cc3 user: js tags: trunk | |
2008-11-30
| ||
15:17 | Clean up imports. check-in: 4b8666fe15 user: js tags: trunk | |
Changes
Modified src/OFString.h from [91deba8372] to [a0c9234128].
︙ | ︙ | |||
68 69 70 71 72 73 74 | */ - initFromWideCString: (const wchar_t*)str; /** * \return The OFString as a C string, if possible (if not, returns NULL). * If not needed anymore, it is usefull to call freeMem:. */ | | | 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | */ - initFromWideCString: (const wchar_t*)str; /** * \return The OFString as a C string, if possible (if not, returns NULL). * If not needed anymore, it is usefull to call freeMem:. */ - (char*)getCString; /** * \return The OFString as a wide C string */ - (wchar_t*)wideCString; /** |
︙ | ︙ |
Modified src/OFString.m from [66c9692dfd] to [a1f83fb4fc].
︙ | ︙ | |||
84 85 86 87 88 89 90 | wmemcpy(string, str, length + 1); } } return self; } | | | 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | wmemcpy(string, str, length + 1); } } return self; } - (char*)getCString { char *str; size_t len; if ((len = wcstombs(NULL, string, 0)) == (size_t)-1) { /* FIXME: Throw exception */ return NULL; |
︙ | ︙ |
Modified tests/OFString/OFString.m from [ca4b87f3ad] to [2882aa104f].
︙ | ︙ | |||
41 42 43 44 45 46 47 | if (![s2 compare: s4]) puts("s2 and s4 match! GOOD!"); else { puts("s2 and s4 don't match!"); return 1; } | | | | | | > | 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 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | if (![s2 compare: s4]) puts("s2 and s4 match! GOOD!"); else { puts("s2 and s4 don't match!"); return 1; } if (!strcmp([[s1 append: s2] getCString], "test123")) puts("s1 appended with s2 is the expected string! GOOD!"); else { puts("s1 appended with s2 is not the expected string!"); return 1; } if (strlen([s1 getCString]) == [s1 length] && [s1 length] == 7) puts("s1 has the expected length. GOOD!"); else { puts("s1 does not have the expected length!"); return 1; } if (!strcmp([[s1 reverse] getCString], "321tset")) puts("Reversed s1 is expected string! GOOD!"); else { puts("Reversed s1 is NOT the expected string!"); return 1; } if (!strcmp([[s1 upper] getCString], "321TSET")) puts("Upper s1 is expected string! GOOD!"); else { puts("Upper s1 is NOT expected string!"); return 1; } if (!strcmp([[s1 lower] getCString], "321tset")) puts("Lower s1 is expected string! GOOD!"); else { puts("Lower s1 is NOT expected string!"); return 1; } /* Also clears all the memory of the returned C strings */ [s1 free]; [s2 free]; [s3 free]; [s4 free]; return 0; } |