ObjFW  Check-in [d9739e7692]

Overview
Comment:Make sure even an empty string has a valid C string.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: d9739e769234421aad6882b56c7e7914d8d1e29299daea86b667234088bc6683
User & Date: js on 2011-02-05 14:38:07
Other Links: manifest | tags
Context
2011-02-05
14:44
Make sure that calling -[OFString init] creates a valid empty string. check-in: f7c9951937 user: js tags: trunk
14:38
Make sure even an empty string has a valid C string. check-in: d9739e7692 user: js tags: trunk
12:05
Update .xcodeproj. check-in: c33040ea60 user: js tags: trunk
Changes

Modified src/OFString.m from [8bb8574c87] to [802907aead].

302
303
304
305
306
307
308









309
310
311
312
313
314
315

+ stringWithContentsOfFile: (OFString*)path
		  encoding: (of_string_encoding_t)encoding
{
	return [[[self alloc] initWithContentsOfFile: path
					    encoding: encoding] autorelease];
}










- initWithCString: (const char*)str
{
	return [self initWithCString: str
			    encoding: OF_STRING_ENCODING_UTF_8
			      length: strlen(str)];
}







>
>
>
>
>
>
>
>
>







302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324

+ stringWithContentsOfFile: (OFString*)path
		  encoding: (of_string_encoding_t)encoding
{
	return [[[self alloc] initWithContentsOfFile: path
					    encoding: encoding] autorelease];
}

- init
{
	self = [super init];

	string = "";

	return self;
}

- initWithCString: (const char*)str
{
	return [self initWithCString: str
			    encoding: OF_STRING_ENCODING_UTF_8
			      length: strlen(str)];
}