Subversion Repositories Kolibri OS

Rev

Rev 5729 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 5729 Rev 5809
Line 4... Line 4...
4
#include "7zAlloc.h"
4
#include "7zAlloc.h"
5
#include "7zBuf.h"
5
#include "7zBuf.h"
6
#include "7zCrc.h"
6
#include "7zCrc.h"
7
#include "7zFile.h"
7
#include "7zFile.h"
8
#include "7zVersion.h"
8
#include "7zVersion.h"
-
 
9
#include "http.h"
9
#include "package.h"
10
#include "package.h"
Line 10... Line 11...
10
 
11
 
11
#define PERIOD_4 (4 * 365 + 1)
12
#define PERIOD_4 (4 * 365 + 1)
12
#define PERIOD_100 (PERIOD_4 * 25 - 1)
13
#define PERIOD_100 (PERIOD_4 * 25 - 1)
Line 321... Line 322...
321
    UIntToStr_2(s, min); s[2] = ':'; s += 3;
322
    UIntToStr_2(s, min); s[2] = ':'; s += 3;
322
    UIntToStr_2(s, sec); s[2] = 0;
323
    UIntToStr_2(s, sec); s[2] = 0;
323
}
324
}
Line 324... Line -...
324
 
-
 
325
 
325
 
326
 
326
 
327
void do_install(list_t *install)
327
void do_7z_unpack(const char *srcpath)
328
{
328
{
-
 
329
    CFileInStream archiveStream;
329
    CFileInStream archiveStream;
330
    CLookToRead lookStream;
330
    CLookToRead lookStream;
331
 
331
    CSzArEx db;
332
    CSzArEx db;
332
    SRes res;
333
    SRes res;
333
    ISzAlloc allocImp;
334
    ISzAlloc allocImp;
334
    ISzAlloc allocTempImp;
335
    ISzAlloc allocTempImp;
Line 335... Line 336...
335
    UInt16 *temp = NULL;
336
    UInt16 *temp = NULL;
336
    size_t tempSize = 0;
-
 
Line 337... Line 337...
337
 
337
    size_t tempSize = 0;
338
    package_t   *pkg, *tmp;
338
 
Line 339... Line 339...
339
    char        *cache_path;
339
    memset(&lookStream,0,sizeof(lookStream));
340
 
340
 
Line 341... Line -...
341
    allocImp.Alloc = SzAlloc;
-
 
342
    allocImp.Free = SzFree;
-
 
343
 
-
 
344
    allocTempImp.Alloc = SzAllocTemp;
-
 
345
    allocTempImp.Free = SzFreeTemp;
341
    allocImp.Alloc = SzAlloc;
346
 
342
    allocImp.Free = SzFree;
Line 347... Line 343...
347
    list_for_each_entry_safe(pkg, tmp, install, list)
343
 
348
    {
344
    allocTempImp.Alloc = SzAllocTemp;
Line 349... Line 345...
349
        cache_path = make_cache_path(pkg->filename);
345
    allocTempImp.Free = SzFreeTemp;
350
 
346
 
351
        if (InFile_Open(&archiveStream.file, cache_path))
-
 
-
 
347
    if (InFile_Open(&archiveStream.file, srcpath))
352
            continue;
348
        return;
Line 353... Line 349...
353
 
349
 
Line 354... Line 350...
354
        FileInStream_CreateVTable(&archiveStream);
350
    FileInStream_CreateVTable(&archiveStream);
Line 419... Line 415...
419
                    const UInt16 *destPath = (const UInt16 *)name;
415
                const UInt16 *destPath = (const UInt16 *)name;
Line 420... Line 416...
420
 
416
 
421
                    for (j = 0; name[j] != 0; j++)
417
                for (j = 0; name[j] != 0; j++)
422
                        if (name[j] == '/')
418
                    if (name[j] == '/')
423
                    {
-
 
424
                        if (1)
-
 
425
                        {
419
                {
426
                            name[j] = 0;
420
                    name[j] = 0;
427
                            MyCreateDir(name);
421
                    MyCreateDir(name);
428
                            name[j] = CHAR_PATH_SEPARATOR;
422
                    name[j] = CHAR_PATH_SEPARATOR;
429
                        }
-
 
430
                        else
-
 
431
                            destPath = name + j + 1;
-
 
Line 432... Line 423...
432
                    }
423
                }
433
 
424
 
434
                    if (isDir)
425
                if (isDir)
435
                    {
426
                {
Line 446... Line 437...
446
 
437
 
Line 447... Line 438...
447
                    processedSize = outSizeProcessed;
438
                processedSize = outSizeProcessed;
448
 
439
 
449
                    if (File_Write(&outFile, outBuffer + offset, &processedSize) != 0 || processedSize != outSizeProcessed)
440
                if (File_Write(&outFile, outBuffer + offset, &processedSize) != 0 || processedSize != outSizeProcessed)
450
                    {
441
                {
451
                        PrintError("can not write output file");
442
                    PrintError("can not write output file\n");
452
                        res = SZ_ERROR_FAIL;
443
                    res = SZ_ERROR_FAIL;
Line 453... Line 444...
453
                        break;
444
                    break;
454
                    }
445
                }
455
 
446
 
456
                    if (File_Close(&outFile))
447
                if (File_Close(&outFile))
457
                    {
448
                {
458
                        PrintError("can not close output file");
449
                    PrintError("can not close output file\n");
459
                        res = SZ_ERROR_FAIL;
450
                    res = SZ_ERROR_FAIL;
460
                        break;
-
 
461
                    }
451
                    break;
-
 
452
                }
462
                };
453
            };
-
 
454
        };
-
 
455
        IAlloc_Free(&allocImp, outBuffer);
-
 
456
    };
-
 
457
    SzArEx_Free(&db, &allocImp);
463
                continue;
458
    SzFree(NULL, temp);
Line -... Line 459...
-
 
459
 
-
 
460
    File_Close(&archiveStream.file);
-
 
461
};
-
 
462
 
-
 
463
void do_install(list_t *install)
-
 
464
{
-
 
465
    package_t   *pkg, *tmp;
-
 
466
    char        *cache_path;
-
 
467
 
-
 
468
    list_for_each_entry_safe(pkg, tmp, install, list)
-
 
469
    {
-
 
470
        cache_path = make_cache_path(pkg->filename);
-
 
471
 
-
 
472
        sprintf(conbuf,"install package %s-%s\n", pkg->name, pkg->version);
-
 
473
        con_write_asciiz(conbuf);
464
            };
474