• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ PR_smprintf函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: nssutil_formatPair

static char *
nssutil_formatPair(char *name, char *value, char quote)
{
    char openQuote = quote;
    char closeQuote = NSSUTIL_ArgGetPair(quote);
    char *newValue = NULL;
    char *returnValue;
    PRBool need_quote = PR_FALSE;

    if (!value || (*value == 0))
        return nssutil_nullString;

    if (nssutil_argHasBlanks(value) || NSSUTIL_ArgIsQuote(value[0]))
        need_quote = PR_TRUE;

    if ((need_quote && nssutil_argHasChar(value, closeQuote)) || nssutil_argHasChar(value, NSSUTIL_ARG_ESCAPE)) {
        value = newValue = nssutil_formatValue(NULL, value, quote);
        if (newValue == NULL)
            return nssutil_nullString;
    }
    if (need_quote) {
        returnValue = PR_smprintf("%s=%c%s%c", name, openQuote, value, closeQuote);
    } else {
        returnValue = PR_smprintf("%s=%s", name, value);
    }
    if (returnValue == NULL)
        returnValue = nssutil_nullString;

    if (newValue)
        PORT_Free(newValue);

    return returnValue;
}
开发者ID:luke-chang,项目名称:gecko-1,代码行数:33,代码来源:utilpars.c


示例2: CallCreateInstance

// This function takes a message uri, converts it into a file path & msgKey 
// pair. It then turns that into a mailbox url object. It also registers a url
// listener if appropriate. AND it can take in a mailbox action and set that field
// on the returned url as well.
nsresult nsMailboxService::PrepareMessageUrl(const char * aSrcMsgMailboxURI, nsIUrlListener * aUrlListener,
                                             nsMailboxAction aMailboxAction, nsIMailboxUrl ** aMailboxUrl,
                                             nsIMsgWindow *msgWindow)
{
  nsresult rv = CallCreateInstance(kCMailboxUrl, aMailboxUrl);
  if (NS_SUCCEEDED(rv) && aMailboxUrl && *aMailboxUrl)
  {
    // okay now generate the url string
    char * urlSpec;
    nsCAutoString folderURI;
    nsFileSpec folderPath;
    nsMsgKey msgKey;
    const char *part = PL_strstr(aSrcMsgMailboxURI, "part=");
    const char *header = PL_strstr(aSrcMsgMailboxURI, "header=");
    rv = nsParseLocalMessageURI(aSrcMsgMailboxURI, folderURI, &msgKey);
    NS_ENSURE_SUCCESS(rv,rv);
    rv = nsLocalURI2Path(kMailboxRootURI, folderURI.get(), folderPath);
    
    if (NS_SUCCEEDED(rv))
    {
      // set up the url spec and initialize the url with it.
      nsFilePath filePath(folderPath); // convert to file url representation...
      nsCAutoString buf;
      NS_EscapeURL((const char *)filePath,-1,
                   esc_Directory|esc_Forced|esc_AlwaysCopy,buf);
      if (mPrintingOperation)
        urlSpec = PR_smprintf("mailbox://%s?number=%d&header=print", buf.get(), msgKey);
      else if (part)
        urlSpec = PR_smprintf("mailbox://%s?number=%d&%s", buf.get(), msgKey, part);
      else if (header)
        urlSpec = PR_smprintf("mailbox://%s?number=%d&%s", buf.get(), msgKey, header);
      else
        urlSpec = PR_smprintf("mailbox://%s?number=%d", buf.get(), msgKey);
      
      nsCOMPtr <nsIMsgMailNewsUrl> url = do_QueryInterface(*aMailboxUrl);
      url->SetSpec(nsDependentCString(urlSpec));
      PR_Free(urlSpec);
      
      (*aMailboxUrl)->SetMailboxAction(aMailboxAction);
      
      // set up the url listener
      if (aUrlListener)
        rv = url->RegisterListener(aUrlListener);
      
      url->SetMsgWindow(msgWindow);
      nsCOMPtr<nsIMsgMessageUrl> msgUrl = do_QueryInterface(url);
      if (msgUrl)
      {
        msgUrl->SetOriginalSpec(aSrcMsgMailboxURI);
        msgUrl->SetUri(aSrcMsgMailboxURI);
      }
      
    } // if we got a url
  } // if we got a url
  
  return rv;
}
开发者ID:rn10950,项目名称:RetroZilla,代码行数:61,代码来源:nsMailboxService.cpp


示例3: CallCreateInstance

// This function takes a message uri, converts it into a file path & msgKey
// pair. It then turns that into a mailbox url object. It also registers a url
// listener if appropriate. AND it can take in a mailbox action and set that field
// on the returned url as well.
nsresult nsMailboxService::PrepareMessageUrl(const char * aSrcMsgMailboxURI, nsIUrlListener * aUrlListener,
                                             nsMailboxAction aMailboxAction, nsIMailboxUrl ** aMailboxUrl,
                                             nsIMsgWindow *msgWindow)
{
  nsresult rv = CallCreateInstance(NS_MAILBOXURL_CONTRACTID, aMailboxUrl);
  if (NS_SUCCEEDED(rv) && aMailboxUrl && *aMailboxUrl)
  {
    // okay now generate the url string
    char * urlSpec;
    nsCAutoString folderURI;
    nsMsgKey msgKey;
    nsCString folderPath;
    const char *part = PL_strstr(aSrcMsgMailboxURI, "part=");
    const char *header = PL_strstr(aSrcMsgMailboxURI, "header=");
    rv = nsParseLocalMessageURI(aSrcMsgMailboxURI, folderURI, &msgKey);
    NS_ENSURE_SUCCESS(rv,rv);
    rv = nsLocalURI2Path(kMailboxRootURI, folderURI.get(), folderPath);

    if (NS_SUCCEEDED(rv))
    {
      // set up the url spec and initialize the url with it.
      nsCAutoString buf;
      MsgEscapeURL(folderPath,
                   nsINetUtil::ESCAPE_URL_DIRECTORY | nsINetUtil::ESCAPE_URL_FORCED, buf);
      if (mPrintingOperation)
        urlSpec = PR_smprintf("mailbox://%s?number=%lu&header=print", buf.get(), msgKey);
      else if (part)
        urlSpec = PR_smprintf("mailbox://%s?number=%lu&%s", buf.get(), msgKey, part);
      else if (header)
        urlSpec = PR_smprintf("mailbox://%s?number=%lu&%s", buf.get(), msgKey, header);
      else
        urlSpec = PR_smprintf("mailbox://%s?number=%lu", buf.get(), msgKey);

      nsCOMPtr <nsIMsgMailNewsUrl> url = do_QueryInterface(*aMailboxUrl);
      url->SetSpec(nsDependentCString(urlSpec));
      PR_smprintf_free(urlSpec);

      (*aMailboxUrl)->SetMailboxAction(aMailboxAction);

      // set up the url listener
      if (aUrlListener)
        rv = url->RegisterListener(aUrlListener);

      url->SetMsgWindow(msgWindow);
      nsCOMPtr<nsIMsgMessageUrl> msgUrl = do_QueryInterface(url);
      if (msgUrl)
      {
        msgUrl->SetOriginalSpec(aSrcMsgMailboxURI);
        msgUrl->SetUri(aSrcMsgMailboxURI);
      }

    } // if we got a url
  } // if we got a url

  return rv;
}
开发者ID:mikeconley,项目名称:comm-central,代码行数:60,代码来源:nsMailboxService.cpp


示例4: DefaultServerNicknameForCert

char*
DefaultServerNicknameForCert(CERTCertificate* cert)
{
  char* nickname = nullptr;
  int count;
  bool conflict;
  char* servername = nullptr;

  servername = CERT_GetCommonName(&cert->subject);
  if (!servername) {
    // Certs without common names are strange, but they do exist...
    // Let's try to use another string for the nickname
    servername = CERT_GetOrgUnitName(&cert->subject);
    if (!servername) {
      servername = CERT_GetOrgName(&cert->subject);
      if (!servername) {
        servername = CERT_GetLocalityName(&cert->subject);
        if (!servername) {
          servername = CERT_GetStateName(&cert->subject);
          if (!servername) {
            servername = CERT_GetCountryName(&cert->subject);
            if (!servername) {
              // We tried hard, there is nothing more we can do.
              // A cert without any names doesn't really make sense.
              return nullptr;
            }
          }
        }
      }
    }
  }

  count = 1;
  while (1) {
    if (count == 1) {
      nickname = PR_smprintf("%s", servername);
    }
    else {
      nickname = PR_smprintf("%s #%d", servername, count);
    }
    if (!nickname) {
      break;
    }

    conflict = SEC_CertNicknameConflict(nickname, &cert->derSubject,
                                        cert->dbhandle);
    if (!conflict) {
      break;
    }
    PR_Free(nickname);
    count++;
  }
  PR_FREEIF(servername);
  return nickname;
}
开发者ID:sandhua,项目名称:gecko-dev,代码行数:55,代码来源:NSSCertDBTrustDomain.cpp


示例5: PR_smprintf

/*
 GenerateFullFolderNameWithDefaultNamespace takes a folder name in canonical form,
  converts it to online form, allocates a string to contain the full online server name
  including the namespace prefix of the default namespace of the given type, in the form:
  PR_smprintf("%s%s", prefix, onlineServerName) if there is a NULL owner
  PR_smprintf("%s%s%c%s", prefix, owner, delimiter, onlineServerName) if there is an owner
  It then converts this back to canonical form and returns it (allocated) to libmsg.
  It returns NULL if there is no namespace of the given type.
  If nsUsed is not passed in as NULL, then *nsUsed is filled in and returned;  it is the
  namespace used for generating the folder name.
*/
char *nsIMAPNamespaceList::GenerateFullFolderNameWithDefaultNamespace(const char *hostName,
        const char *canonicalFolderName,
        const char *owner,
        EIMAPNamespaceType nsType,
        nsIMAPNamespace **nsUsed)
{
    nsresult rv = NS_OK;

    nsCOMPtr<nsIImapHostSessionList> hostSession =
        do_GetService(kCImapHostSessionListCID, &rv);
    NS_ENSURE_SUCCESS(rv, nullptr);
    nsIMAPNamespace *ns;
    char *fullFolderName = nullptr;
    rv = hostSession->GetDefaultNamespaceOfTypeForHost(hostName, nsType, ns);
    NS_ENSURE_SUCCESS(rv, nullptr);
    if (ns)
    {
        if (nsUsed)
            *nsUsed = ns;
        const char *prefix = ns->GetPrefix();
        char *convertedFolderName = AllocateServerFolderName(canonicalFolderName, ns->GetDelimiter());
        if (convertedFolderName)
        {
            char *convertedReturnName = nullptr;
            if (owner)
            {
                convertedReturnName = PR_smprintf("%s%s%c%s", prefix, owner, ns->GetDelimiter(), convertedFolderName);
            }
            else
            {
                convertedReturnName = PR_smprintf("%s%s", prefix, convertedFolderName);
            }

            if (convertedReturnName)
            {
                fullFolderName = AllocateCanonicalFolderName(convertedReturnName, ns->GetDelimiter());
                PR_Free(convertedReturnName);
            }
            PR_Free(convertedFolderName);
        }
        else
        {
            NS_ASSERTION(false, "couldn't allocate server folder name");
        }
    }
    else
    {
        // Could not find other users namespace on the given host
        NS_ASSERTION(false, "couldn't find namespace for given host");
    }
    return (fullFolderName);
}
开发者ID:dualsky,项目名称:FossaMail,代码行数:63,代码来源:nsIMAPNamespace.cpp


示例6: FipsMode

/*************************************************************************
 *
 * F i p s M o d e
 * If arg=="true", enable FIPS mode on the internal module.  If arg=="false",
 * disable FIPS mode on the internal module.
 */
Error
FipsMode(char *arg)
{
    char *internal_name;

    if (!PORT_Strcasecmp(arg, "true")) {
        if (!PK11_IsFIPS()) {
            internal_name = PR_smprintf("%s",
                                        SECMOD_GetInternalModule()->commonName);
            if (SECMOD_DeleteInternalModule(internal_name) != SECSuccess) {
                PR_fprintf(PR_STDERR, "%s\n", SECU_Strerror(PORT_GetError()));
                PR_smprintf_free(internal_name);
                PR_fprintf(PR_STDERR, errStrings[FIPS_SWITCH_FAILED_ERR]);
                return FIPS_SWITCH_FAILED_ERR;
            }
            PR_smprintf_free(internal_name);
            if (!PK11_IsFIPS()) {
                PR_fprintf(PR_STDERR, errStrings[FIPS_SWITCH_FAILED_ERR]);
                return FIPS_SWITCH_FAILED_ERR;
            }
            PR_fprintf(PR_STDOUT, msgStrings[FIPS_ENABLED_MSG]);
        } else {
            PR_fprintf(PR_STDERR, errStrings[FIPS_ALREADY_ON_ERR]);
            return FIPS_ALREADY_ON_ERR;
        }
    } else if (!PORT_Strcasecmp(arg, "false")) {
        if (PK11_IsFIPS()) {
            internal_name = PR_smprintf("%s",
                                        SECMOD_GetInternalModule()->commonName);
            if (SECMOD_DeleteInternalModule(internal_name) != SECSuccess) {
                PR_fprintf(PR_STDERR, "%s\n", SECU_Strerror(PORT_GetError()));
                PR_smprintf_free(internal_name);
                PR_fprintf(PR_STDERR, errStrings[FIPS_SWITCH_FAILED_ERR]);
                return FIPS_SWITCH_FAILED_ERR;
            }
            PR_smprintf_free(internal_name);
            if (PK11_IsFIPS()) {
                PR_fprintf(PR_STDERR, errStrings[FIPS_SWITCH_FAILED_ERR]);
                return FIPS_SWITCH_FAILED_ERR;
            }
            PR_fprintf(PR_STDOUT, msgStrings[FIPS_DISABLED_MSG]);
        } else {
            PR_fprintf(PR_STDERR, errStrings[FIPS_ALREADY_OFF_ERR]);
            return FIPS_ALREADY_OFF_ERR;
        }
    } else {
        PR_fprintf(PR_STDERR, errStrings[INVALID_FIPS_ARG]);
        return INVALID_FIPS_ARG;
    }

    return SUCCESS;
}
开发者ID:emaldona,项目名称:nss,代码行数:58,代码来源:pk11.c


示例7: Pk11Install_yyerror

void
Pk11Install_yyerror(char *message)
{
    char *tmp;
    if (Pk11Install_yyerrstr) {
        tmp = PR_smprintf("%sline %d: %s\n", Pk11Install_yyerrstr,
                          Pk11Install_yylinenum, message);
        PR_smprintf_free(Pk11Install_yyerrstr);
    } else {
        tmp = PR_smprintf("line %d: %s\n", Pk11Install_yylinenum, message);
    }
    Pk11Install_yyerrstr = tmp;
}
开发者ID:MichaelKohler,项目名称:gecko-dev,代码行数:13,代码来源:installparse.c


示例8: DosQueryResourceSize

/* Returned string needs to be PR_Free'd by caller */
static char *LoadRCDATAVersion(HMODULE hMod, ULONG resid)
{
   APIRET rc;
   ULONG  ulSize = 0;
   char  *string = 0;

   rc = DosQueryResourceSize(hMod, RT_RCDATA, resid, &ulSize);

   // version info is should be 8 chars
   if (rc == NO_ERROR && ulSize == 8)
   {
      char *version = NULL;
      rc = DosGetResource(hMod, RT_RCDATA, resid, (void**) &version);

      if (rc == NO_ERROR)
      {
         string = PR_smprintf("%d.%d.%d.%d\n",
                              version[0], version[2], version[4], version[6]);

         DosFreeResource(version);
      }
   }

   return string;
}
开发者ID:amyvmiwei,项目名称:firefox,代码行数:26,代码来源:nsPluginsDirOS2.cpp


示例9: DEBUG_LOG

nsresult
nsEnigMsgCompose::WriteSignedHeaders1(EMBool isEightBit)
{
  nsresult rv;
  DEBUG_LOG(("nsEnigMsgCompose::WriteSignedHeaders1: %d\n", (int) isEightBit));

  rv = MakeBoundary("enig");
  if (NS_FAILED(rv))
    return rv;

  char* headers = PR_smprintf(
       "Content-Type: multipart/signed; micalg=pgp-%s;\r\n"
       " protocol=\"application/pgp-signature\";\r\n"
       " boundary=\"%s\"\r\n"
       "%s"
       "This is an OpenPGP/MIME signed message (RFC 2440 and 3156)\r\n"
       "--%s\r\n",
       mHashAlgorithm.get(), mBoundary.get(),
       isEightBit ? "Content-Transfer-Encoding: 8bit\r\n\r\n" : "\r\n",
       mBoundary.get());

  if (!headers)
    return NS_ERROR_OUT_OF_MEMORY;

  rv = WriteOut(headers, strlen(headers));

  PR_Free(headers);

  return rv;
}
开发者ID:imudak,项目名称:enigmail,代码行数:30,代码来源:nsEnigMsgCompose.cpp


示例10: lg_keydb_name_cb

static char *
lg_keydb_name_cb(void *arg, int dbVersion)
{
    const char *configdir = (const char *)arg;
    const char *dbver;
    char *smpname = NULL;
    char *dbname = NULL;
    
    switch (dbVersion) {
      case 4:
	dbver = "4";
	break;
      case 3:
	dbver = "3";
	break;
      case 1:
	dbver = "1";
	break;
      case 2:
      default:
	dbver = "";
	break;
    }

    smpname = PR_smprintf(KEY_DB_FMT, configdir, dbver);
    if (smpname) {
	dbname = PORT_Strdup(smpname);
	PR_smprintf_free(smpname);
    }
    return dbname;
}
开发者ID:Jar-win,项目名称:Waterfox,代码行数:31,代码来源:lginit.c


示例11: nsIMAPBodypartLeaf

nsIMAPBodypartMessage::nsIMAPBodypartMessage(char *partNum,
                                             nsIMAPBodypart *parentPart,
                                             bool topLevelMessage,
                                             char *bodyType, char *bodySubType,
                                             char *bodyID,
                                             char *bodyDescription,
                                             char *bodyEncoding,
                                             int32_t partLength,
                                             bool preferPlainText)
 : nsIMAPBodypartLeaf(partNum, parentPart, bodyType, bodySubType, bodyID,
                      bodyDescription, bodyEncoding, partLength,
                      preferPlainText)
{
  m_topLevelMessage = topLevelMessage;
  if (m_topLevelMessage)
  {
    m_partNumberString = PR_smprintf("0");
    if (!m_partNumberString)
    {
      SetIsValid(false);
      return;
    }
  }
  m_body = NULL;
  m_headers = new nsIMAPMessageHeaders(m_partNumberString, this);  // We always have a Headers object
  if (!m_headers || !m_headers->GetIsValid())
  {
    SetIsValid(false);
    return;
  }
  SetIsValid(true);
}
开发者ID:Type-of-Tool,项目名称:ExMail,代码行数:32,代码来源:nsIMAPBodyShell.cpp


示例12: lg_OpenKeyDB

static CK_RV
lg_OpenKeyDB(const char * configdir, const char *prefix, PRBool readOnly,
    						NSSLOWKEYDBHandle **keydbPtr)
{
    NSSLOWKEYDBHandle *keydb;
    char * name = NULL;
    char * appName = NULL;

    if (prefix == NULL) {
	prefix = "";
    }
    configdir = lg_EvaluateConfigDir(configdir, &appName);

    name = PR_smprintf("%s" PATH_SEPARATOR "%s",configdir,prefix);	
    if (name == NULL) 
	return CKR_HOST_MEMORY;
    keydb = nsslowkey_OpenKeyDB(readOnly, appName, prefix, 
					lg_keydb_name_cb, (void *)name);
    PR_smprintf_free(name);
    if (appName) PORT_Free(appName);
    if (keydb == NULL)
	return CKR_NETSCAPE_KEYDB_FAILED;
    *keydbPtr = keydb;

    return CKR_OK;
}
开发者ID:Jar-win,项目名称:Waterfox,代码行数:26,代码来源:lginit.c


示例13: do_CreateInstance

nsresult nsMailboxService::ParseMailbox(nsIMsgWindow *aMsgWindow, nsFileSpec& aMailboxPath, nsIStreamListener *aMailboxParser, 
										nsIUrlListener * aUrlListener, nsIURI ** aURL)
{
  nsresult rv;
  nsCOMPtr<nsIMailboxUrl> mailboxurl = do_CreateInstance(kCMailboxUrl, &rv);
  if (NS_SUCCEEDED(rv) && mailboxurl)
  {
    nsCOMPtr<nsIMsgMailNewsUrl> url = do_QueryInterface(mailboxurl);
    // okay now generate the url string
    nsFilePath filePath(aMailboxPath); // convert to file url representation...
    nsCAutoString buf;
    NS_EscapeURL((const char *)filePath,-1,
                     esc_Minimal|esc_Forced|esc_AlwaysCopy,buf);
    url->SetUpdatingFolder(PR_TRUE);
    url->SetMsgWindow(aMsgWindow);
    char *temp = PR_smprintf("mailbox://%s", buf.get());
    url->SetSpec(nsDependentCString(temp));
    PR_Free(temp);
    mailboxurl->SetMailboxParser(aMailboxParser);
    if (aUrlListener)
      url->RegisterListener(aUrlListener);
    
    RunMailboxUrl(url, nsnull);
    
    if (aURL)
    {
      *aURL = url;
      NS_IF_ADDREF(*aURL);
    }
  }
  
  return rv;
}
开发者ID:rn10950,项目名称:RetroZilla,代码行数:33,代码来源:nsMailboxService.cpp


示例14: DEBUG_LOG

nsresult
nsEnigMimeDecrypt::ProcessPlainData(char* buf, PRUint32 readCount)
{
  DEBUG_LOG(("nsEnigMimeDecrypt::ProcessPlainData: readCount=%d\n", readCount));

  int status;
  ++mIterations;
  // Read synchronously


  if (mIterations == 1 && readCount > 25) {
    // add mime boundaries around text/plain message (bug 6627)
    if (PL_strncasecmp("content-type:", buf, 13)==0) {
      PRUint32 whitespace=13;
      while((whitespace<readCount) && buf[whitespace] &&
            ((buf[whitespace]==' ') || (buf[whitespace]=='\t'))) { whitespace++; }
      if (buf[whitespace] && (whitespace<readCount)) {
        mCtFound = PL_strncasecmp(buf + whitespace, "text/plain", 10);
        if (mCtFound != 0) {
          mCtFound=PL_strncasecmp(buf + whitespace, "text/html", 9);
        }
      }
      if (mCtFound == 0) {
        char* header = PR_smprintf(
        "Content-Type: multipart/mixed; boundary=\"enigDummy\""
        "\n\n--enigDummy\n");
        PR_SetError(0,0);
        status = mOutputFun(header, strlen(header), mOutputClosure);
        if (status < 0) {
          PR_SetError(status, 0);
          mOutputFun = NULL;
          mOutputClosure = NULL;

          return NS_ERROR_FAILURE;
        }
        mOutputLen += strlen(header);
      }
    }
  }

  if (readCount < kCharMax) {
    // make sure we can continue to write later
    if (buf[readCount-1]==0) --readCount;
  }

  PR_SetError(0,0);
  status = mOutputFun(buf, readCount, mOutputClosure);
  if (status < 0) {
    PR_SetError(status, 0);
    mOutputFun = NULL;
    mOutputClosure = NULL;

    return NS_ERROR_FAILURE;
  }

  mOutputLen += readCount;

  return NS_OK;
} // loop end
开发者ID:imudak,项目名称:enigmail,代码行数:59,代码来源:nsEnigMimeDecrypt.cpp


示例15: PR_FREEIF

void
nsIMAPBodypartMultipart::SetBodySubType(char *bodySubType)
{
  PR_FREEIF(m_bodySubType);
  PR_FREEIF(m_contentType);
  m_bodySubType = bodySubType;
  if (m_bodyType && m_bodySubType)
    m_contentType = PR_smprintf("%s/%s", m_bodyType, m_bodySubType);
}
开发者ID:Type-of-Tool,项目名称:ExMail,代码行数:9,代码来源:nsIMAPBodyShell.cpp


示例16: PR_smprintf

NS_IMETHODIMP
nsBaseDOMException::ToString(char **aReturn)
{
  *aReturn = nsnull;

  static const char defaultMsg[] = "<no message>";
  static const char defaultLocation[] = "<unknown>";
  static const char defaultName[] = "<unknown>";
  static const char format[] =
    "[Exception... \"%s\"  code: \"%d\" nsresult: \"0x%x (%s)\"  location: \"%s\"]";

  nsCAutoString location;

  if (mInner) {
    nsXPIDLCString filename;

    mInner->GetFilename(getter_Copies(filename));

    if (!filename.IsEmpty()) {
      PRUint32 line_nr = 0;

      mInner->GetLineNumber(&line_nr);

      char *temp = PR_smprintf("%s Line: %d", filename.get(), line_nr);
      if (temp) {
        location.Assign(temp);
        PR_smprintf_free(temp);
      }
    }
  }

  if (location.IsEmpty()) {
    location = defaultLocation;
  }

  const char* msg = mMessage ? mMessage : defaultMsg;
  const char* resultName = mName ? mName : defaultName;
  PRUint32 code = NS_ERROR_GET_CODE(mResult);

  *aReturn = PR_smprintf(format, msg, code, mResult, resultName,
                         location.get());

  return *aReturn ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
}
开发者ID:b2gautomation,项目名称:mozilla-central,代码行数:44,代码来源:nsDOMException.cpp


示例17: PR_smprintf

char *nsMsgSearchAdapter::GetImapCharsetParam(const char16_t *destCharset) {
  char *result = nullptr;

  // Specify a character set unless we happen to be US-ASCII.
  if (NS_strcmp(destCharset, u"us-ascii"))
    result = PR_smprintf("%s%s", nsMsgSearchAdapter::m_kImapCharset,
                         NS_ConvertUTF16toUTF8(destCharset).get());

  return result;
}
开发者ID:mozilla,项目名称:releases-comm-central,代码行数:10,代码来源:nsMsgSearchAdapter.cpp


示例18: main

int main(int argc, char* argv[])
{
  ScopedLogging log;

  nsCOMPtr<nsILocalFile> appini;
  nsresult rv = XRE_GetBinaryPath(argv[0], getter_AddRefs(appini));
  if (NS_FAILED(rv)) {
    Output("Couldn't calculate the application directory.");
    return 255;
  }
  appini->SetNativeLeafName(NS_LITERAL_CSTRING("application.ini"));

  // Allow firefox.exe to launch XULRunner apps via -app <application.ini>
  // Note that -app must be the *first* argument.
  char *appEnv = nsnull;
  const char *appDataFile = PR_GetEnv("XUL_APP_FILE");
  if (appDataFile && *appDataFile) {
    rv = XRE_GetFileFromPath(appDataFile, getter_AddRefs(appini));
    if (NS_FAILED(rv)) {
      Output("Invalid path found: '%s'", appDataFile);
      return 255;
    }
  }
  else if (argc > 1 && IsArg(argv[1], "app")) {
    if (argc == 2) {
      Output("Incorrect number of arguments passed to -app");
      return 255;
    }

    rv = XRE_GetFileFromPath(argv[2], getter_AddRefs(appini));
    if (NS_FAILED(rv)) {
      Output("application.ini path not recognized: '%s'", argv[2]);
      return 255;
    }

    appEnv = PR_smprintf("XUL_APP_FILE=%s", argv[2]);
    PR_SetEnv(appEnv);
    argv[2] = argv[0];
    argv += 2;
    argc -= 2;
  }

  nsXREAppData *appData;
  rv = XRE_CreateAppData(appini, &appData);
  if (NS_FAILED(rv)) {
    Output("Couldn't read application.ini");
    return 255;
  }

  int result = XRE_main(argc, argv, appData);
  XRE_FreeAppData(appData);
  if (appEnv)
    PR_smprintf_free(appEnv);
  return result;
}
开发者ID:Akin-Net,项目名称:mozilla-central,代码行数:55,代码来源:nsBrowserApp.cpp


示例19: PR_smprintf

char *
nsMsgSearchAdapter::GetImapCharsetParam(const PRUnichar *destCharset)
{
  char *result = nsnull;

  // Specify a character set unless we happen to be US-ASCII.
  if (NS_strcmp(destCharset, NS_LITERAL_STRING("us-ascii").get()))
      result = PR_smprintf("%s%s", nsMsgSearchAdapter::m_kImapCharset, NS_ConvertUTF16toUTF8(destCharset).get());

  return result;
}
开发者ID:alanyjw,项目名称:comm-central,代码行数:11,代码来源:nsMsgSearchAdapter.cpp


示例20: jar_callback

/*************************************************************************
 *
 * j a r _ c a l l b a c k
 */
static int
jar_callback(int status, JAR *foo, const char *bar, char *pathname,
	char *errortext) {
	char *string;

	string = PR_smprintf("JAR error %d: %s in file %s\n", status, errortext,
		pathname);
	error(PK11_INSTALL_ERROR_STRING, string);
	PR_smprintf_free(string);
	return 0;
}
开发者ID:Anachid,项目名称:mozilla-central,代码行数:15,代码来源:install.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ PR_smprintf_free函数代码示例发布时间:2022-05-30
下一篇:
C++ PR_fprintf函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap