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


C++ PL_strlen函数代码示例

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


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

示例1: decode

nsresult nsCMSSecureMessage::
decode(const char *data, unsigned char **result, PRInt32 * _retval)
{
  PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("nsCMSSecureMessage::decode\n"));
  nsresult rv = NS_OK;
  PRUint32 len = PL_strlen(data);
  int adjust = 0;

  /* Compute length adjustment */
  if (data[len-1] == '=') {
    adjust++;
    if (data[len-2] == '=') adjust++;
  }

  *result = (unsigned char *)PL_Base64Decode(data, len, NULL);
  if (!*result) {
    PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("nsCMSSecureMessage::decode - error decoding base64\n"));
    rv = NS_ERROR_ILLEGAL_VALUE;
    goto loser;
  }

  *_retval = (len*3)/4 - adjust;

loser:
  return rv;
}
开发者ID:FunkyVerb,项目名称:devtools-window,代码行数:26,代码来源:nsCMSSecureMessage.cpp

示例2: DeliverQueuedLine

// Stream is done...drive on!
NS_IMETHODIMP
nsMsgSendLater::OnStopRequest(nsIRequest *request, nsISupports *ctxt, nsresult status)
{
  nsresult    rv;

  // First, this shouldn't happen, but if
  // it does, flush the buffer and move on.
  if (mLeftoverBuffer)
  {
    DeliverQueuedLine(mLeftoverBuffer, PL_strlen(mLeftoverBuffer));
  }

  if (mOutFile)
    mOutFile->Close();

  // See if we succeeded on reading the message from the message store?
  //
  if (NS_SUCCEEDED(status))
  {
    // Message is done...send it!
    rv = CompleteMailFileSend();

#ifdef NS_DEBUG
    printf("nsMsgSendLater: Success on getting message...\n");
#endif
    
    // If the send operation failed..try the next one...
    if (NS_FAILED(rv))
    {
      rv = StartNextMailFileSend(rv);
      if (NS_FAILED(rv))
        EndSendMessages(rv, nullptr, mTotalSendCount, mTotalSentSuccessfully);
    }
  }
  else
  {
    nsCOMPtr<nsIChannel> channel = do_QueryInterface(request);
    if(!channel) return NS_ERROR_FAILURE;

    // extract the prompt object to use for the alert from the url....
    nsCOMPtr<nsIURI> uri; 
    nsCOMPtr<nsIPrompt> promptObject;
    if (channel)
    {
      channel->GetURI(getter_AddRefs(uri));
      nsCOMPtr<nsISmtpUrl> smtpUrl (do_QueryInterface(uri));
      if (smtpUrl)
        smtpUrl->GetPrompt(getter_AddRefs(promptObject));
    } 
    nsMsgDisplayMessageByID(promptObject, NS_ERROR_QUEUED_DELIVERY_FAILED);
    
    // Getting the data failed, but we will still keep trying to send the rest...
    rv = StartNextMailFileSend(status);
    if (NS_FAILED(rv))
      EndSendMessages(rv, nullptr, mTotalSendCount, mTotalSentSuccessfully);
  }

  return rv;
}
开发者ID:dualsky,项目名称:FossaMail,代码行数:60,代码来源:nsMsgSendLater.cpp

示例3: PL_strlen

// returns -1 if this box is not part of this namespace,
// or the length of the prefix if it is part of this namespace
int nsIMAPNamespace::MailboxMatchesNamespace(const char *boxname)
{
    if (!boxname) return -1;

    // If the namespace is part of the boxname
    if (!m_prefix || !*m_prefix)
        return 0;

    if (PL_strstr(boxname, m_prefix) == boxname)
        return PL_strlen(m_prefix);

    // If the boxname is part of the prefix
    // (Used for matching Personal mailbox with Personal/ namespace, etc.)
    if (PL_strstr(m_prefix, boxname) == m_prefix)
        return PL_strlen(boxname);
    return -1;
}
开发者ID:dualsky,项目名称:FossaMail,代码行数:19,代码来源:nsIMAPNamespace.cpp

示例4: appendsOFile

static void appendsOFile(OFile *fp, const char *s)
{
    int i, slen;
    slen  = PL_strlen (s);
    for (i=0; i<slen; i++) {
  appendcOFile(fp,s[i]);
  }
}
开发者ID:binoc-software,项目名称:mozilla-cvs,代码行数:8,代码来源:nsVCardObj.cpp

示例5: SetOtherHeaders

int nsMsgSendPart::AppendOtherHeaders(const char* more)
{
  if (!m_other)
    return SetOtherHeaders(more);

  if (!more || !*more)
    return 0;

  char* tmp = (char *) PR_Malloc(sizeof(char) * (PL_strlen(m_other) + PL_strlen(more) + 2));
  if (!tmp)
    return NS_ERROR_OUT_OF_MEMORY;

  PL_strcpy(tmp, m_other);
  PL_strcat(tmp, more);
  PR_FREEIF(m_other);
  m_other = tmp;

  return 0;
}
开发者ID:vanto,项目名称:comm-central,代码行数:19,代码来源:nsMsgSendPart.cpp

示例6: nsCreateImapBaseMessageURI

nsresult nsCreateImapBaseMessageURI(const nsACString& baseURI, nsCString &baseMessageURI)
{
    nsCAutoString tailURI(baseURI);
    // chop off imap:/
    if (tailURI.Find(kImapRootURI) == 0)
        tailURI.Cut(0, PL_strlen(kImapRootURI));
    baseMessageURI = kImapMessageRootURI;
    baseMessageURI += tailURI;
    return NS_OK;
}
开发者ID:mikeconley,项目名称:comm-central,代码行数:10,代码来源:nsImapUtils.cpp

示例7: PL_strcaserstr

PL_strcaserstr(const char *big, const char *little)
{
    const char *p;
    PRUint32 ll;

    if( ((const char *)0 == big) || ((const char *)0 == little) ) return (char *)0;
    if( ((char)0 == *big) || ((char)0 == *little) ) return (char *)0;

    ll = PL_strlen(little);
    p = &big[ PL_strlen(big) - ll ];
    if( p < big ) return (char *)0;

    for( ; p >= big; p-- )
        /* obvious improvement available here */
        if( 0 == PL_strncasecmp(p, little, ll) )
            return (char *)p;

    return (char *)0;
}
开发者ID:marktsai0316,项目名称:VirtualMonitor,代码行数:19,代码来源:strcstr.c

示例8: QueuePrefetchMIMEHeader

int32_t nsIMAPBodypart::GenerateMIMEHeader(nsIMAPBodyShell *aShell, bool stream, bool prefetch)
{
  if (prefetch && !m_headerData)
  {
    QueuePrefetchMIMEHeader(aShell);
    return 0;
  }
  else if (m_headerData)
  {
    int32_t mimeHeaderLength = 0;
    
    if (!ShouldFetchInline(aShell))
    {
      // if this part isn't inline, add the X-Mozilla-IMAP-Part header
      char *xPartHeader = PR_smprintf("%s: %s", IMAP_EXTERNAL_CONTENT_HEADER, m_partNumberString);
      if (xPartHeader)
      {
        if (stream)
        {
          aShell->GetConnection()->Log("SHELL","GENERATE-XHeader",m_partNumberString);
          aShell->GetConnection()->HandleMessageDownLoadLine(xPartHeader, false);
        }
        mimeHeaderLength += PL_strlen(xPartHeader);
        PR_Free(xPartHeader);
      }
    }
    
    mimeHeaderLength += PL_strlen(m_headerData);
    if (stream)
    {
      aShell->GetConnection()->Log("SHELL","GENERATE-MIMEHeader",m_partNumberString);
      aShell->GetConnection()->HandleMessageDownLoadLine(m_headerData, false);  // all one line?  Can we do that?
    }
    
    return mimeHeaderLength;
  }
  else 
  {
    SetIsValid(false);	// prefetch didn't adopt a MIME header
    return 0;
  }
}
开发者ID:Type-of-Tool,项目名称:ExMail,代码行数:42,代码来源:nsIMAPBodyShell.cpp

示例9: NS_ASSERTION

// static 
xptiFileType::Type xptiFileType::GetType(const char* name)
{
    NS_ASSERTION(name, "loser!");
    int len = PL_strlen(name);
    for(const xptiFileTypeEntry* p = g_Entries; p->name; p++)
    {
        if(len > p->len && 0 == PL_strcasecmp(p->name, &(name[len - p->len])))
            return p->type;
    }
    return UNKNOWN;        
}        
开发者ID:LastRitter,项目名称:vbox-haiku,代码行数:12,代码来源:xptiMisc.cpp

示例10: COMfindComponent

COMclass
COMfindComponent (const char *className)
{
  const char *prefix = "urn:";
  const char *modulePrefix = "swarm/";
  size_t prefixLen = PL_strlen (prefix);
  size_t modulePrefixLen = PL_strlen (modulePrefix);
  nsCID *cClass = new nsCID ();
  size_t classNameLen = PL_strlen (className);
  char *buf = (char *) malloc (prefixLen + classNameLen + 1);
  if (!buf)
    abort ();
  nsresult rv;

  PL_strcpy (buf, prefix);
  PL_strcat (buf, className);
  if (PL_strncmp (className, modulePrefix, modulePrefixLen) == 0)
    {
      unsigned i;

      buf[prefixLen + 5] = ':';
      for (i = modulePrefixLen; i < classNameLen; i++)
        {
          unsigned pos = prefixLen + i;
          
          if (buf[pos] == '/')
            buf[pos] = '.';
        }
    }
  nsCOMPtr<nsIComponentManager> compMgr;
  NS_GetComponentManager (getter_AddRefs (compMgr));  
  if (!compMgr)
    abort ();
  nsCOMPtr<nsIComponentManagerObsolete> compMgrO = do_QueryInterface (compMgr);
  rv = compMgrO->ContractIDToClassID (buf, cClass);
  free (buf);
 
  if (NS_FAILED (rv))
    abort ();
  return (COMclass) cClass;
}
开发者ID:PavelVinogradov,项目名称:gsoc08-onto-swarm,代码行数:41,代码来源:COMsupport.cpp

示例11: PL_strlen

int32_t nsIMAPBodypart::GenerateBoundary(nsIMAPBodyShell *aShell, bool stream, bool prefetch, bool lastBoundary)
{
  if (prefetch)
    return 0;	// don't need to prefetch anything
  
  if (m_boundaryData)
  {
    if (!lastBoundary)
    {
      if (stream)
      {
        aShell->GetConnection()->Log("SHELL","GENERATE-Boundary",m_partNumberString);
        aShell->GetConnection()->HandleMessageDownLoadLine(m_boundaryData, false);
      }
      return PL_strlen(m_boundaryData);
    }
    else	// the last boundary
    {
      char *lastBoundaryData = PR_smprintf("%s--", m_boundaryData);
      if (lastBoundaryData)
      {
        if (stream)
        {
          aShell->GetConnection()->Log("SHELL","GENERATE-Boundary-Last",m_partNumberString);
          aShell->GetConnection()->HandleMessageDownLoadLine(lastBoundaryData, false);
        }
        int32_t rv = PL_strlen(lastBoundaryData);
        PR_Free(lastBoundaryData);
        return rv;
      }
      else
      {
        //HandleMemoryFailure();
        return 0;
      }
    }
  }
  else
    return 0;
}
开发者ID:Type-of-Tool,项目名称:ExMail,代码行数:40,代码来源:nsIMAPBodyShell.cpp

示例12: nsCreateNewsBaseMessageURI

nsresult nsCreateNewsBaseMessageURI(const char *baseURI, nsCString &baseMessageURI)
{
  nsAutoCString tailURI(baseURI);

  // chop off news:/
  if (tailURI.Find(kNewsRootURI) == 0)
    tailURI.Cut(0, PL_strlen(kNewsRootURI));

  baseMessageURI = kNewsMessageRootURI;
  baseMessageURI += tailURI;

  return NS_OK;
}
开发者ID:MoonchildProductions,项目名称:FossaMail,代码行数:13,代码来源:nsNewsUtils.cpp

示例13: pkix_pl_UInt32_Overflows

/*
 * FUNCTION: pkix_pl_UInt32_Overflows
 * DESCRIPTION:
 *
 *  Returns a PKIX_Boolean indicating whether the unsigned integer
 *  represented by "string" is too large to fit in 32-bits (i.e.
 *  whether it overflows). With the exception of the string "0",
 *  all other strings are stripped of any leading zeros. It is assumed
 *  that every character in "string" is from the set {'0' - '9'}.
 *
 * PARAMETERS
 *  "string"
 *      Address of array of bytes representing PKIX_UInt32 that's being tested
 *      for 32-bit overflow
 * THREAD SAFETY:
 *  Thread Safe (see Thread Safety Definitions in Programmer's Guide)
 * RETURNS:
 *  PKIX_TRUE if PKIX_UInt32 represented by "string" overflows;
 *  PKIX_FALSE otherwise
 */
PKIX_Boolean
pkix_pl_UInt32_Overflows(char *string){
        char *firstNonZero = NULL;
        PKIX_UInt32 length, i;
        char *MAX_UINT32_STRING = "4294967295";

        PKIX_DEBUG_ENTER(OID);

        PKIX_OID_DEBUG("\tCalling PL_strlen).\n");
        length = PL_strlen(string);

        if (length < MAX_DIGITS_32){
                return (PKIX_FALSE);
        }

        firstNonZero = string;
        for (i = 0; i < length; i++){
                if (*string == '0'){
                        firstNonZero++;
                }
        }

        PKIX_OID_DEBUG("\tCalling PL_strlen).\n");
        length = PL_strlen(firstNonZero);

        if (length > MAX_DIGITS_32){
                return (PKIX_TRUE);
        }

        PKIX_OID_DEBUG("\tCalling PL_strlen).\n");
        if (length == MAX_DIGITS_32){
                PKIX_OID_DEBUG("\tCalling PORT_Strcmp).\n");
                if (PORT_Strcmp(firstNonZero, MAX_UINT32_STRING) > 0){
                        return (PKIX_TRUE);
                }
        }

        return (PKIX_FALSE);
}
开发者ID:AOSC-Dev,项目名称:nss-purified,代码行数:59,代码来源:pkix_pl_common.c

示例14: AppendAndAlloc

static char *
AppendAndAlloc(char *string, const char *newSubstring, bool withComma)
{
    if (!newSubstring) return NULL;
    
    if (!string) return PL_strdup(newSubstring);
    
    char *separator = (char *) (withComma ? ", " : " ");
    char *oldString = string;
    
    string = (char *)PR_Calloc(PL_strlen(oldString) +
                               PL_strlen(separator) +
                               PL_strlen(newSubstring) + 1,
                               sizeof(char));
    
    PL_strcpy(string, oldString);
    PL_strcat(string, separator);
    PL_strcat(string, newSubstring);

    PR_Free(oldString);
    return string;
}
开发者ID:vanto,项目名称:comm-central,代码行数:22,代码来源:nsNNTPNewsgroupPost.cpp

示例15: NSSBase64_DecodeBuffer

NS_IMETHODIMP 
nsNSSCertificateDB::FindCertByDBKey(const char *aDBkey, nsISupports *aToken,
                                   nsIX509Cert **_cert)
{
  nsNSSShutDownPreventionLock locker;
  SECItem keyItem = {siBuffer, nsnull, 0};
  SECItem *dummy;
  CERTIssuerAndSN issuerSN;
  unsigned long moduleID,slotID;
  *_cert = nsnull; 
  if (!aDBkey || !*aDBkey)
    return NS_ERROR_INVALID_ARG;

  dummy = NSSBase64_DecodeBuffer(nsnull, &keyItem, aDBkey,
                                 (PRUint32)PL_strlen(aDBkey)); 
  if (!dummy || keyItem.len < NS_NSS_LONG*4) {
    PR_FREEIF(keyItem.data);
    return NS_ERROR_INVALID_ARG;
  }

  CERTCertificate *cert;
  // someday maybe we can speed up the search using the moduleID and slotID
  moduleID = NS_NSS_GET_LONG(keyItem.data);
  slotID = NS_NSS_GET_LONG(&keyItem.data[NS_NSS_LONG]);

  // build the issuer/SN structure
  issuerSN.serialNumber.len = NS_NSS_GET_LONG(&keyItem.data[NS_NSS_LONG*2]);
  issuerSN.derIssuer.len = NS_NSS_GET_LONG(&keyItem.data[NS_NSS_LONG*3]);
  if (issuerSN.serialNumber.len == 0 || issuerSN.derIssuer.len == 0
      || issuerSN.serialNumber.len + issuerSN.derIssuer.len
         != keyItem.len - NS_NSS_LONG*4) {
    PR_FREEIF(keyItem.data);
    return NS_ERROR_INVALID_ARG;
  }
  issuerSN.serialNumber.data= &keyItem.data[NS_NSS_LONG*4];
  issuerSN.derIssuer.data= &keyItem.data[NS_NSS_LONG*4+
                                              issuerSN.serialNumber.len];

  cert = CERT_FindCertByIssuerAndSN(CERT_GetDefaultCertDB(), &issuerSN);
  PR_FREEIF(keyItem.data);
  if (cert) {
    nsNSSCertificate *nssCert = new nsNSSCertificate(cert);
    CERT_DestroyCertificate(cert);
    if (nssCert == nsnull)
      return NS_ERROR_OUT_OF_MEMORY;
    NS_ADDREF(nssCert);
    *_cert = static_cast<nsIX509Cert*>(nssCert);
  }
  return NS_OK;
}
开发者ID:amyvmiwei,项目名称:firefox,代码行数:50,代码来源:nsNSSCertificateDB.cpp


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