| 24090 | |
| 24091 | |
| 24092 | MEM_STATIC size_t ZSTD_initLegacyStream(void** legacyContext, U32 prevVersion, U32 newVersion, |
| 24093 | const void* dict, size_t dictSize) |
| 24094 | { |
| 24095 | DEBUGLOG(5, "ZSTD_initLegacyStream for v0.%u", newVersion); |
| 24096 | if (prevVersion != newVersion) ZSTD_freeLegacyStreamContext(*legacyContext, prevVersion); |
| 24097 | switch(newVersion) |
| 24098 | { |
| 24099 | default : |
| 24100 | case 1 : |
| 24101 | case 2 : |
| 24102 | case 3 : |
| 24103 | (void)dict; (void)dictSize; |
| 24104 | return 0; |
| 24105 | #if (ZSTD_LEGACY_SUPPORT <= 4) |
| 24106 | case 4 : |
| 24107 | { |
| 24108 | ZBUFFv04_DCtx* dctx = (prevVersion != newVersion) ? ZBUFFv04_createDCtx() : (ZBUFFv04_DCtx*)*legacyContext; |
| 24109 | if (dctx==NULL) return ERROR(memory_allocation); |
| 24110 | ZBUFFv04_decompressInit(dctx); |
| 24111 | ZBUFFv04_decompressWithDictionary(dctx, dict, dictSize); |
| 24112 | *legacyContext = dctx; |
| 24113 | return 0; |
| 24114 | } |
| 24115 | #endif |
| 24116 | #if (ZSTD_LEGACY_SUPPORT <= 5) |
| 24117 | case 5 : |
| 24118 | { |
| 24119 | ZBUFFv05_DCtx* dctx = (prevVersion != newVersion) ? ZBUFFv05_createDCtx() : (ZBUFFv05_DCtx*)*legacyContext; |
| 24120 | if (dctx==NULL) return ERROR(memory_allocation); |
| 24121 | ZBUFFv05_decompressInitDictionary(dctx, dict, dictSize); |
| 24122 | *legacyContext = dctx; |
| 24123 | return 0; |
| 24124 | } |
| 24125 | #endif |
| 24126 | #if (ZSTD_LEGACY_SUPPORT <= 6) |
| 24127 | case 6 : |
| 24128 | { |
| 24129 | ZBUFFv06_DCtx* dctx = (prevVersion != newVersion) ? ZBUFFv06_createDCtx() : (ZBUFFv06_DCtx*)*legacyContext; |
| 24130 | if (dctx==NULL) return ERROR(memory_allocation); |
| 24131 | ZBUFFv06_decompressInitDictionary(dctx, dict, dictSize); |
| 24132 | *legacyContext = dctx; |
| 24133 | return 0; |
| 24134 | } |
| 24135 | #endif |
| 24136 | #if (ZSTD_LEGACY_SUPPORT <= 7) |
| 24137 | case 7 : |
| 24138 | { |
| 24139 | ZBUFFv07_DCtx* dctx = (prevVersion != newVersion) ? ZBUFFv07_createDCtx() : (ZBUFFv07_DCtx*)*legacyContext; |
| 24140 | if (dctx==NULL) return ERROR(memory_allocation); |
| 24141 | ZBUFFv07_decompressInitDictionary(dctx, dict, dictSize); |
| 24142 | *legacyContext = dctx; |
| 24143 | return 0; |
| 24144 | } |
| 24145 | #endif |
| 24146 | } |
| 24147 | } |
| 24148 | |
| 24149 |
no test coverage detected