本文整理汇总了C++中PL_strlen函数的典型用法代码示例。如果您正苦于以下问题:C++ PL_strlen函数的具体用法?C++ PL_strlen怎么用?C++ PL_strlen使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PL_strlen函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: groupNameToNamedGroup
SSLNamedGroup
groupNameToNamedGroup(char *name)
{
if (PL_strlen(name) == 4) {
if (!strncmp(name, "P256", 4)) {
return ssl_grp_ec_secp256r1;
}
if (!strncmp(name, "P384", 4)) {
return ssl_grp_ec_secp384r1;
}
if (!strncmp(name, "P521", 4)) {
return ssl_grp_ec_secp521r1;
}
}
if (PL_strlen(name) == 6) {
if (!strncmp(name, "x25519", 6)) {
return ssl_grp_ec_curve25519;
}
if (!strncmp(name, "FF2048", 6)) {
return ssl_grp_ffdhe_2048;
}
if (!strncmp(name, "FF3072", 6)) {
return ssl_grp_ffdhe_3072;
}
if (!strncmp(name, "FF4096", 6)) {
return ssl_grp_ffdhe_4096;
}
if (!strncmp(name, "FF6144", 6)) {
return ssl_grp_ffdhe_6144;
}
if (!strncmp(name, "FF8192", 6)) {
return ssl_grp_ffdhe_8192;
}
}
return ssl_grp_none;
}
开发者ID:subsevenx2001,项目名称:gecko-dev,代码行数:37,代码来源:basicutil.c
示例17: pref_DoCallback
static nsresult pref_DoCallback(const char* changed_pref)
{
nsresult rv = NS_OK;
struct CallbackNode* node;
bool reentered = gCallbacksInProgress;
gCallbacksInProgress = true;
// Nodes must not be deleted while gCallbacksInProgress is true.
// Nodes that need to be deleted are marked for deletion by nulling
// out the |func| pointer. We release them at the end of this function
// if we haven't reentered.
for (node = gCallbacks; node != NULL; node = node->next)
{
if ( node->func &&
PL_strncmp(changed_pref,
node->domain,
PL_strlen(node->domain)) == 0 )
{
nsresult rv2 = (*node->func) (changed_pref, node->data);
if (NS_FAILED(rv2))
rv = rv2;
}
}
gCallbacksInProgress = reentered;
if (gShouldCleanupDeadNodes && !gCallbacksInProgress)
{
struct CallbackNode* prev_node = NULL;
node = gCallbacks;
while (node != NULL)
{
if (!node->func)
{
node = pref_RemoveCallbackNode(node, prev_node);
}
else
{
prev_node = node;
node = node->next;
}
}
gShouldCleanupDeadNodes = false;
}
return rv;
}
开发者ID:michaelrhanson,项目名称:mozilla-central,代码行数:49,代码来源:prefapi.cpp
示例18: PKIX_TEST_STD_VARS
static char *catDirName(char *platform, char *dir, void *plContext)
{
char *pathName = NULL;
PKIX_UInt32 dirLen;
PKIX_UInt32 platformLen;
PKIX_TEST_STD_VARS();
dirLen = PL_strlen(dir);
platformLen = PL_strlen(platform);
PKIX_TEST_EXPECT_NO_ERROR(PKIX_PL_Malloc
(platformLen + dirLen + 2, (void **)&pathName, plContext));
PL_strcpy(pathName, platform);
PL_strcat(pathName, "/");
PL_strcat(pathName, dir);
cleanup:
PKIX_TEST_RETURN();
return (pathName);
}
开发者ID:AOSC-Dev,项目名称:nss-purified,代码行数:24,代码来源:test_nameconstraints.c
示例19: COMcopyString
const char *
COMcopyString (const char *str)
{
if (str)
{
const char *ret = (const char *)
nsMemory::Clone (str, sizeof (char) * (PL_strlen (str) + 1));
if (!ret)
abort ();
return ret;
}
else
return NULL;
}
开发者ID:PavelVinogradov,项目名称:gsoc08-onto-swarm,代码行数:15,代码来源:COMsupport.cpp
示例20: lexPushLookahead
static void lexPushLookahead(char *s, int len) {
int putptr;
if (len == 0) len = PL_strlen(s);
putptr = lexBuf.getPtr - len;
/* this function assumes that length of word to push back
* is not greater than PR_MAX_LEX_LOOKAHEAD.
*/
if (putptr < 0) putptr += PR_MAX_LEX_LOOKAHEAD;
lexBuf.getPtr = putptr;
while (*s) {
lexBuf.buf[putptr] = *s++;
putptr = (putptr + 1) % PR_MAX_LEX_LOOKAHEAD;
}
lexBuf.len += len;
}
开发者ID:mozilla,项目名称:releases-comm-central,代码行数:15,代码来源:nsVCard.cpp
注:本文中的PL_strlen函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论