]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
merge conflict
authorSen Huang <senhuang96@fb.com>
Tue, 15 Oct 2019 16:58:50 +0000 (12:58 -0400)
committerSen Huang <senhuang96@fb.com>
Tue, 15 Oct 2019 16:58:50 +0000 (12:58 -0400)
1  2 
lib/compress/zstd_compress.c

index 55e9c8a65c4121f07d1acba8a69d1cb711613167,7facbeff0a11e982d3ea6a5e2c7381f52d516db0..c6ab40ecd697b3f36d8684f2523ae3321915fd6a
@@@ -2823,11 -2885,10 +2886,12 @@@ ZSTD_compress_insertDictionary(ZSTD_com
      }
  
      /* dict as full zstd dictionary */
-     return ZSTD_loadZstdDictionary(bs, ms, params, dict, dictSize, dtlm, workspace);
+     return ZSTD_loadZstdDictionary(
+         bs, ms, ws, params, dict, dictSize, dtlm, workspace);
  }
  
 +#define ZSTD_USE_CDICT_PARAMS_CUTOFF (1 MB)
 +
  /*! ZSTD_compressBegin_internal() :
   * @return : 0, or an error code */
  static size_t ZSTD_compressBegin_internal(ZSTD_CCtx* cctx,
                                      ZSTD_dictContentType_e dictContentType,
                                      ZSTD_dictTableLoadMethod_e dtlm,
                                      const ZSTD_CDict* cdict,
-                                     ZSTD_CCtx_params params, U64 pledgedSrcSize,
+                                     const ZSTD_CCtx_params* params, U64 pledgedSrcSize,
                                      ZSTD_buffered_policy_e zbuff)
  {
-     DEBUGLOG(4, "ZSTD_compressBegin_internal: wlog=%u", params.cParams.windowLog);
+     DEBUGLOG(4, "ZSTD_compressBegin_internal: wlog=%u", params->cParams.windowLog);
      /* params are supposed to be fully validated at this point */
-     assert(!ZSTD_isError(ZSTD_checkCParams(params.cParams)));
+     assert(!ZSTD_isError(ZSTD_checkCParams(params->cParams)));
      assert(!((dict) && (cdict)));  /* either dict or cdict, not both */
 -
 -    if (cdict && cdict->dictContentSize>0) {
 +    if ( (cdict)
 +      && (cdict->dictContentSize > 0)
 +      && (pledgedSrcSize < ZSTD_USE_CDICT_PARAMS_CUTOFF || cdict->compressionLevel == 0) ) {
          return ZSTD_resetCCtx_usingCDict(cctx, cdict, params, pledgedSrcSize, zbuff);
      }
--
-     FORWARD_IF_ERROR( ZSTD_resetCCtx_internal(cctx, params, pledgedSrcSize,
-                                      ZSTDcrp_continue, zbuff) );
++    
+     FORWARD_IF_ERROR( ZSTD_resetCCtx_internal(cctx, *params, pledgedSrcSize,
+                                      ZSTDcrp_makeClean, zbuff) );
 -    {   size_t const dictID = ZSTD_compress_insertDictionary(
 -                cctx->blockState.prevCBlock, &cctx->blockState.matchState,
 -                &cctx->workspace, params, dict, dictSize, dictContentType, dtlm,
 -                cctx->entropyWorkspace);
 +    {   size_t const dictID = cdict ? 
 +                ZSTD_compress_insertDictionary(
 +                        cctx->blockState.prevCBlock, &cctx->blockState.matchState,
 +                        &params, cdict->dictContent, cdict->dictContentSize,
 +                        dictContentType, dtlm, cctx->entropyWorkspace)
 +              : ZSTD_compress_insertDictionary(
 +                        cctx->blockState.prevCBlock, &cctx->blockState.matchState,
-                         &params, dict, dictSize, dictContentType, dtlm, cctx->entropyWorkspace);
++                        &cctx->workspace, params, dict, dictSize, dictContentType, dtlm,
++                        cctx->entropyWorkspace);
          FORWARD_IF_ERROR(dictID);
          assert(dictID <= UINT_MAX);
          cctx->dictID = (U32)dictID;
@@@ -3157,11 -3221,13 +3230,20 @@@ ZSTD_CDict* ZSTD_createCDict_advanced(c
              ZSTD_free(workspace, customMem);
              return NULL;
          }
+         ZSTD_cwksp_init(&ws, workspace, workspaceSize);
+         cdict = (ZSTD_CDict*)ZSTD_cwksp_reserve_object(&ws, sizeof(ZSTD_CDict));
+         assert(cdict != NULL);
+         ZSTD_cwksp_move(&cdict->workspace, &ws);
          cdict->customMem = customMem;
++<<<<<<< HEAD
 +        cdict->workspace = workspace;
 +        cdict->workspaceSize = workspaceSize;
 +        cdict->compressionLevel = 0; /* signals advanced API usage */
 +
++=======
++>>>>>>> 8b6d96827c24dd09109830272f413254833317d9
          if (ZSTD_isError( ZSTD_initCDict_internal(cdict,
                                          dictBuffer, dictSize,
                                          dictLoadMethod, dictContentType,