gwenhywfar 5.14.1
syncio.c
Go to the documentation of this file.
1/***************************************************************************
2 begin : Tue Apr 27 2010
3 copyright : (C) 2010 by Martin Preuss
4 email : martin@libchipcard.de
5
6 ***************************************************************************
7 * *
8 * This library is free software; you can redistribute it and/or *
9 * modify it under the terms of the GNU Lesser General Public *
10 * License as published by the Free Software Foundation; either *
11 * version 2.1 of the License, or (at your option) any later version. *
12 * *
13 * This library is distributed in the hope that it will be useful, *
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
16 * Lesser General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU Lesser General Public *
19 * License along with this library; if not, write to the Free Software *
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, *
21 * MA 02111-1307 USA *
22 * *
23 ***************************************************************************/
24
25#ifdef HAVE_CONFIG_H
26# include <config.h>
27#endif
28
29#define DISABLE_DEBUGLOG
30
31
32#include "syncio_p.h"
33#include "syncio_file.h"
34#include "syncio_buffered.h"
35
36#include <gwenhywfar/misc.h>
37#include <gwenhywfar/debug.h>
38
39#include <assert.h>
40#include <stdlib.h>
41#include <string.h>
42
43
44
47
48
49
50
51GWEN_SYNCIO *GWEN_SyncIo_new(const char *typeName, GWEN_SYNCIO *baseIo)
52{
53 GWEN_SYNCIO *sio;
54
55 assert(typeName);
57 sio->refCount=1;
60
61 sio->typeName=strdup(typeName);
62 sio->baseIo=baseIo;
63
64 return sio;
65}
66
67
68
70{
71 assert(sio);
72 assert(sio->refCount);
73 sio->refCount++;
74}
75
76
77
79{
80 if (sio) {
81 assert(sio->refCount);
82 if (sio->refCount==1) {
85 GWEN_SyncIo_free(sio->baseIo);
86 free(sio->typeName);
87 sio->refCount=0;
89 }
90 else
91 sio->refCount--;
92 }
93}
94
95
96
98{
99 assert(sio);
100 assert(sio->refCount);
101 if (sio->connectFn)
102 return sio->connectFn(sio);
103 else
104 return 0;
105}
106
107
108
110{
111 assert(sio);
112 assert(sio->refCount);
113 if (sio->disconnectFn)
114 return sio->disconnectFn(sio);
115 else
116 return 0;
117}
118
119
120
122{
123 assert(sio);
124 assert(sio->refCount);
125 if (sio->flushFn)
126 return sio->flushFn(sio);
127 else
128 return 0;
129}
130
131
132
134 uint8_t *buffer,
135 uint32_t size)
136{
137 assert(sio);
138 assert(sio->refCount);
139 if (sio->readFn)
140 return sio->readFn(sio, buffer, size);
141 else
142 return GWEN_ERROR_EOF;
143}
144
145
146
148 const uint8_t *buffer,
149 uint32_t size)
150{
151 assert(sio);
152 assert(sio->refCount);
153 if (sio->writeFn)
154 return sio->writeFn(sio, buffer, size);
155 else
157}
158
159
160
162{
163 assert(sio);
164 assert(sio->refCount);
165 return sio->flags;
166}
167
168
169
170void GWEN_SyncIo_SetFlags(GWEN_SYNCIO *sio, uint32_t fl)
171{
172 assert(sio);
173 assert(sio->refCount);
174 sio->flags=fl;
175}
176
177
178
179void GWEN_SyncIo_AddFlags(GWEN_SYNCIO *sio, uint32_t fl)
180{
181 assert(sio);
182 assert(sio->refCount);
183 sio->flags|=fl;
184}
185
186
187
188void GWEN_SyncIo_SubFlags(GWEN_SYNCIO *sio, uint32_t fl)
189{
190 assert(sio);
191 assert(sio->refCount);
192 sio->flags&=~fl;
193}
194
195
196
198{
199 assert(sio);
200 assert(sio->refCount);
201 return sio->status;
202}
203
204
205
207{
208 assert(sio);
209 assert(sio->refCount);
210 sio->status=st;
211}
212
213
214
216{
217 assert(sio);
218 assert(sio->refCount);
219 return sio->typeName;
220}
221
222
223
225{
226 assert(sio);
227 assert(sio->refCount);
228 return sio->baseIo;
229}
230
231
232
234{
235 GWEN_SYNCIO *baseIo;
236
237 assert(sio);
238 assert(sio->refCount);
239
240 baseIo=sio->baseIo;
241 while (baseIo) {
242 if (baseIo->typeName && strcasecmp(baseIo->typeName, typeName)==0)
243 return baseIo;
244 baseIo=baseIo->baseIo;
245 }
246
247 return NULL;
248}
249
250
251
253{
255
256 assert(sio);
257 assert(sio->refCount);
258 of=sio->connectFn;
259 sio->connectFn=fn;
260 return of;
261}
262
263
264
266{
268
269 assert(sio);
270 assert(sio->refCount);
271 of=sio->disconnectFn;
272 sio->disconnectFn=fn;
273 return of;
274}
275
276
277
279{
281
282 assert(sio);
283 assert(sio->refCount);
284 of=sio->flushFn;
285 sio->flushFn=fn;
286 return of;
287}
288
289
290
292{
294
295 assert(sio);
296 assert(sio->refCount);
297 of=sio->readFn;
298 sio->readFn=fn;
299 return of;
300}
301
302
303
305{
307
308 assert(sio);
309 assert(sio->refCount);
310 of=sio->writeFn;
311 sio->writeFn=fn;
312 return of;
313}
314
315
316
318 const uint8_t *buffer,
319 uint32_t size)
320{
321 if (size==0) {
322 int rv;
323
324 do {
325 rv=GWEN_SyncIo_Write(sio, buffer, size);
326 }
327 while (rv==GWEN_ERROR_INTERRUPTED);
328 if (rv<0) {
329 DBG_INFO(GWEN_LOGDOMAIN, "here (%d)", rv);
330 return rv;
331 }
332 return 0;
333 }
334 else {
335 uint32_t todo;
336
337 todo=size;
338 while (todo) {
339 int rv;
340
341 do {
342 rv=GWEN_SyncIo_Write(sio, buffer, todo);
343 }
344 while (rv==GWEN_ERROR_INTERRUPTED);
345
346 if (rv<0) {
347 DBG_INFO(GWEN_LOGDOMAIN, "here (%d)", rv);
348 return rv;
349 }
350 todo-=rv;
351 buffer+=rv;
352 }
353
354 return size;
355 }
356}
357
358
359
361 uint8_t *buffer,
362 uint32_t size)
363{
364 uint32_t todo;
365
366 todo=size;
367 while (todo) {
368 int rv;
369
370 do {
371 rv=GWEN_SyncIo_Read(sio, buffer, todo);
372 }
373 while (rv==GWEN_ERROR_INTERRUPTED);
374
375 if (rv<0) {
376 DBG_INFO(GWEN_LOGDOMAIN, "here (%d)", rv);
377 return rv;
378 }
379 else if (rv==0) {
380 DBG_ERROR(GWEN_LOGDOMAIN, "EOF met");
381 return GWEN_ERROR_EOF;
382 }
383 todo-=rv;
384 buffer+=rv;
385 }
386
387 return size;
388}
389
390
391
392int GWEN_SyncIo_WriteString(GWEN_SYNCIO *sio, const char *s)
393{
394 int rv;
395
396 rv=GWEN_SyncIo_WriteForced(sio, (const uint8_t *) s, s?strlen(s):0);
397 if (rv<0) {
398 DBG_INFO(GWEN_LOGDOMAIN, "here (%d)", rv);
399 return rv;
400 }
401
402 return 0;
403}
404
405
406
407int GWEN_SyncIo_WriteLine(GWEN_SYNCIO *sio, const char *s)
408{
409 int rv;
410
411 rv=GWEN_SyncIo_WriteString(sio, s);
412 if (rv<0) {
413 DBG_INFO(GWEN_LOGDOMAIN, "here (%d)", rv);
414 return rv;
415 }
416
418 rv=GWEN_SyncIo_WriteForced(sio, (const uint8_t *) "\r\n", 2);
419 else
420 rv=GWEN_SyncIo_WriteForced(sio, (const uint8_t *) "\n", 1);
421 if (rv<0) {
422 DBG_INFO(GWEN_LOGDOMAIN, "here (%d)", rv);
423 return rv;
424 }
425
426 return 0;
427}
428
429
430
432{
433 return GWEN_SyncIo_WriteForced(sio, (const uint8_t *) &s, 1);
434}
435
436
437
439 int maxLines,
440 GWEN_STRINGLIST *sl)
441{
442 GWEN_SYNCIO *sio;
443 GWEN_SYNCIO *baseSio;
444 int rv;
445
446 /* open checksums from file */
449 sio=GWEN_SyncIo_Buffered_new(baseSio);
450
451 rv=GWEN_SyncIo_Connect(sio);
452 if (rv<0) {
453 DBG_INFO(GWEN_LOGDOMAIN, "Could not open file [%s]", fname?fname:"<no filename>");
454 GWEN_SyncIo_free(sio);
455 return rv;
456 }
457
458 /* read up to maxlines lines from file */
459 rv=GWEN_SyncIo_Buffered_ReadLinesToStringList(sio, maxLines, sl);
460 if (rv<0) {
461 DBG_INFO(GWEN_LOGDOMAIN, "Could not open file [%s]", fname?fname:"<no filename>");
463 GWEN_SyncIo_free(sio);
464 return rv;
465 }
466
467 /* close file */
469 GWEN_SyncIo_free(sio);
470 return 0;
471}
472
473
474
475
476int GWEN_SyncIo_Helper_PartiallyReadFile(const char *fName, uint8_t *buffer, uint32_t size)
477{
478 GWEN_SYNCIO *sio;
479 uint32_t todo;
480 int rv;
481
482 /* open file */
485
486 rv=GWEN_SyncIo_Connect(sio);
487 if (rv<0) {
488 DBG_INFO(GWEN_LOGDOMAIN, "Could not open file [%s]", fName?fName:"<no filename>");
489 GWEN_SyncIo_free(sio);
490 return rv;
491 }
492
493 /* read file */
494 todo=size;
495 while (todo) {
496 do {
497 rv=GWEN_SyncIo_Read(sio, buffer, todo);
498 }
499 while (rv==GWEN_ERROR_INTERRUPTED);
500
501 if (rv<0) {
502 DBG_INFO(GWEN_LOGDOMAIN, "here (%d)", rv);
504 GWEN_SyncIo_free(sio);
505 return rv;
506 }
507 else if (rv==0) {
508 DBG_INFO(GWEN_LOGDOMAIN, "EOF met");
509 break;
510 }
511 todo-=rv;
512 buffer+=rv;
513 }
514
515 /* close file */
517 GWEN_SyncIo_free(sio);
518
519 return size-todo;
520}
521
522
523
524int GWEN_SyncIo_Helper_ReadFile(const char *fName, GWEN_BUFFER *dbuf)
525{
526 GWEN_SYNCIO *sio;
527 int rv;
528 int bytesRead=0;
529 int64_t fileSize=0;
530
531 /* open file */
534
535 rv=GWEN_SyncIo_Connect(sio);
536 if (rv<0) {
537 DBG_INFO(GWEN_LOGDOMAIN, "Could not open file [%s]", fName?fName:"<no filename>");
538 GWEN_SyncIo_free(sio);
539 return rv;
540 }
541
544 if (fileSize>GWEN_Buffer_GetMaxUnsegmentedWrite(dbuf))
545 GWEN_Buffer_AllocRoom(dbuf, (uint32_t) fileSize);
546
547 /* read file */
548 while (1) {
549 uint32_t l;
550 uint8_t *p;
551
552 GWEN_Buffer_AllocRoom(dbuf, 4096);
554 p=(uint8_t *) GWEN_Buffer_GetPosPointer(dbuf);
555
556 do {
557 rv=GWEN_SyncIo_Read(sio, p, l);
558 }
559 while (rv==GWEN_ERROR_INTERRUPTED);
560
561 if (rv<0) {
562 DBG_INFO(GWEN_LOGDOMAIN, "here (%d)", rv);
564 GWEN_SyncIo_free(sio);
565 return rv;
566 }
567 else if (rv==0) {
568 DBG_INFO(GWEN_LOGDOMAIN, "EOF met");
569 break;
570 }
571 bytesRead+=rv;
572
573 GWEN_Buffer_IncrementPos(dbuf, rv);
575 }
576
577 /* close file */
579 GWEN_SyncIo_free(sio);
580
581 return bytesRead;
582}
583
584
585
586int GWEN_SyncIo_Helper_WriteFile(const char *fName, const uint8_t *ptrSource, uint64_t lenSource)
587{
588 GWEN_SYNCIO *sio;
589 int rv;
590 int64_t bytesWritten=0;
591 int64_t bytesLeft;
592
593 /* open file */
598
599 rv=GWEN_SyncIo_Connect(sio);
600 if (rv<0) {
601 DBG_INFO(GWEN_LOGDOMAIN, "Could not open file [%s]", fName?fName:"<no filename>");
602 GWEN_SyncIo_free(sio);
603 return rv;
604 }
605
606 /* write file */
607 bytesLeft=lenSource;
608 while (bytesLeft>0) {
609 do {
610 rv=GWEN_SyncIo_Write(sio, ptrSource, bytesLeft);
611 }
612 while (rv==GWEN_ERROR_INTERRUPTED);
613
614 if (rv<0) {
615 DBG_INFO(GWEN_LOGDOMAIN, "here (%d)", rv);
617 GWEN_SyncIo_free(sio);
618 return rv;
619 }
620 else if (rv==0) {
621 DBG_INFO(GWEN_LOGDOMAIN, "Nothing written");
623 GWEN_SyncIo_free(sio);
624 return GWEN_ERROR_IO;
625 }
626 ptrSource+=rv;
627 bytesWritten+=rv;
628 bytesLeft-=rv;
629 }
630
631 /* close file */
633 GWEN_SyncIo_free(sio);
634
635 return bytesWritten;
636}
637
638
639
640int GWEN_SyncIo_Helper_CopyFile(const char *srcPath, const char *destPath)
641{
642 GWEN_SYNCIO *sioRead;
643 GWEN_SYNCIO *sioWrite;
644 int rv;
645 int bytesRead=0;
646
649 rv=GWEN_SyncIo_Connect(sioRead);
650 if (rv<0) {
651 DBG_INFO(GWEN_LOGDOMAIN, "Could not open file [%s]", srcPath?srcPath:"<no filename>");
652 GWEN_SyncIo_free(sioRead);
653 return rv;
654 }
655
658 rv=GWEN_SyncIo_Connect(sioWrite);
659 if (rv<0) {
660 DBG_INFO(GWEN_LOGDOMAIN, "Could not create destination file [%s]", destPath?destPath:"<no filename>");
661 GWEN_SyncIo_free(sioWrite);
662 GWEN_SyncIo_Disconnect(sioRead);
663 GWEN_SyncIo_free(sioRead);
664 return rv;
665 }
666
667 /* read file */
668 while (1) {
669 uint8_t transferBuffer[1024];
670 uint32_t l;
671 uint8_t *p;
672
673 p=transferBuffer;
674 l=sizeof(transferBuffer);
675 do {
676 rv=GWEN_SyncIo_Read(sioRead, p, l);
677 }
678 while (rv==GWEN_ERROR_INTERRUPTED);
679
680 if (rv<0) {
681 DBG_INFO(GWEN_LOGDOMAIN, "here (%d)", rv);
682 GWEN_SyncIo_Disconnect(sioWrite);
683 GWEN_SyncIo_free(sioWrite);
684 GWEN_SyncIo_Disconnect(sioRead);
685 GWEN_SyncIo_free(sioRead);
686 return rv;
687 }
688 else if (rv==0) {
689 DBG_INFO(GWEN_LOGDOMAIN, "EOF met");
690 break;
691 }
692 bytesRead+=rv;
693
694 rv=GWEN_SyncIo_WriteForced(sioWrite, transferBuffer, rv);
695 if (rv<0) {
696 DBG_INFO(GWEN_LOGDOMAIN, "here (%d)", rv);
697 GWEN_SyncIo_Disconnect(sioWrite);
698 GWEN_SyncIo_free(sioWrite);
699 GWEN_SyncIo_Disconnect(sioRead);
700 GWEN_SyncIo_free(sioRead);
701 return rv;
702 }
703 }
704
705 /* close file */
706 rv=GWEN_SyncIo_Disconnect(sioWrite);
707 if (rv<0) {
708 DBG_INFO(GWEN_LOGDOMAIN, "here (%d)", rv);
709 GWEN_SyncIo_Disconnect(sioWrite);
710 GWEN_SyncIo_free(sioWrite);
711 GWEN_SyncIo_Disconnect(sioRead);
712 GWEN_SyncIo_free(sioRead);
713 return rv;
714 }
715
716 GWEN_SyncIo_free(sioWrite);
717 GWEN_SyncIo_Disconnect(sioRead);
718 GWEN_SyncIo_free(sioRead);
719
720 return bytesRead;
721}
722
723
724
725
#define NULL
Definition binreloc.c:300
int GWEN_Buffer_IncrementPos(GWEN_BUFFER *bf, uint32_t i)
Definition buffer.c:451
uint32_t GWEN_Buffer_GetMaxUnsegmentedWrite(GWEN_BUFFER *bf)
Definition buffer.c:527
int GWEN_Buffer_AdjustUsedBytes(GWEN_BUFFER *bf)
Definition buffer.c:468
char * GWEN_Buffer_GetPosPointer(const GWEN_BUFFER *bf)
Definition buffer.c:548
int GWEN_Buffer_AllocRoom(GWEN_BUFFER *bf, uint32_t size)
Definition buffer.c:285
#define DBG_INFO(dbg_logger, format,...)
Definition debug.h:181
#define DBG_ERROR(dbg_logger, format,...)
Definition debug.h:97
#define GWEN_ERROR_IO
Definition error.h:123
#define GWEN_ERROR_BROKEN_PIPE
Definition error.h:75
#define GWEN_ERROR_INTERRUPTED
Definition error.h:74
#define GWEN_ERROR_EOF
Definition error.h:96
struct GWEN_BUFFER GWEN_BUFFER
A dynamically resizeable text buffer.
Definition buffer.h:38
#define GWEN_INHERIT_FUNCTIONS(t)
Definition inherit.h:163
#define GWEN_INHERIT_INIT(t, element)
Definition inherit.h:223
#define GWEN_INHERIT_FINI(t, element)
Definition inherit.h:238
#define GWEN_LIST_FINI(t, element)
Definition list1.h:475
#define GWEN_LIST_FUNCTIONS(t, pr)
Definition list1.h:367
#define GWEN_LIST_INIT(t, element)
Definition list1.h:466
#define GWEN_LOGDOMAIN
Definition logger.h:32
#define GWEN_FREE_OBJECT(varname)
Definition memory.h:61
#define GWEN_NEW_OBJECT(typ, varname)
Definition memory.h:55
struct GWEN_STRINGLISTSTRUCT GWEN_STRINGLIST
Definition stringlist.h:56
void GWEN_SyncIo_SetFlags(GWEN_SYNCIO *sio, uint32_t fl)
Definition syncio.c:170
uint32_t GWEN_SyncIo_GetFlags(const GWEN_SYNCIO *sio)
Definition syncio.c:161
int GWEN_SyncIo_WriteString(GWEN_SYNCIO *sio, const char *s)
Definition syncio.c:392
int GWEN_SyncIo_Connect(GWEN_SYNCIO *sio)
Definition syncio.c:97
void GWEN_SyncIo_AddFlags(GWEN_SYNCIO *sio, uint32_t fl)
Definition syncio.c:179
GWEN_SYNCIO * GWEN_SyncIo_new(const char *typeName, GWEN_SYNCIO *baseIo)
Definition syncio.c:51
int GWEN_SyncIo_Helper_WriteFile(const char *fName, const uint8_t *ptrSource, uint64_t lenSource)
Definition syncio.c:586
int GWEN_SyncIo_Helper_ReadFileToStringList(const char *fname, int maxLines, GWEN_STRINGLIST *sl)
Definition syncio.c:438
int GWEN_SyncIo_Write(GWEN_SYNCIO *sio, const uint8_t *buffer, uint32_t size)
Definition syncio.c:147
GWEN_SYNCIO_READ_FN GWEN_SyncIo_SetReadFn(GWEN_SYNCIO *sio, GWEN_SYNCIO_READ_FN fn)
Definition syncio.c:291
GWEN_SYNCIO_FLUSH_FN GWEN_SyncIo_SetFlushFn(GWEN_SYNCIO *sio, GWEN_SYNCIO_FLUSH_FN fn)
Definition syncio.c:278
void GWEN_SyncIo_Attach(GWEN_SYNCIO *sio)
Definition syncio.c:69
GWEN_SYNCIO * GWEN_SyncIo_GetBaseIo(const GWEN_SYNCIO *sio)
Definition syncio.c:224
int GWEN_SyncIo_ReadForced(GWEN_SYNCIO *sio, uint8_t *buffer, uint32_t size)
Definition syncio.c:360
GWEN_SYNCIO_DISCONNECT_FN GWEN_SyncIo_SetDisconnectFn(GWEN_SYNCIO *sio, GWEN_SYNCIO_DISCONNECT_FN fn)
Definition syncio.c:265
void GWEN_SyncIo_SubFlags(GWEN_SYNCIO *sio, uint32_t fl)
Definition syncio.c:188
int GWEN_SyncIo_Helper_CopyFile(const char *srcPath, const char *destPath)
Definition syncio.c:640
int GWEN_SyncIo_Helper_PartiallyReadFile(const char *fName, uint8_t *buffer, uint32_t size)
Definition syncio.c:476
GWEN_SYNCIO * GWEN_SyncIo_GetBaseIoByTypeName(const GWEN_SYNCIO *sio, const char *typeName)
Definition syncio.c:233
int GWEN_SyncIo_WriteChar(GWEN_SYNCIO *sio, char s)
Definition syncio.c:431
int GWEN_SyncIo_Helper_ReadFile(const char *fName, GWEN_BUFFER *dbuf)
Definition syncio.c:524
GWEN_SYNCIO_WRITE_FN GWEN_SyncIo_SetWriteFn(GWEN_SYNCIO *sio, GWEN_SYNCIO_WRITE_FN fn)
Definition syncio.c:304
int GWEN_SyncIo_WriteLine(GWEN_SYNCIO *sio, const char *s)
Definition syncio.c:407
int GWEN_SyncIo_WriteForced(GWEN_SYNCIO *sio, const uint8_t *buffer, uint32_t size)
Definition syncio.c:317
void GWEN_SyncIo_free(GWEN_SYNCIO *sio)
Definition syncio.c:78
GWEN_SYNCIO_STATUS GWEN_SyncIo_GetStatus(const GWEN_SYNCIO *sio)
Definition syncio.c:197
int GWEN_SyncIo_Read(GWEN_SYNCIO *sio, uint8_t *buffer, uint32_t size)
Definition syncio.c:133
GWEN_SYNCIO_CONNECT_FN GWEN_SyncIo_SetConnectFn(GWEN_SYNCIO *sio, GWEN_SYNCIO_CONNECT_FN fn)
Definition syncio.c:252
const char * GWEN_SyncIo_GetTypeName(const GWEN_SYNCIO *sio)
Definition syncio.c:215
void GWEN_SyncIo_SetStatus(GWEN_SYNCIO *sio, GWEN_SYNCIO_STATUS st)
Definition syncio.c:206
int GWEN_SyncIo_Disconnect(GWEN_SYNCIO *sio)
Definition syncio.c:109
int GWEN_SyncIo_Flush(GWEN_SYNCIO *sio)
Definition syncio.c:121
#define GWEN_SYNCIO_FLAGS_DOSMODE
Definition syncio.h:59
GWENHYWFAR_CB int(* GWEN_SYNCIO_DISCONNECT_FN)(GWEN_SYNCIO *sio)
Definition syncio.h:233
GWENHYWFAR_CB int(* GWEN_SYNCIO_READ_FN)(GWEN_SYNCIO *sio, uint8_t *buffer, uint32_t size)
Definition syncio.h:237
GWENHYWFAR_CB int(* GWEN_SYNCIO_CONNECT_FN)(GWEN_SYNCIO *sio)
Definition syncio.h:232
GWENHYWFAR_CB int(* GWEN_SYNCIO_FLUSH_FN)(GWEN_SYNCIO *sio)
Definition syncio.h:234
GWENHYWFAR_CB int(* GWEN_SYNCIO_WRITE_FN)(GWEN_SYNCIO *sio, const uint8_t *buffer, uint32_t size)
Definition syncio.h:243
struct GWEN_SYNCIO GWEN_SYNCIO
Definition syncio.h:40
GWEN_SYNCIO_STATUS
Definition syncio.h:45
GWEN_SYNCIO * GWEN_SyncIo_Buffered_new(GWEN_SYNCIO *baseIo)
int GWEN_SyncIo_Buffered_ReadLinesToStringList(GWEN_SYNCIO *sio, int maxLines, GWEN_STRINGLIST *sl)
@ GWEN_SyncIo_File_CreationMode_CreateNew
Definition syncio_file.h:39
@ GWEN_SyncIo_File_CreationMode_TruncateExisting
Definition syncio_file.h:42
@ GWEN_SyncIo_File_CreationMode_OpenExisting
Definition syncio_file.h:38
#define GWEN_SYNCIO_FILE_FLAGS_UWRITE
Definition syncio_file.h:59
GWENHYWFAR_API GWEN_SYNCIO * GWEN_SyncIo_File_new(const char *path, GWEN_SYNCIO_FILE_CREATIONMODE cm)
#define GWEN_SYNCIO_FILE_FLAGS_READ
Definition syncio_file.h:53
#define GWEN_SYNCIO_FILE_FLAGS_UREAD
Definition syncio_file.h:58
GWENHYWFAR_API int64_t GWEN_SyncIo_File_Seek(GWEN_SYNCIO *sio, int64_t pos, GWEN_SYNCIO_FILE_WHENCE whence)
#define GWEN_SYNCIO_FILE_FLAGS_WRITE
Definition syncio_file.h:54
@ GWEN_SyncIo_File_Whence_Set
Definition syncio_file.h:47
@ GWEN_SyncIo_File_Whence_End
Definition syncio_file.h:49