_FETAL => _FATAL.
[pdfium.git] / core / src / fxcodec / jbig2 / JBig2_Context.cpp
index f58b7f3..ed26ec6 100644 (file)
@@ -30,9 +30,7 @@ CJBig2_Context *CJBig2_Context::CreateContext(CJBig2_Module *pModule, uint8_t *p
 }
 void CJBig2_Context::DestroyContext(CJBig2_Context *pContext)
 {
-    if(pContext) {
-        delete pContext;
-    }
+    delete pContext;
 }
 CJBig2_Context::CJBig2_Context(uint8_t *pGlobalData, FX_DWORD dwGlobalLength,
                                uint8_t *pData, FX_DWORD dwLength, int32_t nStreamType, std::list<CJBig2_CachePair>* pSymbolDictCache, IFX_Pause* pPause)
@@ -63,37 +61,25 @@ CJBig2_Context::CJBig2_Context(uint8_t *pGlobalData, FX_DWORD dwGlobalLength,
 }
 CJBig2_Context::~CJBig2_Context()
 {
-    if(m_pArithDecoder) {
-        delete m_pArithDecoder;
-    }
+    delete m_pArithDecoder;
     m_pArithDecoder = NULL;
-    if(m_pGRD) {
-        delete m_pGRD;
-    }
+    delete m_pGRD;
     m_pGRD = NULL;
     if(m_gbContext) {
         m_pModule->JBig2_Free(m_gbContext);
     }
     m_gbContext = NULL;
-    if(m_pGlobalContext) {
-        delete m_pGlobalContext;
-    }
+    delete m_pGlobalContext;
     m_pGlobalContext = NULL;
-    if(m_pPageInfoList) {
-        delete m_pPageInfoList;
-    }
+    delete m_pPageInfoList;
     m_pPageInfoList = NULL;
-    if(m_bBufSpecified && m_pPage) {
+    if(m_bBufSpecified) {
         delete m_pPage;
     }
     m_pPage = NULL;
-    if(m_pStream) {
-        delete m_pStream;
-    }
+    delete m_pStream;
     m_pStream = NULL;
-    if(m_pSegmentList) {
-        delete m_pSegmentList;
-    }
+    delete m_pSegmentList;
     m_pSegmentList = NULL;
 }
 int32_t CJBig2_Context::decodeFile(IFX_Pause* pPause)
@@ -247,9 +233,7 @@ int32_t CJBig2_Context::getFirstPage(uint8_t *pBuf, int32_t width, int32_t heigh
     }
     m_bFirstPage = TRUE;
     m_PauseStep = 0;
-    if(m_pPage) {
-        delete m_pPage;
-    }
+    delete m_pPage;
     JBIG2_ALLOC(m_pPage, CJBig2_Image(width, height, stride, pBuf));
     m_bBufSpecified = TRUE;
     if(m_pPage && pPause && pPause->NeedToPauseNow()) {
@@ -316,9 +300,7 @@ int32_t CJBig2_Context::getNextPage(uint8_t *pBuf, int32_t width, int32_t height
     int32_t nRet = JBIG2_ERROR_STREAM_TYPE;
     m_bFirstPage = FALSE;
     m_PauseStep = 0;
-    if(m_pPage) {
-        delete m_pPage;
-    }
+    delete m_pPage;
     JBIG2_ALLOC(m_pPage, CJBig2_Image(width, height, stride, pBuf));
     m_bBufSpecified = TRUE;
     if(m_pPage && pPause && pPause->NeedToPauseNow()) {
@@ -571,9 +553,7 @@ int32_t CJBig2_Context::ProcessiveParseSegmentData(CJBig2_Segment *pSegment, IFX
                     pPageInfo->m_bIsStriped = 1;
                 }
                 if(!m_bBufSpecified) {
-                    if(m_pPage) {
-                        delete m_pPage;
-                    }
+                    delete m_pPage;
                     if(pPageInfo->m_dwHeight == 0xffffffff) {
                         JBIG2_ALLOC(m_pPage, CJBig2_Image(pPageInfo->m_dwWidth, pPageInfo->m_wMaxStripeSize));
                     } else {
@@ -611,7 +591,7 @@ failed1:
     return JBIG2_ERROR_TOO_SHORT;
 failed2:
     m_pModule->JBig2_Error("segment syntax error.");
-    return JBIG2_ERROR_FETAL;
+    return JBIG2_ERROR_FATAL;
 }
 int32_t CJBig2_Context::parseSymbolDict(CJBig2_Segment *pSegment, IFX_Pause* pPause)
 {
@@ -680,7 +660,7 @@ int32_t CJBig2_Context::parseSymbolDict(CJBig2_Segment *pSegment, IFX_Pause* pPa
     for(i = 0; i < pSegment->m_nReferred_to_segment_count; i++) {
         if(!findSegmentByNumber(pSegment->m_pReferred_to_segment_numbers[i])) {
             m_pModule->JBig2_Error("symbol dictionary segment : can't find refered to segments");
-            nRet = JBIG2_ERROR_FETAL;
+            nRet = JBIG2_ERROR_FATAL;
             goto failed;
         }
     }
@@ -711,7 +691,7 @@ int32_t CJBig2_Context::parseSymbolDict(CJBig2_Segment *pSegment, IFX_Pause* pPa
     if(pSymbolDictDecoder->SDHUFF == 1) {
         if((cSDHUFFDH == 2) || (cSDHUFFDW == 2)) {
             m_pModule->JBig2_Error("symbol dictionary segment : SDHUFFDH=2 or SDHUFFDW=2 is not permitted.");
-            nRet = JBIG2_ERROR_FETAL;
+            nRet = JBIG2_ERROR_FATAL;
             goto failed;
         }
         nIndex = 0;
@@ -727,7 +707,7 @@ int32_t CJBig2_Context::parseSymbolDict(CJBig2_Segment *pSegment, IFX_Pause* pPa
             pSeg = findReferredSegmentByTypeAndIndex(pSegment, 53, nIndex++);
             if(!pSeg) {
                 m_pModule->JBig2_Error("symbol dictionary segment : SDHUFFDH can't find user supplied table.");
-                nRet = JBIG2_ERROR_FETAL;
+                nRet = JBIG2_ERROR_FATAL;
                 goto failed;
             }
             pSymbolDictDecoder->SDHUFFDH = pSeg->m_Result.ht;
@@ -744,7 +724,7 @@ int32_t CJBig2_Context::parseSymbolDict(CJBig2_Segment *pSegment, IFX_Pause* pPa
             pSeg = findReferredSegmentByTypeAndIndex(pSegment, 53, nIndex++);
             if(!pSeg) {
                 m_pModule->JBig2_Error("symbol dictionary segment : SDHUFFDW can't find user supplied table.");
-                nRet = JBIG2_ERROR_FETAL;
+                nRet = JBIG2_ERROR_FATAL;
                 goto failed;
             }
             pSymbolDictDecoder->SDHUFFDW = pSeg->m_Result.ht;
@@ -757,7 +737,7 @@ int32_t CJBig2_Context::parseSymbolDict(CJBig2_Segment *pSegment, IFX_Pause* pPa
             pSeg = findReferredSegmentByTypeAndIndex(pSegment, 53, nIndex++);
             if(!pSeg) {
                 m_pModule->JBig2_Error("symbol dictionary segment : SDHUFFBMSIZE can't find user supplied table.");
-                nRet = JBIG2_ERROR_FETAL;
+                nRet = JBIG2_ERROR_FATAL;
                 goto failed;
             }
             pSymbolDictDecoder->SDHUFFBMSIZE = pSeg->m_Result.ht;
@@ -773,7 +753,7 @@ int32_t CJBig2_Context::parseSymbolDict(CJBig2_Segment *pSegment, IFX_Pause* pPa
                 pSeg = findReferredSegmentByTypeAndIndex(pSegment, 53, nIndex++);
                 if(!pSeg) {
                     m_pModule->JBig2_Error("symbol dictionary segment : SDHUFFAGGINST can't find user supplied table.");
-                    nRet = JBIG2_ERROR_FETAL;
+                    nRet = JBIG2_ERROR_FATAL;
                     goto failed;
                 }
                 pSymbolDictDecoder->SDHUFFAGGINST = pSeg->m_Result.ht;
@@ -822,7 +802,7 @@ int32_t CJBig2_Context::parseSymbolDict(CJBig2_Segment *pSegment, IFX_Pause* pPa
             pSegment->m_Result.sd = pSymbolDictDecoder->decode_Arith(pArithDecoder, gbContext, grContext);
             delete pArithDecoder;
             if(pSegment->m_Result.sd == NULL) {
-                nRet = JBIG2_ERROR_FETAL;
+                nRet = JBIG2_ERROR_FATAL;
                 goto failed;
             }
             m_pStream->alignByte();
@@ -830,7 +810,7 @@ int32_t CJBig2_Context::parseSymbolDict(CJBig2_Segment *pSegment, IFX_Pause* pPa
         } else {
             pSegment->m_Result.sd = pSymbolDictDecoder->decode_Huffman(m_pStream, gbContext, grContext, pPause);
             if(pSegment->m_Result.sd == NULL) {
-                nRet = JBIG2_ERROR_FETAL;
+                nRet = JBIG2_ERROR_FATAL;
                 goto failed;
             }
             m_pStream->alignByte();
@@ -860,21 +840,11 @@ int32_t CJBig2_Context::parseSymbolDict(CJBig2_Segment *pSegment, IFX_Pause* pPa
     if(SDINSYMS) {
         m_pModule->JBig2_Free(SDINSYMS);
     }
-    if(Table_B1) {
-        delete Table_B1;
-    }
-    if(Table_B2) {
-        delete Table_B2;
-    }
-    if(Table_B3) {
-        delete Table_B3;
-    }
-    if(Table_B4) {
-        delete Table_B4;
-    }
-    if(Table_B5) {
-        delete Table_B5;
-    }
+    delete Table_B1;
+    delete Table_B2;
+    delete Table_B3;
+    delete Table_B4;
+    delete Table_B5;
     if(bUsed == FALSE) {
         if(gbContext) {
             m_pModule->JBig2_Free(gbContext);
@@ -889,21 +859,11 @@ failed:
     if(SDINSYMS) {
         m_pModule->JBig2_Free(SDINSYMS);
     }
-    if(Table_B1) {
-        delete Table_B1;
-    }
-    if(Table_B2) {
-        delete Table_B2;
-    }
-    if(Table_B3) {
-        delete Table_B3;
-    }
-    if(Table_B4) {
-        delete Table_B4;
-    }
-    if(Table_B5) {
-        delete Table_B5;
-    }
+    delete Table_B1;
+    delete Table_B2;
+    delete Table_B3;
+    delete Table_B4;
+    delete Table_B5;
     if(gbContext) {
         m_pModule->JBig2_Free(gbContext);
     }
@@ -991,7 +951,7 @@ FX_BOOL CJBig2_Context::parseTextRegion(CJBig2_Segment *pSegment)
     for(i = 0; i < pSegment->m_nReferred_to_segment_count; i++) {
         if(!findSegmentByNumber(pSegment->m_pReferred_to_segment_numbers[i])) {
             m_pModule->JBig2_Error("text region segment : can't find refered to segments");
-            nRet = JBIG2_ERROR_FETAL;
+            nRet = JBIG2_ERROR_FATAL;
             goto failed;
         }
     }
@@ -1022,7 +982,7 @@ FX_BOOL CJBig2_Context::parseTextRegion(CJBig2_Segment *pSegment)
         SBSYMCODES = decodeSymbolIDHuffmanTable(m_pStream, pTRD->SBNUMSYMS);
         if(SBSYMCODES == NULL) {
             m_pModule->JBig2_Error("text region segment: symbol ID huffman table decode failure!");
-            nRet = JBIG2_ERROR_FETAL;
+            nRet = JBIG2_ERROR_FATAL;
             goto failed;
         }
         m_pStream->alignByte();
@@ -1039,7 +999,7 @@ FX_BOOL CJBig2_Context::parseTextRegion(CJBig2_Segment *pSegment)
                 || (cSBHUFFRDX == 2) || (cSBHUFFRDY == 2)) {
             m_pModule->JBig2_Error("text region segment : SBHUFFFS=2 or SBHUFFRDW=2 or "
                                    "SBHUFFRDH=2 or SBHUFFRDX=2 or SBHUFFRDY=2 is not permitted");
-            nRet = JBIG2_ERROR_FETAL;
+            nRet = JBIG2_ERROR_FATAL;
             goto failed;
         }
         nIndex = 0;
@@ -1055,7 +1015,7 @@ FX_BOOL CJBig2_Context::parseTextRegion(CJBig2_Segment *pSegment)
             pSeg = findReferredSegmentByTypeAndIndex(pSegment, 53, nIndex++);
             if(!pSeg) {
                 m_pModule->JBig2_Error("text region segment : SBHUFFFS can't find user supplied table");
-                nRet = JBIG2_ERROR_FETAL;
+                nRet = JBIG2_ERROR_FATAL;
                 goto failed;
             }
             pTRD->SBHUFFFS = pSeg->m_Result.ht;
@@ -1076,7 +1036,7 @@ FX_BOOL CJBig2_Context::parseTextRegion(CJBig2_Segment *pSegment)
             pSeg = findReferredSegmentByTypeAndIndex(pSegment, 53, nIndex++);
             if(!pSeg) {
                 m_pModule->JBig2_Error("text region segment : SBHUFFDS can't find user supplied table");
-                nRet = JBIG2_ERROR_FETAL;
+                nRet = JBIG2_ERROR_FATAL;
                 goto failed;
             }
             pTRD->SBHUFFDS = pSeg->m_Result.ht;
@@ -1097,7 +1057,7 @@ FX_BOOL CJBig2_Context::parseTextRegion(CJBig2_Segment *pSegment)
             pSeg = findReferredSegmentByTypeAndIndex(pSegment, 53, nIndex++);
             if(!pSeg) {
                 m_pModule->JBig2_Error("text region segment : SBHUFFDT can't find user supplied table");
-                nRet = JBIG2_ERROR_FETAL;
+                nRet = JBIG2_ERROR_FATAL;
                 goto failed;
             }
             pTRD->SBHUFFDT = pSeg->m_Result.ht;
@@ -1114,7 +1074,7 @@ FX_BOOL CJBig2_Context::parseTextRegion(CJBig2_Segment *pSegment)
             pSeg = findReferredSegmentByTypeAndIndex(pSegment, 53, nIndex++);
             if(!pSeg) {
                 m_pModule->JBig2_Error("text region segment : SBHUFFRDW can't find user supplied table");
-                nRet = JBIG2_ERROR_FETAL;
+                nRet = JBIG2_ERROR_FATAL;
                 goto failed;
             }
             pTRD->SBHUFFRDW = pSeg->m_Result.ht;
@@ -1135,7 +1095,7 @@ FX_BOOL CJBig2_Context::parseTextRegion(CJBig2_Segment *pSegment)
             pSeg = findReferredSegmentByTypeAndIndex(pSegment, 53, nIndex++);
             if(!pSeg) {
                 m_pModule->JBig2_Error("text region segment : SBHUFFRDH can't find user supplied table");
-                nRet = JBIG2_ERROR_FETAL;
+                nRet = JBIG2_ERROR_FATAL;
                 goto failed;
             }
             pTRD->SBHUFFRDH = pSeg->m_Result.ht;
@@ -1156,7 +1116,7 @@ FX_BOOL CJBig2_Context::parseTextRegion(CJBig2_Segment *pSegment)
             pSeg = findReferredSegmentByTypeAndIndex(pSegment, 53, nIndex++);
             if(!pSeg) {
                 m_pModule->JBig2_Error("text region segment : SBHUFFRDX can't find user supplied table");
-                nRet = JBIG2_ERROR_FETAL;
+                nRet = JBIG2_ERROR_FATAL;
                 goto failed;
             }
             pTRD->SBHUFFRDX = pSeg->m_Result.ht;
@@ -1177,7 +1137,7 @@ FX_BOOL CJBig2_Context::parseTextRegion(CJBig2_Segment *pSegment)
             pSeg = findReferredSegmentByTypeAndIndex(pSegment, 53, nIndex++);
             if(!pSeg) {
                 m_pModule->JBig2_Error("text region segment : SBHUFFRDY can't find user supplied table");
-                nRet = JBIG2_ERROR_FETAL;
+                nRet = JBIG2_ERROR_FATAL;
                 goto failed;
             }
             pTRD->SBHUFFRDY = pSeg->m_Result.ht;
@@ -1190,7 +1150,7 @@ FX_BOOL CJBig2_Context::parseTextRegion(CJBig2_Segment *pSegment)
             pSeg = findReferredSegmentByTypeAndIndex(pSegment, 53, nIndex++);
             if(!pSeg) {
                 m_pModule->JBig2_Error("text region segment : SBHUFFRSIZE can't find user supplied table");
-                nRet = JBIG2_ERROR_FETAL;
+                nRet = JBIG2_ERROR_FATAL;
                 goto failed;
             }
             pTRD->SBHUFFRSIZE = pSeg->m_Result.ht;
@@ -1207,7 +1167,7 @@ FX_BOOL CJBig2_Context::parseTextRegion(CJBig2_Segment *pSegment)
         pSegment->m_Result.im = pTRD->decode_Arith(pArithDecoder, grContext);
         delete pArithDecoder;
         if(pSegment->m_Result.im == NULL) {
-            nRet = JBIG2_ERROR_FETAL;
+            nRet = JBIG2_ERROR_FATAL;
             goto failed;
         }
         m_pStream->alignByte();
@@ -1216,7 +1176,7 @@ FX_BOOL CJBig2_Context::parseTextRegion(CJBig2_Segment *pSegment)
         pSegment->m_nResultType = JBIG2_IMAGE_POINTER;
         pSegment->m_Result.im = pTRD->decode_Huffman(m_pStream, grContext);
         if(pSegment->m_Result.im == NULL) {
-            nRet = JBIG2_ERROR_FETAL;
+            nRet = JBIG2_ERROR_FATAL;
             goto failed;
         }
         m_pStream->alignByte();
@@ -1242,39 +1202,17 @@ FX_BOOL CJBig2_Context::parseTextRegion(CJBig2_Segment *pSegment)
     if(grContext) {
         m_pModule->JBig2_Free(grContext);
     }
-    if(Table_B1) {
-        delete Table_B1;
-    }
-    if(Table_B6) {
-        delete Table_B6;
-    }
-    if(Table_B7) {
-        delete Table_B7;
-    }
-    if(Table_B8) {
-        delete Table_B8;
-    }
-    if(Table_B9) {
-        delete Table_B9;
-    }
-    if(Table_B10) {
-        delete Table_B10;
-    }
-    if(Table_B11) {
-        delete Table_B11;
-    }
-    if(Table_B12) {
-        delete Table_B12;
-    }
-    if(Table_B13) {
-        delete Table_B13;
-    }
-    if(Table_B14) {
-        delete Table_B14;
-    }
-    if(Table_B15) {
-        delete Table_B15;
-    }
+    delete Table_B1;
+    delete Table_B6;
+    delete Table_B7;
+    delete Table_B8;
+    delete Table_B9;
+    delete Table_B10;
+    delete Table_B11;
+    delete Table_B12;
+    delete Table_B13;
+    delete Table_B14;
+    delete Table_B15;
     return JBIG2_SUCCESS;
 failed:
     delete pTRD;
@@ -1287,39 +1225,17 @@ failed:
     if(grContext) {
         m_pModule->JBig2_Free(grContext);
     }
-    if(Table_B1) {
-        delete Table_B1;
-    }
-    if(Table_B6) {
-        delete Table_B6;
-    }
-    if(Table_B7) {
-        delete Table_B7;
-    }
-    if(Table_B8) {
-        delete Table_B8;
-    }
-    if(Table_B9) {
-        delete Table_B9;
-    }
-    if(Table_B10) {
-        delete Table_B10;
-    }
-    if(Table_B11) {
-        delete Table_B11;
-    }
-    if(Table_B12) {
-        delete Table_B12;
-    }
-    if(Table_B13) {
-        delete Table_B13;
-    }
-    if(Table_B14) {
-        delete Table_B14;
-    }
-    if(Table_B15) {
-        delete Table_B15;
-    }
+    delete Table_B1;
+    delete Table_B6;
+    delete Table_B7;
+    delete Table_B8;
+    delete Table_B9;
+    delete Table_B10;
+    delete Table_B11;
+    delete Table_B12;
+    delete Table_B13;
+    delete Table_B14;
+    delete Table_B15;
     return nRet;
 }
 
@@ -1357,7 +1273,7 @@ FX_BOOL CJBig2_Context::parsePatternDict(CJBig2_Segment *pSegment, IFX_Pause* pP
         delete pArithDecoder;
         if(pSegment->m_Result.pd == NULL) {
             m_pModule->JBig2_Free(gbContext);
-            nRet = JBIG2_ERROR_FETAL;
+            nRet = JBIG2_ERROR_FATAL;
             goto failed;
         }
         m_pModule->JBig2_Free(gbContext);
@@ -1366,7 +1282,7 @@ FX_BOOL CJBig2_Context::parsePatternDict(CJBig2_Segment *pSegment, IFX_Pause* pP
     } else {
         pSegment->m_Result.pd = pPDD->decode_MMR(m_pStream, pPause);
         if(pSegment->m_Result.pd == NULL) {
-            nRet = JBIG2_ERROR_FETAL;
+            nRet = JBIG2_ERROR_FATAL;
             goto failed;
         }
         m_pStream->alignByte();
@@ -1410,19 +1326,19 @@ FX_BOOL CJBig2_Context::parseHalftoneRegion(CJBig2_Segment *pSegment, IFX_Pause*
     pHRD->HDEFPIXEL = (cFlags >> 7) & 0x01;
     if(pSegment->m_nReferred_to_segment_count != 1) {
         m_pModule->JBig2_Error("halftone region segment : refered to segment count not equals 1");
-        nRet = JBIG2_ERROR_FETAL;
+        nRet = JBIG2_ERROR_FATAL;
         goto failed;
     }
     pSeg = findSegmentByNumber(pSegment->m_pReferred_to_segment_numbers[0]);
     if( (pSeg == NULL) || (pSeg->m_cFlags.s.type != 16)) {
         m_pModule->JBig2_Error("halftone region segment : refered to segment is not pattern dict");
-        nRet = JBIG2_ERROR_FETAL;
+        nRet = JBIG2_ERROR_FATAL;
         goto failed;
     }
     pPatternDict = pSeg->m_Result.pd;
     if((pPatternDict == NULL) || (pPatternDict->NUMPATS == 0)) {
         m_pModule->JBig2_Error("halftone region segment : has no patterns input");
-        nRet = JBIG2_ERROR_FETAL;
+        nRet = JBIG2_ERROR_FATAL;
         goto failed;
     }
     pHRD->HNUMPATS = pPatternDict->NUMPATS;
@@ -1439,7 +1355,7 @@ FX_BOOL CJBig2_Context::parseHalftoneRegion(CJBig2_Segment *pSegment, IFX_Pause*
         delete pArithDecoder;
         if(pSegment->m_Result.im == NULL) {
             m_pModule->JBig2_Free(gbContext);
-            nRet = JBIG2_ERROR_FETAL;
+            nRet = JBIG2_ERROR_FATAL;
             goto failed;
         }
         m_pModule->JBig2_Free(gbContext);
@@ -1448,7 +1364,7 @@ FX_BOOL CJBig2_Context::parseHalftoneRegion(CJBig2_Segment *pSegment, IFX_Pause*
     } else {
         pSegment->m_Result.im = pHRD->decode_MMR(m_pStream, pPause);
         if(pSegment->m_Result.im == NULL) {
-            nRet = JBIG2_ERROR_FETAL;
+            nRet = JBIG2_ERROR_FATAL;
             goto failed;
         }
         m_pStream->alignByte();
@@ -1546,7 +1462,7 @@ FX_BOOL CJBig2_Context::parseGenericRegion(CJBig2_Segment *pSegment, IFX_Pause*
             m_pArithDecoder = NULL;
             if(pSegment->m_Result.im == NULL) {
                 m_pModule->JBig2_Free(m_gbContext);
-                nRet = JBIG2_ERROR_FETAL;
+                nRet = JBIG2_ERROR_FATAL;
                 m_gbContext = NULL;
                 m_ProcessiveStatus = FXCODEC_STATUS_ERROR;
                 goto failed;
@@ -1562,7 +1478,7 @@ FX_BOOL CJBig2_Context::parseGenericRegion(CJBig2_Segment *pSegment, IFX_Pause*
             m_pGRD->Continue_decode(pPause);
         }
         if(pSegment->m_Result.im == NULL) {
-            nRet = JBIG2_ERROR_FETAL;
+            nRet = JBIG2_ERROR_FATAL;
             goto failed;
         }
         m_pStream->alignByte();
@@ -1624,7 +1540,7 @@ FX_BOOL CJBig2_Context::parseGenericRefinementRegion(CJBig2_Segment *pSegment)
             pSeg = findSegmentByNumber(pSegment->m_pReferred_to_segment_numbers[0]);
             if(pSeg == NULL) {
                 m_pModule->JBig2_Error("generic refinement region segment : can't find refered to segments");
-                nRet = JBIG2_ERROR_FETAL;
+                nRet = JBIG2_ERROR_FATAL;
                 goto failed;
             }
             if((pSeg->m_cFlags.s.type == 4) || (pSeg->m_cFlags.s.type == 20)
@@ -1634,7 +1550,7 @@ FX_BOOL CJBig2_Context::parseGenericRefinementRegion(CJBig2_Segment *pSegment)
         }
         if(i >= pSegment->m_nReferred_to_segment_count) {
             m_pModule->JBig2_Error("generic refinement region segment : can't find refered to intermediate region");
-            nRet = JBIG2_ERROR_FETAL;
+            nRet = JBIG2_ERROR_FATAL;
             goto failed;
         }
         pGRRD->GRREFERENCE = pSeg->m_Result.im;
@@ -1652,7 +1568,7 @@ FX_BOOL CJBig2_Context::parseGenericRefinementRegion(CJBig2_Segment *pSegment)
     delete pArithDecoder;
     if(pSegment->m_Result.im == NULL) {
         m_pModule->JBig2_Free(grContext);
-        nRet = JBIG2_ERROR_FETAL;
+        nRet = JBIG2_ERROR_FATAL;
         goto failed;
     }
     m_pModule->JBig2_Free(grContext);
@@ -1682,7 +1598,7 @@ FX_BOOL CJBig2_Context::parseTable(CJBig2_Segment *pSegment)
     if(!pSegment->m_Result.ht->isOK()) {
         delete pSegment->m_Result.ht;
         pSegment->m_Result.ht = NULL;
-        return JBIG2_ERROR_FETAL;
+        return JBIG2_ERROR_FATAL;
     }
     m_pStream->alignByte();
     return JBIG2_SUCCESS;