| 251 | // |
| 252 | |
| 253 | EFI_STATUS |
| 254 | EfiCompress ( |
| 255 | IN UINT8 *SrcBuffer, |
| 256 | IN UINT32 SrcSize, |
| 257 | IN UINT8 *DstBuffer, |
| 258 | IN OUT UINT32 *DstSize |
| 259 | ) |
| 260 | /*++ |
| 261 | |
| 262 | Routine Description: |
| 263 | |
| 264 | The main compression routine. |
| 265 | |
| 266 | Arguments: |
| 267 | |
| 268 | SrcBuffer - The buffer storing the source data |
| 269 | SrcSize - The size of source data |
| 270 | DstBuffer - The buffer to store the compressed data |
| 271 | DstSize - On input, the size of DstBuffer; On output, |
| 272 | the size of the actual compressed data. |
| 273 | |
| 274 | Returns: |
| 275 | |
| 276 | EFI_BUFFER_TOO_SMALL - The DstBuffer is too small. In this case, |
| 277 | DstSize contains the size needed. |
| 278 | EFI_SUCCESS - Compression is successful. |
| 279 | |
| 280 | --*/ |
| 281 | { |
| 282 | EFI_STATUS Status = EFI_SUCCESS; |
| 283 | |
| 284 | // |
| 285 | // Initializations |
| 286 | // |
| 287 | mBufSiz = 0; |
| 288 | mBuf = NULL; |
| 289 | mText = NULL; |
| 290 | mLevel = NULL; |
| 291 | mChildCount = NULL; |
| 292 | mPosition = NULL; |
| 293 | mParent = NULL; |
| 294 | mPrev = NULL; |
| 295 | mNext = NULL; |
| 296 | |
| 297 | |
| 298 | mSrc = SrcBuffer; |
| 299 | mSrcUpperLimit = mSrc + SrcSize; |
| 300 | mDst = DstBuffer; |
| 301 | mDstUpperLimit = mDst + *DstSize; |
| 302 | |
| 303 | PutDword(0L); |
| 304 | PutDword(0L); |
| 305 | |
| 306 | MakeCrcTable (); |
| 307 | |
| 308 | mOrigSize = mCompSize = 0; |
| 309 | mCrc = INIT_CRC; |
| 310 |
no test coverage detected