As long as WelsFileHandle* is equal to FILE* this doesn't matter, but for consistency use the WelsF* functions for all handles opened by WelsFopen, and use WelsFileHandle* as type for it instead of FILE*.
Showing the changes to codec/encoder/core/src/encoder.cpp (1 of 6 files). Show all
Unified · Split
| @@ -315,7 +315,7 @@ EFrameType DecideFrameType (sWelsEncCtx* pEncCtx, const int8_t kiSpatialNum) { · 314 unmodified lines | ||
| 315 | 315 | */ |
| 316 | 316 | |
| 317 | 317 | extern "C" void DumpDependencyRec (SPicture* pCurPicture, const str_t* kpFileName, const int8_t kiDid) { |
| 318 | − FILE* pDumpRecFile = NULL; | |
| 318 | + WelsFileHandle* pDumpRecFile = NULL; | |
| 319 | 319 | static bool_t bDependencyRecFlag[MAX_DEPENDENCY_LAYER] = {0}; |
| 320 | 320 | int32_t iWrittenSize = 0; |
| 321 | 321 | |
| @@ -331,7 +331,7 @@ extern "C" void DumpDependencyRec (SPicture* pCurPicture, const str_t* kpFileNam · 9 unmodified lines | ||
| 331 | 331 | pDumpRecFile = WelsFopen (sDependencyRecFileName, "ab"); |
| 332 | 332 | } |
| 333 | 333 | if (NULL != pDumpRecFile) |
| 334 | − fseek (pDumpRecFile, 0, SEEK_END); | |
| 334 | + WelsFseek (pDumpRecFile, 0, SEEK_END); | |
| 335 | 335 | } else { |
| 336 | 336 | if (STRNLEN (kpFileName, MAX_FNAME_LEN) > 0) { // confirmed_safe_unsafe_usage |
| 337 | 337 | pDumpRecFile = WelsFopen (kpFileName, "wb"); |
| @@ -353,27 +353,27 @@ extern "C" void DumpDependencyRec (SPicture* pCurPicture, const str_t* kpFileNam · 15 unmodified lines | ||
| 353 | 353 | const int32_t kiChromaHeight = kiLumaHeight >> 1; |
| 354 | 354 | |
| 355 | 355 | for (j = 0; j < kiLumaHeight; ++ j) { |
| 356 | − iWrittenSize = fwrite (&pCurPicture->pData[0][j * kiStrideY], 1, kiLumaWidth, pDumpRecFile); | |
| 356 | + iWrittenSize = WelsFwrite (&pCurPicture->pData[0][j * kiStrideY], 1, kiLumaWidth, pDumpRecFile); | |
| 357 | 357 | assert (iWrittenSize == kiLumaWidth); |
| 358 | 358 | if (iWrittenSize < kiLumaWidth) { |
| 359 | 359 | assert (0); // make no sense for us if writing failed |
| 360 | − fclose (pDumpRecFile); | |
| 360 | + WelsFclose (pDumpRecFile); | |
| 361 | 361 | return; |
| 362 | 362 | } |
| 363 | 363 | } |
| 364 | 364 | for (i = 1; i < I420_PLANES; ++ i) { |
| 365 | 365 | const int32_t kiStrideUV = pCurPicture->iLineSize[i]; |
| 366 | 366 | for (j = 0; j < kiChromaHeight; ++ j) { |
| 367 | − iWrittenSize = fwrite (&pCurPicture->pData[i][j * kiStrideUV], 1, kiChromaWidth, pDumpRecFile); | |
| 367 | + iWrittenSize = WelsFwrite (&pCurPicture->pData[i][j * kiStrideUV], 1, kiChromaWidth, pDumpRecFile); | |
| 368 | 368 | assert (iWrittenSize == kiChromaWidth); |
| 369 | 369 | if (iWrittenSize < kiChromaWidth) { |
| 370 | 370 | assert (0); // make no sense for us if writing failed |
| 371 | − fclose (pDumpRecFile); | |
| 371 | + WelsFclose (pDumpRecFile); | |
| 372 | 372 | return; |
| 373 | 373 | } |
| 374 | 374 | } |
| 375 | 375 | } |
| 376 | − fclose (pDumpRecFile); | |
| 376 | + WelsFclose (pDumpRecFile); | |
| 377 | 377 | pDumpRecFile = NULL; |
| 378 | 378 | } |
| 379 | 379 | } |
| @@ -383,7 +383,7 @@ extern "C" void DumpDependencyRec (SPicture* pCurPicture, const str_t* kpFileNam · 3 unmodified lines | ||
| 383 | 383 | */ |
| 384 | 384 | |
| 385 | 385 | void DumpRecFrame (SPicture* pCurPicture, const str_t* kpFileName) { |
| 386 | − FILE* pDumpRecFile = NULL; | |
| 386 | + WelsFileHandle* pDumpRecFile = NULL; | |
| 387 | 387 | static bool_t bRecFlag = false; |
| 388 | 388 | int32_t iWrittenSize = 0; |
| 389 | 389 | |
| @@ -397,7 +397,7 @@ void DumpRecFrame (SPicture* pCurPicture, const str_t* kpFileName) { · 7 unmodified lines | ||
| 397 | 397 | pDumpRecFile = WelsFopen ("rec.yuv", "ab"); |
| 398 | 398 | } |
| 399 | 399 | if (NULL != pDumpRecFile) |
| 400 | − fseek (pDumpRecFile, 0, SEEK_END); | |
| 400 | + WelsFseek (pDumpRecFile, 0, SEEK_END); | |
| 401 | 401 | } else { |
| 402 | 402 | if (STRNLEN (kpFileName, MAX_FNAME_LEN) > 0) { // confirmed_safe_unsafe_usage |
| 403 | 403 | pDumpRecFile = WelsFopen (kpFileName, "wb"); |
| @@ -417,27 +417,27 @@ void DumpRecFrame (SPicture* pCurPicture, const str_t* kpFileName) { · 13 unmodified lines | ||
| 417 | 417 | const int32_t kiChromaHeight = kiLumaHeight >> 1; |
| 418 | 418 | |
| 419 | 419 | for (j = 0; j < kiLumaHeight; ++ j) { |
| 420 | − iWrittenSize = fwrite (&pCurPicture->pData[0][j * kiStrideY], 1, kiLumaWidth, pDumpRecFile); | |
| 420 | + iWrittenSize = WelsFwrite (&pCurPicture->pData[0][j * kiStrideY], 1, kiLumaWidth, pDumpRecFile); | |
| 421 | 421 | assert (iWrittenSize == kiLumaWidth); |
| 422 | 422 | if (iWrittenSize < kiLumaWidth) { |
| 423 | 423 | assert (0); // make no sense for us if writing failed |
| 424 | − fclose (pDumpRecFile); | |
| 424 | + WelsFclose (pDumpRecFile); | |
| 425 | 425 | return; |
| 426 | 426 | } |
| 427 | 427 | } |
| 428 | 428 | for (i = 1; i < I420_PLANES; ++ i) { |
| 429 | 429 | const int32_t kiStrideUV = pCurPicture->iLineSize[i]; |
| 430 | 430 | for (j = 0; j < kiChromaHeight; ++ j) { |
| 431 | − iWrittenSize = fwrite (&pCurPicture->pData[i][j * kiStrideUV], 1, kiChromaWidth, pDumpRecFile); | |
| 431 | + iWrittenSize = WelsFwrite (&pCurPicture->pData[i][j * kiStrideUV], 1, kiChromaWidth, pDumpRecFile); | |
| 432 | 432 | assert (iWrittenSize == kiChromaWidth); |
| 433 | 433 | if (iWrittenSize < kiChromaWidth) { |
| 434 | 434 | assert (0); // make no sense for us if writing failed |
| 435 | − fclose (pDumpRecFile); | |
| 435 | + WelsFclose (pDumpRecFile); | |
| 436 | 436 | return; |
| 437 | 437 | } |
| 438 | 438 | } |
| 439 | 439 | } |
| 440 | − fclose (pDumpRecFile); | |
| 440 | + WelsFclose (pDumpRecFile); | |
| 441 | 441 | pDumpRecFile = NULL; |
| 442 | 442 | } |
| 443 | 443 | } |