Comment: | Multiple changes, see details.
* OFObject getMem: renamd to getMemWithSize:. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
b597d49f43757f7b3da49044b2f25ca9 |
User & Date: | js on 2008-10-08 23:15:26 |
Other Links: | manifest | tags |
2008-10-09
| ||
00:25 | Multiple changes, see details. check-in: 7a49441656 user: js tags: trunk | |
2008-10-08
| ||
23:15 | Multiple changes, see details. check-in: b597d49f43 user: js tags: trunk | |
2008-10-07
| ||
22:04 | #import <stdint.h> was missing. check-in: 1c99e71818 user: js tags: trunk | |
Added TODO version [3bc4d8c53a].
|
Modified src/OFCString.h from [b9bde22b67] to [6da69d89f7].
︙ | |||
18 19 20 21 22 23 24 | 18 19 20 21 22 23 24 25 26 27 | - + | { char *string; } - initWithCString: (char*)str; - (char*)cString; - (OFString*)clone; |
Modified src/OFCString.m from [b967cecc4b] to [dae2c6c4a3].
︙ | |||
20 21 22 23 24 25 26 | 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | - + - + | { if ((self = [super init])) { if (str == NULL) { length = 0; string = NULL; } else { length = strlen(str); |
︙ |
Modified src/OFConstCString.h from [d27a028e68] to [275b3732d6].
︙ | |||
15 16 17 18 19 20 21 | 15 16 17 18 19 20 21 22 23 | - + | { const char *string; } - initWithConstCString: (const char*)str; - (const char*)cString; - (OFString*)clone; |
Modified src/OFConstCString.m from [d6fb406d96] to [8e3e77d979].
︙ | |||
33 34 35 36 37 38 39 | 33 34 35 36 37 38 39 40 41 42 43 44 | - + | } - (OFString*)clone { return [OFString newWithConstCString: string]; } |
Modified src/OFConstWideCString.h from [357f188ce4] to [47a8761c52].
︙ | |||
17 18 19 20 21 22 23 | 17 18 19 20 21 22 23 24 25 | - + | { const wchar_t *string; } - initWithConstWideCString: (const wchar_t*)wstr; - (const wchar_t*)wcString; - (OFString*)clone; |
Modified src/OFConstWideCString.m from [1c21e29078] to [700b4e543c].
︙ | |||
33 34 35 36 37 38 39 | 33 34 35 36 37 38 39 40 41 42 43 44 | - + | } - (OFString*)clone { return [OFString newWithConstWideCString: string]; } |
Modified src/OFExceptions.h from [8109e7dcaa] to [03939ec239].
︙ | |||
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | 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 35 36 37 38 39 40 41 42 43 44 45 46 47 | + + + + + + + + + - + - + | * Q Public License 1.0, which can be found in the file LICENSE included in * the packaging of this file. */ #import <stddef.h> #import "OFObject.h" // FIXME: Exceptions should include which type of error occoured (fopen etc.) @interface OFException: OFObject { char *errstr; } + newWithObject: (id)obj; - initWithObject: (id)obj; - free; - (void)raise; - (char*)string; @end @interface OFNoMemException: OFException + newWithObject: (id)obj andSize: (size_t)size; - initWithObject: (id)obj andSize: (size_t)size; @end @interface OFNotImplementedException: OFException + newWithObject: (id)obj |
︙ |
Modified src/OFExceptions.m from [37b58b7cb0] to [6d13800ff5].
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | 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 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 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 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 | + + - + + + + + + + + + + + + + + + + + + + + - + + - - + + - - - + - + - + + + - - + + - - + - - - - - + + + + + + - - + - + + - - + - - + + - - + - - + + - - + - - + + - - | /* * 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. */ #import <stdio.h> #import <stdlib.h> #import "OFExceptions.h" @implementation OFException + newWithObject: (id)obj { return [[OFException alloc] initWithObject: obj]; } - initWithObject: (id)obj { |
Modified src/OFFile.h from [f1d0a00de8] to [fb39a1e440].
︙ | |||
16 17 18 19 20 21 22 23 24 25 | 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | + + + + + + + + + + + - + | @interface OFFile: OFObject { FILE *fp; } + newWithPath: (const char*)path andMode: (const char*)mode; + (int)changeModeOfFile: (const char*)path toMode: (mode_t)mode; + (int)changeOwnerOfFile: (const char*)path toOwner: (uid_t)owner andGroup: (gid_t)group; + (int)delete: (const char*)path; + (int)link: (const char*)src to: (const char*)dest; + (int)symlink: (const char*)src to: (const char*)dest; - initWithPath: (const char*)path andMode: (const char*)mode; - free; |
Modified src/OFFile.m from [485706b49a] to [ab4b7dd898].
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 35 36 37 38 39 40 41 42 43 | 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 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 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 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - + + + + - + - + | /* * 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. */ #import <stdio.h> #import <stdint.h> #import <unistd.h> #import <sys/types.h> #import <sys/stat.h> #import "OFFile.h" #import "OFExceptions.h" @implementation OFFile + newWithPath: (const char*)path andMode: (const char*)mode { return [[OFFile alloc] initWithPath: path andMode: mode]; } + (int)changeModeOfFile: (const char*)path toMode: (mode_t)mode { // FIXME: On error, throw exception return chmod(path, mode); } + (int)changeOwnerOfFile: (const char*)path toOwner: (uid_t)owner andGroup: (gid_t)group { // FIXME: On error, throw exception return chown(path, owner, group); } + (int)delete: (const char*)path { // FIXME: On error, throw exception return unlink(path); } + (int)link: (const char*)src to: (const char*)dest { // FIXME: On error, throw exception return link(src, dest); } + (int)symlink: (const char*)src to: (const char*)dest { // FIXME: On error, throw exception return symlink(src, dest); } - initWithPath: (const char*)path andMode: (const char*)mode { if ((self = [super init])) { if ((fp = fopen(path, mode)) == NULL) { [self free]; return nil; } } return self; } - free { fclose(fp); return [super free]; } |
︙ | |||
91 92 93 94 95 96 97 | 129 130 131 132 133 134 135 136 137 138 139 140 141 142 | - - - + + + | withSize: (size_t)size andNItems: (size_t)nitems { size_t ret; if ((ret = fwrite(buf, size, nitems, fp)) == 0 && size != 0 && nitems != 0) |
Modified src/OFObject.h from [b47bfb1d54] to [20796294ad].
︙ | |||
19 20 21 22 23 24 25 | 19 20 21 22 23 24 25 26 27 28 29 30 31 | - + | @interface OFObject: Object { struct __ofobject_allocated_mem *__mem_pool; } - init; |
Modified src/OFObject.m from [deca1fe096] to [c1de4ea884].
︙ | |||
18 19 20 21 22 23 24 | 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | - + - + - + + - - + + | - init { if ((self = [super init]) != nil) __mem_pool = NULL; return self; } |
︙ | |||
55 56 57 58 59 60 61 | 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 | - - + + - - + + | toSize: (size_t)size { struct __ofobject_allocated_mem *iter; for (iter = __mem_pool; iter != NULL; iter = iter->prev) { if (iter->ptr == ptr) { if ((ptr = realloc(iter->ptr, size)) == NULL) { |
︙ | |||
90 91 92 93 94 95 96 | 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 | - - + + | free(iter); free(ptr); return; } } |
︙ |
Modified src/OFString.h from [9a4ef12426] to [6806a7a1f1].
︙ | |||
18 19 20 21 22 23 24 25 26 27 28 29 | 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | + - + | size_t length; } + newWithConstCString: (const char*)str; + newWithConstWideCString: (const wchar_t*)str; + newWithCString: (char*)str; + newWithWideCString: (wchar_t*)str; - (char*)cString; - (wchar_t*)wcString; - (size_t)length; - (OFString*)setTo: (OFString*)str; - (OFString*)clone; |
Modified src/OFString.m from [7599c02c21] to [a57e73bfa3].
︙ | |||
38 39 40 41 42 43 44 | 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 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 | - - + + - - + + - - + + - + - - + + + - - + + | + newWithWideCString: (wchar_t*)str { return [[OFWideCString alloc] initWithWideCString: str]; } - (char*)cString { |
Modified src/OFWideCString.h from [80e2b819bc] to [3956b2854d].
︙ | |||
18 19 20 21 22 23 24 | 18 19 20 21 22 23 24 25 26 27 | - + | { wchar_t *string; } - initWithWideCString: (wchar_t*)str; - (wchar_t*)wcString; - (OFString*)clone; |
Modified src/OFWideCString.m from [87572356ea] to [581afa2b30].
︙ | |||
20 21 22 23 24 25 26 | 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | + - + - + | { if ((self = [super init])) { if (str == NULL) { length = 0; string = NULL; } else { length = wcslen(str); string = [self getMemWithSize: (length + 1) * |
︙ |
Modified tests/OFObject/OFObject.m from [436ef088ef] to [15b4656509].
︙ | |||
12 13 14 15 16 17 18 | 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 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 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 91 92 93 94 | - - - - - - - - - - - + + + + + + + + + + + + + - + - - - + + + - + - + | #import <stdio.h> #import <stdlib.h> #import <stdbool.h> #import "OFObject.h" #import "OFExceptions.h" |
Modified tests/OFString/OFString.m from [453b60b8cb] to [c0f30552d4].
︙ | |||
25 26 27 28 29 30 31 | 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | - + - + | OFString *s4 = [OFString newWithConstCString: NULL]; [s2 append: [OFString newWithConstCString: "123"]]; s3 = [s1 clone]; [s4 setTo: s2]; |
︙ |
Modified tests/OFWideString/OFWideString.m from [181ff63706] to [1a00935b6a].
︙ | |||
24 25 26 27 28 29 30 | 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | - + - + | OFString *s4 = [OFString newWithConstWideCString: NULL]; [s2 append: [OFString newWithConstWideCString: L"123"]]; s3 = [s1 clone]; [s4 setTo: s2]; |
︙ |