• Skip to sidebar navigation
  • Skip to content
Linked Applications
Loading…

Bitbucket

  • More
    ProjectsRepositories
  • Help
    • Online help
    • Learn Git
    • Welcome to Bitbucket
    • Keyboard shortcuts
  • Log In
Redkit
  1. Redkit

QtIFW

Public
Actions
  • Clone
  • Compare

Learn more about cloning repositories

You have read-only access

Navigation
  • Source
  • Commits
  • Branches
  • All Branches Graph
  • Forks
  1. Redkit
  2. QtIFW

Source

QtIFW/src/libs/7zip/win/C/XzEnc.c
Karsten HeimrichKarsten Heimrich committed 4677d36298209 Jun 2015
Raw file
Source viewDiff to previous
      RINOK(Xz_AddIndexRecord(xz, block.unpackSize, seqSizeOutStream.processed - padSize, &g_Alloc));
 
1
/* XzEnc.c -- Xz Encode
2
2014-12-30 : Igor Pavlov : Public domain */
3
​
4
#include "Precomp.h"
5
​
6
#include <stdlib.h>
7
#include <string.h>
8
​
9
#include "7zCrc.h"
10
#include "Alloc.h"
11
#include "Bra.h"
12
#include "CpuArch.h"
13
#ifdef USE_SUBBLOCK
14
#include "Bcj3Enc.c"
15
#include "SbFind.c"
16
#include "SbEnc.c"
17
#endif
18
​
19
#include "XzEnc.h"
20
​
21
static void *SzBigAlloc(void *p, size_t size) { p = p; return BigAlloc(size); }
22
static void SzBigFree(void *p, void *address) { p = p; BigFree(address); }
23
static ISzAlloc g_BigAlloc = { SzBigAlloc, SzBigFree };
24
​
25
static void *SzAlloc(void *p, size_t size) { p = p; return MyAlloc(size); }
26
static void SzFree(void *p, void *address) { p = p; MyFree(address); }
27
static ISzAlloc g_Alloc = { SzAlloc, SzFree };
28
​
29
#define XzBlock_ClearFlags(p)       (p)->flags = 0;
30
#define XzBlock_SetNumFilters(p, n) (p)->flags |= ((n) - 1);
31
#define XzBlock_SetHasPackSize(p)   (p)->flags |= XZ_BF_PACK_SIZE;
32
#define XzBlock_SetHasUnpackSize(p) (p)->flags |= XZ_BF_UNPACK_SIZE;
33
​
34
static SRes WriteBytes(ISeqOutStream *s, const void *buf, UInt32 size)
35
{
36
  return (s->Write(s, buf, size) == size) ? SZ_OK : SZ_ERROR_WRITE;
37
}
38
​
39
static SRes WriteBytesAndCrc(ISeqOutStream *s, const void *buf, UInt32 size, UInt32 *crc)
40
{
41
  *crc = CrcUpdate(*crc, buf, size);
42
  return WriteBytes(s, buf, size);
43
}
44
​
45
SRes Xz_WriteHeader(CXzStreamFlags f, ISeqOutStream *s)
46
{
47
  UInt32 crc;
48
  Byte header[XZ_STREAM_HEADER_SIZE];
49
  memcpy(header, XZ_SIG, XZ_SIG_SIZE);
50
  header[XZ_SIG_SIZE] = (Byte)(f >> 8);
51
  header[XZ_SIG_SIZE + 1] = (Byte)(f & 0xFF);
52
  crc = CrcCalc(header + XZ_SIG_SIZE, XZ_STREAM_FLAGS_SIZE);
53
  SetUi32(header + XZ_SIG_SIZE + XZ_STREAM_FLAGS_SIZE, crc);
54
  return WriteBytes(s, header, XZ_STREAM_HEADER_SIZE);
55
}
56
​
57
SRes XzBlock_WriteHeader(const CXzBlock *p, ISeqOutStream *s)
58
{
59
  Byte header[XZ_BLOCK_HEADER_SIZE_MAX];
60
​
61
  unsigned pos = 1;
62
  int numFilters, i;
63
  header[pos++] = p->flags;
  • Git repository management for enterprise teams powered by Atlassian Bitbucket
  • Atlassian Bitbucket v6.8.0
  • Documentation
  • Request a feature
  • About
  • Contact Atlassian
Atlassian

Everything looks good. We'll let you know here if there's anything you should know about.