12 #include "gwen_sar_fileheader_p.h"
14 #include <gwenhywfar/misc.h>
15 #include <gwenhywfar/debug.h>
26 if (strcasecmp(p_s,
"none") == 0)
28 else if (strcasecmp(p_s,
"file") == 0)
30 else if (strcasecmp(p_s,
"dir") == 0)
32 else if (strcasecmp(p_s,
"symLink") == 0)
40 if (strcasecmp(p_s,
"active") == 0)
42 else if (strcasecmp(p_s,
"deleted") == 0)
78 p_struct->_refCount = 1;
83 p_struct->path =
NULL;
84 p_struct->fileType = 0;
85 p_struct->permissions = 0;
86 p_struct->atime =
NULL;
87 p_struct->mtime =
NULL;
88 p_struct->ctime =
NULL;
89 p_struct->fileSize = 0;
90 p_struct->headerStartPos = 0;
91 p_struct->headerSize = 0;
92 p_struct->dataPos = 0;
93 p_struct->dataSize = 0;
94 p_struct->hashPos = 0;
101 assert(p_struct->_refCount);
102 if (p_struct->_refCount == 1) {
105 free(p_struct->path);
109 p_struct->_refCount = 0;
112 p_struct->_refCount--;
118 assert(p_struct->_refCount);
119 p_struct->_refCount++;
128 p_struct->status = p_src->status;
131 p_struct->flags = p_src->flags;
134 if (p_struct->path) {
135 free(p_struct->path);
136 p_struct->path =
NULL;
139 p_struct->path = strdup(p_src->path);
143 p_struct->fileType = p_src->fileType;
146 p_struct->permissions = p_src->permissions;
149 if (p_struct->atime) {
151 p_struct->atime =
NULL;
158 if (p_struct->mtime) {
160 p_struct->mtime =
NULL;
167 if (p_struct->ctime) {
169 p_struct->ctime =
NULL;
176 p_struct->fileSize = p_src->fileSize;
179 p_struct->headerStartPos = p_src->headerStartPos;
182 p_struct->headerSize = p_src->headerSize;
185 p_struct->dataPos = p_src->dataPos;
188 p_struct->dataSize = p_src->dataSize;
191 p_struct->hashPos = p_src->hashPos;
198 return p_struct->status;
203 return p_struct->flags;
208 return p_struct->path;
213 return p_struct->fileType;
218 return p_struct->permissions;
223 return p_struct->atime;
228 return p_struct->mtime;
233 return p_struct->ctime;
238 return p_struct->fileSize;
243 return p_struct->headerStartPos;
248 return p_struct->headerSize;
253 return p_struct->dataPos;
258 return p_struct->dataSize;
263 return p_struct->hashPos;
268 p_struct->status = p_src;
273 p_struct->status |= p_src;
278 p_struct->status &= ~p_src;
283 p_struct->flags = p_src;
288 p_struct->flags |= p_src;
293 p_struct->flags &= ~p_src;
298 if (p_struct->path) {
299 free(p_struct->path);
302 p_struct->path = strdup(p_src);
304 p_struct->path =
NULL;
310 p_struct->fileType = p_src;
315 p_struct->permissions = p_src;
320 p_struct->permissions |= p_src;
325 p_struct->permissions &= ~p_src;
330 if (p_struct->atime) {
333 p_struct->atime = p_src;
338 if (p_struct->mtime) {
341 p_struct->mtime = p_src;
346 if (p_struct->ctime) {
349 p_struct->ctime = p_src;
354 p_struct->fileSize = p_src;
359 p_struct->headerStartPos = p_src;
364 p_struct->headerSize = p_src;
369 p_struct->dataPos = p_src;
374 p_struct->dataSize = p_src;
379 p_struct->hashPos = p_src;
383 GWEN_SAR_FILEHEADER_LIST *p_dest;
387 p_dest = GWEN_SarFileHeader_List_new();
388 p_elem = GWEN_SarFileHeader_List_First(p_src);
393 GWEN_SarFileHeader_List_Add(p_cpy, p_dest);
394 p_elem = GWEN_SarFileHeader_List_Next(p_elem);