302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
|
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
|
-
+
-
+
-
+
|
char * zHead = aSBuf + prxLen;
/* Rather than use a lot of mprintf()s here, we reuse aSBuf as a
** buffer for the prefix + current file name. zHead keeps track
** of where we should write file names to this buffer.
*/
if( manifest_parse(&m, &mfile) ){
zip_set_timedate(m.rDate);
snprintf( zHead, bufsize, "manifest" );
snprintf( zHead, bufsize-prxLen, "manifest" );
zip_add_file(aSBuf, &file);
sha1sum_blob(&file, &hash);
blob_reset(&file);
blob_append(&hash, "\n", 1);
snprintf( zHead, bufsize, "manifest.uuid" );
snprintf( zHead, bufsize-prxLen, "manifest.uuid" );
zip_add_file(aSBuf, &hash);
blob_reset(&hash);
for(i=0; i<m.nFile; i++){
int fid = uuid_to_rid(m.aFile[i].zUuid, 0);
if( fid ){
content_get(fid, &file);
snprintf( zHead, bufsize, "%s", m.aFile[i].zName );
snprintf( zHead, bufsize-prxLen, "%s", m.aFile[i].zName );
zip_add_file( aSBuf, &file);
blob_reset(&file);
}
}
manifest_clear(&m);
}else{
blob_reset(&mfile);
|