CoreFW  Check-in [2121a00059]

Overview
Comment:Add cfw_stream_write_string().
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 2121a0005981f8e42d46ca8fd50e60eb5cfc5d3c8d69c78318fcf6f9afb29efd
User & Date: js on 2012-09-29 22:41:59
Other Links: manifest | tags
Context
2012-09-29
22:50
Add cfw_std{in,out,err}. check-in: 999088161e user: js tags: trunk
22:41
Add cfw_stream_write_string(). check-in: 2121a00059 user: js tags: trunk
22:34
Add tcpsocket. check-in: 17c1d8f6b0 user: js tags: trunk
Changes

Modified src/stream.c from [1f3d504a05] to [5dca9bcc2f].

20
21
22
23
24
25
26


27
28
29
30
31
32
33
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */



#include "stream.h"

static bool
ctor(void *ptr, va_list args)
{
	CFWStream *stream = ptr;








>
>







20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */

#include <string.h>

#include "stream.h"

static bool
ctor(void *ptr, va_list args)
{
	CFWStream *stream = ptr;

63
64
65
66
67
68
69






70
71
72
73
74
75
76
	CFWStream *stream = ptr;

	if (stream == NULL || stream->ops == NULL)
		return false;

	return stream->ops->write(stream, buf, len);
}







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

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







>
>
>
>
>
>







65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
	CFWStream *stream = ptr;

	if (stream == NULL || stream->ops == NULL)
		return false;

	return stream->ops->write(stream, buf, len);
}

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

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

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

Modified src/stream.h from [865b93afd9] to [80dfac9647].

43
44
45
46
47
48
49

50
51
52
	CFWObject obj;
	struct cfw_stream_ops *ops;
} CFWStream;

extern CFWClass *cfw_stream;
extern ssize_t cfw_stream_read(void*, void*, size_t);
extern bool cfw_stream_write(void*, const void*, size_t);

extern bool cfw_stream_eof(void*);
extern void cfw_stream_close(void*);
#endif







>



43
44
45
46
47
48
49
50
51
52
53
	CFWObject obj;
	struct cfw_stream_ops *ops;
} CFWStream;

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