当前位置: 首页>>代码示例>>C++>>正文


C++ FXSYS_assert函数代码示例

本文整理汇总了C++中FXSYS_assert函数的典型用法代码示例。如果您正苦于以下问题:C++ FXSYS_assert函数的具体用法?C++ FXSYS_assert怎么用?C++ FXSYS_assert使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了FXSYS_assert函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: FXSYS_assert

FX_BOOL CFX_GEFont::GetCharBBox(FX_WCHAR wUnicode,
                                CFX_Rect& bbox,
                                FX_BOOL bRecursive,
                                FX_BOOL bCharCode) {
  FXSYS_assert(m_pRectArray != NULL);
  FXSYS_assert(m_pBBoxMap != NULL);
  void* pRect = NULL;
  if (!m_pBBoxMap->Lookup((void*)(uintptr_t)wUnicode, pRect)) {
    IFX_Font* pFont = NULL;
    int32_t iGlyph = GetGlyphIndex(wUnicode, TRUE, &pFont, bCharCode);
    if (iGlyph != 0xFFFF && pFont != NULL) {
      if (pFont == (IFX_Font*)this) {
        FX_RECT rtBBox;
        if (m_pFont->GetGlyphBBox(iGlyph, rtBBox)) {
          Lock();
          CFX_Rect rt;
          rt.Set(rtBBox.left, rtBBox.top, rtBBox.Width(), rtBBox.Height());
          int32_t index = m_pRectArray->Add(rt);
          pRect = m_pRectArray->GetPtrAt(index);
          m_pBBoxMap->SetAt((void*)(uintptr_t)wUnicode, pRect);
          Unlock();
        }
      } else if (((CFX_GEFont*)pFont)
                     ->GetCharBBox(wUnicode, bbox, FALSE, bCharCode)) {
        return TRUE;
      }
    }
  }
  if (pRect == NULL) {
    return FALSE;
  }
  bbox = *(FX_LPCRECT)pRect;
  return TRUE;
}
开发者ID:andoma,项目名称:pdfium,代码行数:34,代码来源:fx_gefont.cpp

示例2: FX_DaysInMonth

uint8_t FX_DaysInMonth(int32_t iYear, uint8_t iMonth) {
  FXSYS_assert(iYear != 0);
  FXSYS_assert(iMonth >= 1 && iMonth <= 12);
  const uint8_t* p =
      FX_IsLeapYear(iYear) ? g_FXDaysPerLeapMonth : g_FXDaysPerMonth;
  return p[iMonth - 1];
}
开发者ID:primiano,项目名称:pdfium-merge,代码行数:7,代码来源:fx_datetime.cpp

示例3: FXSYS_assert

void CCodec_RLScanlineDecoder::UpdateOperator(uint8_t used_bytes) {
  if (used_bytes == 0) {
    return;
  }
  if (m_Operator < 128) {
    FXSYS_assert((FX_DWORD)m_Operator + 1 >= used_bytes);
    if (used_bytes == m_Operator + 1) {
      m_SrcOffset += used_bytes;
      GetNextOperator();
      return;
    }
    m_Operator -= used_bytes;
    m_SrcOffset += used_bytes;
    if (m_SrcOffset >= m_SrcSize) {
      m_Operator = 128;
    }
    return;
  }
  uint8_t count = 257 - m_Operator;
  FXSYS_assert((FX_DWORD)count >= used_bytes);
  if (used_bytes == count) {
    m_SrcOffset++;
    GetNextOperator();
    return;
  }
  count -= used_bytes;
  m_Operator = 257 - count;
}
开发者ID:hoanganhx86,项目名称:pdfium,代码行数:28,代码来源:fx_codec.cpp

示例4: FXSYS_assert

void CFDE_RenderContext::RenderPath(IFDE_PathSet* pPathSet,
                                    FDE_HVISUALOBJ hPath) {
  FXSYS_assert(m_pRenderDevice != NULL);
  FXSYS_assert(pPathSet != NULL && hPath != NULL);
  IFDE_Path* pPath = pPathSet->GetPath(hPath);
  if (pPath == NULL) {
    return;
  }
  FDE_HDEVICESTATE hState;
  FX_BOOL bClip = ApplyClip(pPathSet, hPath, hState);
  int32_t iRenderMode = pPathSet->GetRenderMode(hPath);
  if (iRenderMode & FDE_PATHRENDER_Stroke) {
    IFDE_Pen* pPen = pPathSet->GetPen(hPath);
    FX_FLOAT fWidth = pPathSet->GetPenWidth(hPath);
    if (pPen != NULL && fWidth > 0) {
      m_pRenderDevice->DrawPath(pPen, fWidth, pPath, &m_Transform);
    }
  }
  if (iRenderMode & FDE_PATHRENDER_Fill) {
    IFDE_Brush* pBrush = pPathSet->GetBrush(hPath);
    if (pBrush != NULL) {
      m_pRenderDevice->FillPath(pBrush, pPath, &m_Transform);
    }
  }
  if (bClip) {
    RestoreClip(hState);
  }
}
开发者ID:andoma,项目名称:pdfium,代码行数:28,代码来源:fde_render.cpp

示例5: FX_GetCodePageFromStringA

FX_WORD FX_GetCodePageFromStringA(const FX_CHAR* pStr, int32_t iLength) {
  FXSYS_assert(pStr != NULL);
  if (iLength < 0) {
    iLength = FXSYS_strlen(pStr);
  }
  if (iLength == 0) {
    return 0xFFFF;
  }
  uint32_t uHash = FX_HashCode_String_GetA(pStr, iLength, TRUE);
  int32_t iStart = 0, iMid;
  int32_t iEnd = sizeof(g_FXCPHashTable) / sizeof(FX_STR2CPHASH) - 1;
  FXSYS_assert(iEnd >= 0);
  do {
    iMid = (iStart + iEnd) / 2;
    const FX_STR2CPHASH& cp = g_FXCPHashTable[iMid];
    if (uHash == cp.uHash) {
      return (FX_WORD)cp.uCodePage;
    } else if (uHash < cp.uHash) {
      iEnd = iMid - 1;
    } else {
      iStart = iMid + 1;
    }
  } while (iStart <= iEnd);
  return 0xFFFF;
}
开发者ID:primiano,项目名称:pdfium-merge,代码行数:25,代码来源:fx_codepage.cpp

示例6: FX_DaysBeforeMonthInYear

static int32_t FX_DaysBeforeMonthInYear(int32_t iYear, uint8_t iMonth) {
  FXSYS_assert(iYear != 0);
  FXSYS_assert(iMonth >= 1 && iMonth <= 12);
  const int32_t* p =
      FX_IsLeapYear(iYear) ? g_FXDaysBeforeLeapMonth : g_FXDaysBeforeMonth;
  return p[iMonth - 1];
}
开发者ID:primiano,项目名称:pdfium-merge,代码行数:7,代码来源:fx_datetime.cpp

示例7: FXSYS_assert

void CFDE_TxtEdtBuf::Insert(int32_t nPos,
                            const FX_WCHAR* lpText,
                            int32_t nLength) {
  FXSYS_assert(nPos >= 0 && nPos <= m_nTotal);
  FDE_CHUNKPLACE cp;
  Index2CP(nPos, cp);
  int32_t nLengthTemp = nLength;
  if (cp.nCharIndex != 0) {
    FDE_LPCHUNKHEADER lpNewChunk = (FDE_LPCHUNKHEADER)m_pAllocator->Alloc(
        sizeof(FDE_CHUNKHEADER) + (m_nChunkSize - 1) * sizeof(FX_WCHAR));
    FDE_LPCHUNKHEADER lpChunk = (FDE_LPCHUNKHEADER)m_Chunks[cp.nChunkIndex];
    int32_t nCopy = lpChunk->nUsed - cp.nCharIndex;
    FXSYS_memcpy(lpNewChunk->wChars, lpChunk->wChars + cp.nCharIndex,
                 nCopy * sizeof(FX_WCHAR));
    lpChunk->nUsed -= nCopy;
    cp.nChunkIndex++;
    m_Chunks.InsertAt(cp.nChunkIndex, lpNewChunk);
    lpNewChunk->nUsed = nCopy;
    cp.nCharIndex = 0;
  }
  if (cp.nChunkIndex != 0) {
    FDE_LPCHUNKHEADER lpChunk = (FDE_LPCHUNKHEADER)m_Chunks[cp.nChunkIndex - 1];
    if (lpChunk->nUsed != m_nChunkSize) {
      cp.nChunkIndex--;
      int32_t nFree = m_nChunkSize - lpChunk->nUsed;
      int32_t nCopy = std::min(nLengthTemp, nFree);
      FXSYS_memcpy(lpChunk->wChars + lpChunk->nUsed, lpText,
                   nCopy * sizeof(FX_WCHAR));
      lpText += nCopy;
      nLengthTemp -= nCopy;
      lpChunk->nUsed += nCopy;
      cp.nChunkIndex++;
    }
  }
  while (nLengthTemp > 0) {
    FDE_LPCHUNKHEADER lpChunk = (FDE_LPCHUNKHEADER)m_pAllocator->Alloc(
        sizeof(FDE_CHUNKHEADER) + (m_nChunkSize - 1) * sizeof(FX_WCHAR));
    FXSYS_assert(lpChunk);
    int32_t nCopy = std::min(nLengthTemp, m_nChunkSize);
    FXSYS_memcpy(lpChunk->wChars, lpText, nCopy * sizeof(FX_WCHAR));
    lpText += nCopy;
    nLengthTemp -= nCopy;
    lpChunk->nUsed = nCopy;
    m_Chunks.InsertAt(cp.nChunkIndex, lpChunk);
    cp.nChunkIndex++;
  }
  m_nTotal += nLength;
  m_bChanged = TRUE;
}
开发者ID:JinAirsOs,项目名称:pdfium,代码行数:49,代码来源:fde_txtedtbuf.cpp

示例8: switch

void CFDE_CSSStyleSheet::Reset() {
  for (int32_t i = m_RuleArray.GetSize() - 1; i >= 0; --i) {
    IFDE_CSSRule* pRule = m_RuleArray.GetAt(i);
    switch (pRule->GetType()) {
      case FDE_CSSRULETYPE_Style:
        ((CFDE_CSSStyleRule*)pRule)->~CFDE_CSSStyleRule();
        break;
      case FDE_CSSRULETYPE_Media:
        ((CFDE_CSSMediaRule*)pRule)->~CFDE_CSSMediaRule();
        break;
      case FDE_CSSRULETYPE_FontFace:
        ((CFDE_CSSFontFaceRule*)pRule)->~CFDE_CSSFontFaceRule();
        break;
      default:
        FXSYS_assert(FALSE);
        break;
    }
  }
  m_RuleArray.RemoveAll();
  m_Selectors.RemoveAll();
  m_StringCache.RemoveAll();
  if (m_pAllocator) {
    m_pAllocator->Release();
    m_pAllocator = NULL;
  }
}
开发者ID:andoma,项目名称:pdfium,代码行数:26,代码来源:fde_cssstylesheet.cpp

示例9: FXSYS_assert

CPDF_Image* CPDF_Document::LoadImageF(CPDF_Object* pObj) {
  if (!pObj) {
    return NULL;
  }
  FXSYS_assert(pObj->GetObjNum());
  return GetValidatePageData()->GetImage(pObj);
}
开发者ID:JinAirsOs,项目名称:pdfium,代码行数:7,代码来源:fpdf_page_doc.cpp

示例10: m_wCodePage

CFDE_CSSStyleSheet::CFDE_CSSStyleSheet(FX_DWORD dwMediaList)
    : m_wCodePage(FX_CODEPAGE_UTF8),
      m_wRefCount(1),
      m_dwMediaList(dwMediaList),
      m_pAllocator(NULL) {
  FXSYS_assert(m_dwMediaList > 0);
}
开发者ID:andoma,项目名称:pdfium,代码行数:7,代码来源:fde_cssstylesheet.cpp

示例11: jpeg_destroy_decompress

FX_BOOL CCodec_JpegDecoder::v_Rewind()
{
    if (m_pExtProvider) {
        return m_pExtProvider->Rewind(m_pExtContext);
    }
    if (m_bStarted) {
        jpeg_destroy_decompress(&cinfo);
        if (!InitDecode()) {
            return FALSE;
        }
    }
    if (setjmp(m_JmpBuf) == -1) {
        return FALSE;
    }
    cinfo.scale_denom = m_nDefaultScaleDenom * m_DownScale;
    m_OutputWidth = (m_OrigWidth + m_DownScale - 1) / m_DownScale;
    m_OutputHeight = (m_OrigHeight + m_DownScale - 1) / m_DownScale;
    if (!jpeg_start_decompress(&cinfo)) {
        jpeg_destroy_decompress(&cinfo);
        return FALSE;
    }
    if ((int)cinfo.output_width > m_OrigWidth) {
        FXSYS_assert(FALSE);
        return FALSE;
    }
    m_bStarted = TRUE;
    return TRUE;
}
开发者ID:BlissRoms,项目名称:platform_external_pdfium,代码行数:28,代码来源:fx_codec_jpeg.cpp

示例12: FXSYS_assert

FX_BOOL CFX_SAXFile::StartFile(IFX_FileRead* pFile,
                               FX_DWORD dwStart,
                               FX_DWORD dwLen) {
  FXSYS_assert(m_pFile == NULL && pFile != NULL);
  FX_DWORD dwSize = pFile->GetSize();
  if (dwStart >= dwSize) {
    return FALSE;
  }
  if (dwLen == -1 || dwStart + dwLen > dwSize) {
    dwLen = dwSize - dwStart;
  }
  if (dwLen == 0) {
    return FALSE;
  }
  m_dwBufSize = std::min(dwLen, kSaxFileBufSize);
  m_pBuf = FX_Alloc(uint8_t, m_dwBufSize);
  if (!pFile->ReadBlock(m_pBuf, dwStart, m_dwBufSize)) {
    return FALSE;
  }
  m_dwStart = dwStart;
  m_dwEnd = dwStart + dwLen;
  m_dwCur = dwStart;
  m_pFile = pFile;
  m_dwBufIndex = 0;
  return TRUE;
}
开发者ID:primiano,项目名称:pdfium-merge,代码行数:26,代码来源:fx_sax_imp.cpp

示例13: offsetof

// static
CFX_WideString::StringData* CFX_WideString::StringData::Create(int nLen)
{
    // TODO(palmer): |nLen| should really be declared as |size_t|, or
    // at least unsigned.
    if (nLen == 0 || nLen < 0) {
        return NULL;
    }

    // Fixed portion of header plus a NUL wide char not in m_nAllocLength.
    int overhead = offsetof(StringData, m_String) + sizeof(FX_WCHAR);
    pdfium::base::CheckedNumeric<int> iSize = nLen;
    iSize *= sizeof(FX_WCHAR);
    iSize += overhead;

    // Now round to an 8-byte boundary. We'd expect that this is the minimum
    // granularity of any of the underlying allocators, so there may be cases
    // where we can save a re-alloc when adding a few characters to a string
    // by using this otherwise wasted space.
    iSize += 7;
    int totalSize = iSize.ValueOrDie() & ~7;
    int usableLen = (totalSize - overhead) / sizeof(FX_WCHAR);
    FXSYS_assert(usableLen >= nLen);

    void* pData = FX_Alloc(uint8_t, iSize.ValueOrDie());
    return new (pData) StringData(nLen, usableLen);
}
开发者ID:mariospr,项目名称:chromium-browser,代码行数:27,代码来源:fx_basic_wstring.cpp

示例14: FXSYS_assert

void CXFA_ResolveProcessor::XFA_ResolveNode_DoPredicateFilter(
    int32_t iCurIndex,
    CFX_WideString wsCondition,
    int32_t iFoundCount,
    CXFA_ResolveNodesData& rnd) {
  CXFA_NodeArray& findNodes = (CXFA_NodeArray&)rnd.m_Nodes;
  FXSYS_assert(iFoundCount == findNodes.GetSize());
  CFX_WideString wsExpression;
  IXFA_ScriptContext* pContext = NULL;
  XFA_SCRIPTLANGTYPE eLangType = XFA_SCRIPTLANGTYPE_Unkown;
  if (wsCondition.Left(2) == FX_WSTRC(L".[") &&
      wsCondition.Right(1) == FX_WSTRC(L"]")) {
    eLangType = XFA_SCRIPTLANGTYPE_Formcalc;
  } else if (wsCondition.Left(2) == FX_WSTRC(L".(") &&
             wsCondition.Right(1) == FX_WSTRC(L")")) {
    eLangType = XFA_SCRIPTLANGTYPE_Javascript;
  } else {
    return;
  }
  pContext = rnd.m_pSC;
  wsExpression = wsCondition.Mid(2, wsCondition.GetLength() - 3);
  for (int32_t i = iFoundCount - 1; i >= 0; i--) {
    CXFA_Object* node = findNodes[i];
    FX_BOOL bRet = FALSE;
    FXJSE_HVALUE pRetValue = FXJSE_Value_Create(rnd.m_pSC->GetRuntime());
    bRet = pContext->RunScript(eLangType, wsExpression, pRetValue, node);
    if (!bRet || !FXJSE_Value_ToBoolean(pRetValue)) {
      findNodes.RemoveAt(i);
    }
    FXJSE_Value_Release(pRetValue);
  }
}
开发者ID:andoma,项目名称:pdfium,代码行数:32,代码来源:xfa_script_resolveprocessor.cpp

示例15: FXSYS_assert

void CPDF_Metadata::LoadDoc(CPDF_Document *pDoc)
{
    FXSYS_assert(pDoc != NULL);
    ((PDFDOC_LPMETADATA)m_pData)->m_pDoc = pDoc;
    CPDF_Dictionary *pRoot = pDoc->GetRoot();
    CPDF_Stream *pStream = pRoot->GetStream(FX_BSTRC("Metadata"));
    if (!pStream) {
        return;
    }
    CPDF_StreamAcc acc;
    acc.LoadAllData(pStream, FALSE);
    int size = acc.GetSize();
    FX_LPCBYTE pBuf = acc.GetData();
    CXML_Element *&pXmlElmnt = ((PDFDOC_LPMETADATA)m_pData)->m_pXmlElmnt;
    pXmlElmnt = CXML_Element::Parse(pBuf, size);
    if (!pXmlElmnt) {
        return;
    }
    CXML_Element *&pElmntRdf = ((PDFDOC_LPMETADATA)m_pData)->m_pElmntRdf;
    if (pXmlElmnt->GetTagName() == FX_BSTRC("RDF")) {
        pElmntRdf = pXmlElmnt;
    } else {
        pElmntRdf = pXmlElmnt->GetElement(NULL, FX_BSTRC("RDF"));
    }
}
开发者ID:codemonkey85,项目名称:pdfium,代码行数:25,代码来源:doc_metadata.cpp


注:本文中的FXSYS_assert函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。