CoreFW  Check-in [168ba16eda]

Overview
Comment:Add cfw_stream_write_line().
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 168ba16edac9e2f1a279e19850896f6057bc02efa2c35fddb3428bae1ee5b3dc
User & Date: js on 2012-09-30 01:02:03
Other Links: manifest | tags
Context
2012-09-30
01:10
Make glibc happy. check-in: f1c55cc298 user: js tags: trunk
01:02
Add cfw_stream_write_line(). check-in: 168ba16eda user: js tags: trunk
01:01
Add cfw_stream_read_line(). check-in: 2cee5ea2d5 user: js tags: trunk
Changes

Modified src/stream.c from [7f07dd8ac4] to [c9268ffce9].

244
245
246
247
248
249
250
























251
252
253
254
255
256
257
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281







+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+







}

bool
cfw_stream_write_string(void *ptr, const char *str)
{
	return cfw_stream_write(ptr, str, strlen(str));
}

bool
cfw_stream_write_line(void *ptr, const char *str)
{
	char *tmp;
	size_t len;

	len = strlen(str);

	if ((tmp = malloc(len + 2)) == NULL)
		return false;

	memcpy(tmp, str, len);
	tmp[len] = '\n';
	tmp[len + 1] = '\0';

	if (!cfw_stream_write(ptr, tmp, len + 1)) {
		free(tmp);
		return false;
	}

	free(tmp);
	return true;
}

bool
cfw_stream_eof(void *ptr)
{
	CFWStream *stream = ptr;

	if (stream == NULL || stream->ops == NULL)

Modified src/stream.h from [768e2d2979] to [677d5c6a56].

48
49
50
51
52
53
54

55
56
57
48
49
50
51
52
53
54
55
56
57
58







+



} CFWStream;

extern CFWClass *cfw_stream;
extern ssize_t cfw_stream_read(void*, void*, size_t);
extern CFWString* cfw_stream_read_line(void*);
extern bool cfw_stream_write(void*, const void*, size_t);
extern bool cfw_stream_write_string(void*, const char*);
extern bool cfw_stream_write_line(void*, const char*);
extern bool cfw_stream_eof(void*);
extern void cfw_stream_close(void*);
#endif