1 /***************************************************************************
2     begin       : Fri Sep 12 2003
3     copyright   : (C) 2020 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 
26 #ifndef GWENHYWFAR_BUFFER_P_H
27 #define GWENHYWFAR_BUFFER_P_H
28 
29 #include <gwenhywfar/gwenhywfarapi.h>
30 #include <gwenhywfar/buffer.h>
31 
32 /**
33  * When reallocating the buffer a multiple of this value is used.
34  * Needs to be aligned at 2^n
35  */
36 #define GWEN_BUFFER_DYNAMIC_STEP 1024
37 
38 #define GWEN_BUFFER_FLAGS_OWNED      0x0001
39 
40 #define GWEN_BUFFER_MODE_COPYMASK (\
41   ~(0) \
42   )
43 
44 
45 struct GWEN_BUFFER {
46   char *realPtr;
47   char *ptr;
48   uint32_t pos;
49   uint32_t bufferSize;
50   uint32_t realBufferSize;
51   uint32_t bytesUsed;
52   uint32_t flags;
53   uint32_t mode;
54   uint32_t hardLimit;
55   uint32_t step;
56   uint32_t bookmarks[GWEN_BUFFER_MAX_BOOKMARKS];
57   uint32_t _refCount;
58 };
59 
60 
61 
62 static void GWEN_Buffer_AdjustBookmarks(GWEN_BUFFER *bf,
63                                         uint32_t pos,
64                                         int offset);
65 
66 
67 
68 #endif
69 
70 
71 
72