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

C++ PL_strncasecmp函数代码示例

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

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



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

示例1: PL_strrchr

// The file name must be in the form "np*.dll"
PRBool nsPluginsDir::IsPluginFile(nsIFile* file)
{
  nsCAutoString path;
  if (NS_FAILED(file->GetNativePath(path)))
    return PR_FALSE;

  const char *cPath = path.get();

  // this is most likely a path, so skip to the filename
  const char* filename = PL_strrchr(cPath, '\\');
  if (filename)
    ++filename;
  else
    filename = cPath;

  char* extension = PL_strrchr(filename, '.');
  if (extension)
    ++extension;

  PRUint32 fullLength = PL_strlen(filename);
  PRUint32 extLength = PL_strlen(extension);
  if (fullLength >= 7 && extLength == 3) {
    if (!PL_strncasecmp(filename, "np", 2) && !PL_strncasecmp(extension, "dll", 3)) {
      // don't load OJI-based Java plugins
      if (!PL_strncasecmp(filename, "npoji", 5) ||
          !PL_strncasecmp(filename, "npjava", 6))
        return PR_FALSE;
      return PR_TRUE;
    }
  }

  return PR_FALSE;
}
开发者ID:Akin-Net,项目名称:mozilla-central,代码行数:34,代码来源:nsPluginsDirWin.cpp


示例2: urldecode_base64chars_inplace

/* Will only work if the original input to url encoding was
 * a base64 encoded buffer. Will only decode the sequences used
 * for encoding the special base64 characters, and fail if any
 * other encoded chars are found.
 * Will return SECSuccess if input could be processed.
 * Coversion is done in place.
 */
static SECStatus
urldecode_base64chars_inplace(char *buf)
{
    char *walk;
    size_t remaining_bytes;

    if (!buf || !*buf)
        return SECFailure;

    walk = buf;
    remaining_bytes = strlen(buf) + 1; /* include terminator */

    while (*walk) {
        if (*walk == '%') {
            if (!PL_strncasecmp(walk, "%2B", 3)) {
                *walk = '+';
            } else if (!PL_strncasecmp(walk, "%2F", 3)) {
                *walk = '/';
            } else if (!PL_strncasecmp(walk, "%3D", 3)) {
                *walk = '=';
            } else {
                return SECFailure;
            }
            remaining_bytes -= 3;
            ++walk;
            memmove(walk, walk + 2, remaining_bytes);
        } else {
            ++walk;
            --remaining_bytes;
        }
    }
    return SECSuccess;
}
开发者ID:MichaelKohler,项目名称:gecko-dev,代码行数:40,代码来源:httpserv.c


示例3: 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


示例4: PL_strncasecmp

PRBool nsPluginNativeWindowGtk2::CanGetValueFromPlugin(nsCOMPtr<nsIPluginInstance> &aPluginInstance)
{
#ifdef OJI
  if(aPluginInstance) {
    nsresult rv;
    nsCOMPtr<nsIPluginInstancePeer> peer;

    rv = aPluginInstance->GetPeer(getter_AddRefs(peer));
    if (NS_SUCCEEDED(rv) && peer) {
      const char *aMimeType = nsnull;

      peer->GetMIMEType((nsMIMEType*)&aMimeType);
      if (aMimeType &&
          (PL_strncasecmp(aMimeType, "application/x-java-vm", 21) == 0 ||
           PL_strncasecmp(aMimeType, "application/x-java-applet", 25) == 0)) {
        nsCOMPtr<nsIPluginHost> pluginHost = do_GetService(kPluginManagerCID, &rv);
        if (NS_SUCCEEDED(rv) && pluginHost) {
          nsIPlugin* pluginFactory = NULL;

          rv = pluginHost->GetPluginFactory("application/x-java-vm", &pluginFactory);
          if (NS_SUCCEEDED(rv) && pluginFactory) {
            const char * jpiDescription;

            pluginFactory->GetValue(nsPluginVariable_DescriptionString, (void*)&jpiDescription);
            /** 
             * "Java(TM) Plug-in" is Sun's Java Plugin Trademark,
             * so we are sure that this is Sun 's Java Plugin if 
             * the description start with "Java(TM) Plug-in"
             **/
            if (PL_strncasecmp(jpiDescription, "Java(TM) Plug-in", 16) == 0) {
              // Java Plugin support Xembed from JRE 1.5
              if (PL_strcasecmp(jpiDescription + 17, "1.5") < 0)
                return PR_FALSE;
            }
            if (PL_strncasecmp(jpiDescription, "<a href=\"http://www.blackdown.org/java-linux.html\">", 51) == 0) {
              // Java Plugin support Xembed from JRE 1.5
              if (PL_strcasecmp(jpiDescription + 92, "1.5") < 0)
                return PR_FALSE;
            }
            if (PL_strncasecmp(jpiDescription, "IBM Java(TM) Plug-in", 20) == 0) {
              // Java Plugin support Xembed from JRE 1.5
              if (PL_strcasecmp(jpiDescription + 27, "1.5") < 0)
                return PR_FALSE;
            }
          }
        }
      }
    }
  }
#endif

  return PR_TRUE;
}
开发者ID:rn10950,项目名称:RetroZilla,代码行数:53,代码来源:nsPluginNativeWindowGtk2.cpp


示例5: NS_ENSURE_ARG_POINTER

/* void asyncConvertData (in string aFromType, in string aToType,
 *                        in nsIStreamListener aListener,
 *                        in nsISupports aCtxt); */
NS_IMETHODIMP nsDeflateConverter::AsyncConvertData(const char *aFromType,
                                                   const char *aToType,
                                                   nsIStreamListener *aListener,
                                                   nsISupports *aCtxt)
{
    if (mListener)
        return NS_ERROR_ALREADY_INITIALIZED;

    NS_ENSURE_ARG_POINTER(aListener);

    if (!PL_strncasecmp(aToType, ZLIB_TYPE, sizeof(ZLIB_TYPE)-1))
        mWrapMode = WRAP_ZLIB;
    else if (!PL_strcasecmp(aFromType, GZIP_TYPE) ||
             !PL_strcasecmp(aFromType, X_GZIP_TYPE))
        mWrapMode = WRAP_GZIP;
    else
        mWrapMode = WRAP_NONE;

    nsresult rv = Init();
    NS_ENSURE_SUCCESS(rv, rv);

    mListener = aListener;
    mContext = aCtxt;
    return rv;
}
开发者ID:Akin-Net,项目名称:mozilla-central,代码行数:28,代码来源:nsDeflateConverter.cpp


示例6: strlen

const char *
nsHttp::FindToken(const char *input, const char *token, const char *seps)
{
    if (!input)
        return nsnull;

    int inputLen = strlen(input);
    int tokenLen = strlen(token);

    if (inputLen < tokenLen)
        return nsnull;

    const char *inputTop = input;
    const char *inputEnd = input + inputLen - tokenLen;
    for (; input <= inputEnd; ++input) {
        if (PL_strncasecmp(input, token, tokenLen) == 0) {
            if (input > inputTop && !strchr(seps, *(input - 1)))
                continue;
            if (input < inputEnd && !strchr(seps, *(input + tokenLen)))
                continue;
            return input;
        }
    }

    return nsnull;
}
开发者ID:MozillaOnline,项目名称:gecko-dev,代码行数:26,代码来源:nsHttp.cpp


示例7: IsMonthStr

int nsEudoraMailbox::IsMonthStr(const char *pStr)
{
  for (int i = 0; i < 12; i++) {
    if (!PL_strncasecmp(pStr, eudoraMonths[i], 3))
      return i + 1;
  }
  return 0;
}
开发者ID:hsinyi,项目名称:releases-comm-central,代码行数:8,代码来源:nsEudoraMailbox.cpp


示例8: IsWeekDayStr

int nsEudoraMailbox::IsWeekDayStr(const char *pStr)
{
  for (int i = 0; i < 7; i++) {
    if (!PL_strncasecmp(pStr, eudoraWeekDays[i], 3))
      return i + 1;
  }
  return 0;
}
开发者ID:hsinyi,项目名称:releases-comm-central,代码行数:8,代码来源:nsEudoraMailbox.cpp


示例9: LocateHttpStart

static char *
LocateHttpStart(char *buf, PRUint32 len)
{
    // if we have received less than 4 bytes of data, then we'll have to
    // just accept a partial match, which may not be correct.
    if (len < 4)
        return (PL_strncasecmp(buf, "HTTP", len) == 0) ? buf : 0;

    // PL_strncasestr would be perfect for this, but unfortunately bug 96571
    // prevents its use here.
    while (len >= 4) {
        if (PL_strncasecmp(buf, "HTTP", 4) == 0)
            return buf;
        buf++;
        len--;
    }
    return 0;
}
开发者ID:amyvmiwei,项目名称:firefox,代码行数:18,代码来源:nsHttpTransaction.cpp


示例10: MimeHeaders_write_raw_headers

/* Writes the headers as text/plain.
   This writes out a blank line after the headers, unless
   dont_write_content_type is true, in which case the header-block
   is not closed off, and none of the Content- headers are written.
 */
int
MimeHeaders_write_raw_headers (MimeHeaders *hdrs, MimeDisplayOptions *opt,
                 bool dont_write_content_type)
{
  int status;

  if (hdrs && !hdrs->done_p)
  {
    hdrs->done_p = true;
    status = MimeHeaders_build_heads_list(hdrs);
    if (status < 0) return 0;
  }

  nsCString name;
  name.Adopt(MimeHeaders_get_name(hdrs, opt));
  MimeHeaders_convert_header_value(opt, name, false);

  if (!dont_write_content_type)
  {
    char nl[] = MSG_LINEBREAK;
    if (hdrs)
    {
      status = MimeHeaders_write(opt, name, hdrs->all_headers,
                                 hdrs->all_headers_fp);
      if (status < 0) return status;
    }
    status = MimeHeaders_write(opt, name, nl, strlen(nl));
    if (status < 0) return status;
  }
  else if (hdrs)
  {
    int32_t i;
    for (i = 0; i < hdrs->heads_size; i++)
    {
      char *head = hdrs->heads[i];
      char *end = (i == hdrs->heads_size-1
             ? hdrs->all_headers + hdrs->all_headers_fp
             : hdrs->heads[i+1]);

      NS_ASSERTION(head, "1.22 <[email protected]> 22 Aug 1999 08:48");
      if (!head) continue;

      /* Don't write out any Content- header. */
      if (!PL_strncasecmp(head, "Content-", 8))
      continue;

      /* Write out this (possibly multi-line) header. */
      status = MimeHeaders_write(opt, name, head, end - head);
      if (status < 0) return status;
    }
  }

  if (hdrs)
    MimeHeaders_compact(hdrs);

  return 0;
}
开发者ID:Type-of-Tool,项目名称:ExMail,代码行数:62,代码来源:mimehdrs.cpp


示例11: MimeMultipartAlternative_display_part_p

static bool
MimeMultipartAlternative_display_part_p(MimeObject *self,
                    MimeHeaders *sub_hdrs)
{
  char *ct = MimeHeaders_get (sub_hdrs, HEADER_CONTENT_TYPE, true, false);
  if (!ct)
    return false;

  /* RFC 1521 says:
     Receiving user agents should pick and display the last format
     they are capable of displaying.  In the case where one of the
     alternatives is itself of type "multipart" and contains unrecognized
     sub-parts, the user agent may choose either to show that alternative,
     an earlier alternative, or both.

   Ugh.  If there is a multipart subtype of alternative, we simply show
   that, without descending into it to determine if any of its sub-parts
   are themselves unknown.
   */

  // prefer_plaintext pref
  nsIPrefBranch *prefBranch = GetPrefBranch(self->options);
  bool prefer_plaintext = false;
  if (prefBranch)
    prefBranch->GetBoolPref("mailnews.display.prefer_plaintext",
                            &prefer_plaintext);
  if (prefer_plaintext
      && self->options->format_out != nsMimeOutput::nsMimeMessageSaveAs
      && (!PL_strncasecmp(ct, "text/html", 9) ||
          !PL_strncasecmp(ct, "text/enriched", 13) ||
          !PL_strncasecmp(ct, "text/richtext", 13))
     )
    // if the user prefers plaintext and this is the "rich" (e.g. HTML) part...
  {
    return false;
  }

  MimeObjectClass *clazz = mime_find_class (ct, sub_hdrs, self->options, true);
  bool result = (clazz
          ? clazz->displayable_inline_p(clazz, sub_hdrs)
          : false);
  PR_FREEIF(ct);
  return result;
}
开发者ID:MoonchildProductions,项目名称:FossaMail,代码行数:44,代码来源:mimemalt.cpp


示例12:

int
nsCaseInsensitiveCStringComparator::operator()( const char_type* lhs, const char_type* rhs, PRUint32 aLength ) const
  {
    PRInt32 result=PRInt32(PL_strncasecmp(lhs, rhs, aLength));
    //Egads. PL_strncasecmp is returning *very* negative numbers.
    //Some folks expect -1,0,1, so let's temper its enthusiasm.
    if (result<0) 
      result=-1;
    return result;
  }
开发者ID:MozillaOnline,项目名称:gecko-dev,代码行数:10,代码来源:nsStringComparator.cpp


示例13: strstr

bool
nsHttpNegotiateAuth::MatchesBaseURI(const nsCSubstring &matchScheme,
                                    const nsCSubstring &matchHost,
                                    PRInt32             matchPort,
                                    const char         *baseStart,
                                    const char         *baseEnd)
{
    // check if scheme://host:port matches baseURI

    // parse the base URI
    const char *hostStart, *schemeEnd = strstr(baseStart, "://");
    if (schemeEnd) {
        // the given scheme must match the parsed scheme exactly
        if (!matchScheme.Equals(Substring(baseStart, schemeEnd)))
            return false;
        hostStart = schemeEnd + 3;
    }
    else
        hostStart = baseStart;

    // XXX this does not work for IPv6-literals
    const char *hostEnd = strchr(hostStart, ':');
    if (hostEnd && hostEnd < baseEnd) {
        // the given port must match the parsed port exactly
        int port = atoi(hostEnd + 1);
        if (matchPort != (PRInt32) port)
            return false;
    }
    else
        hostEnd = baseEnd;


    // if we didn't parse out a host, then assume we got a match.
    if (hostStart == hostEnd)
        return true;

    PRUint32 hostLen = hostEnd - hostStart;

    // matchHost must either equal host or be a subdomain of host
    if (matchHost.Length() < hostLen)
        return false;

    const char *end = matchHost.EndReading();
    if (PL_strncasecmp(end - hostLen, hostStart, hostLen) == 0) {
        // if matchHost ends with host from the base URI, then make sure it is
        // either an exact match, or prefixed with a dot.  we don't want
        // "foobar.com" to match "bar.com"
        if (matchHost.Length() == hostLen ||
            *(end - hostLen) == '.' ||
            *(end - hostLen - 1) == '.')
            return true;
    }

    return false;
}
开发者ID:FunkyVerb,项目名称:devtools-window,代码行数:55,代码来源:nsHttpNegotiateAuth.cpp


示例14: lock

PRUint16
nsDNSService::GetAFForLookup(const nsACString &host)
{
    if (mDisableIPv6)
        return PR_AF_INET;

    nsAutoLock lock(mLock);

    PRUint16 af = PR_AF_UNSPEC;

    if (!mIPv4OnlyDomains.IsEmpty()) {
        const char *domain, *domainEnd, *end;
        PRUint32 hostLen, domainLen;

        // see if host is in one of the IPv4-only domains
        domain = mIPv4OnlyDomains.BeginReading();
        domainEnd = mIPv4OnlyDomains.EndReading(); 

        nsACString::const_iterator hostStart;
        host.BeginReading(hostStart);
        hostLen = host.Length();

        do {
            // skip any whitespace
            while (*domain == ' ' || *domain == '\t')
                ++domain;

            // find end of this domain in the string
            end = strchr(domain, ',');
            if (!end)
                end = domainEnd;

            // to see if the hostname is in the domain, check if the domain
            // matches the end of the hostname.
            domainLen = end - domain;
            if (domainLen && hostLen >= domainLen) {
                const char *hostTail = hostStart.get() + hostLen - domainLen;
                if (PL_strncasecmp(domain, hostTail, domainLen) == 0) {
                    // now, make sure either that the hostname is a direct match or
                    // that the hostname begins with a dot.
                    if (hostLen == domainLen ||
                            *hostTail == '.' || *(hostTail - 1) == '.') {
                        af = PR_AF_INET;
                        break;
                    }
                }
            }

            domain = end + 1;
        } while (*end);
    }

    return af;
}
开发者ID:rn10950,项目名称:RetroZilla,代码行数:54,代码来源:nsDNSService2.cpp


示例15: meth_to_int

static int
meth_to_int(char **map_method, int *err)
{
	char *end;
	int len;
	int ret = PAMPT_MAP_METHOD_NONE;

	*err = 0;
	if (!map_method || !*map_method) {
		return ret;
	}

	end = strchr(*map_method, ' ');
	if (!end) {
		len = strlen(*map_method);
	} else {
		len = end - *map_method;
	}
	if (!PL_strncasecmp(*map_method, PAMPT_MAP_METHOD_DN_STRING, len)) {
		ret = PAMPT_MAP_METHOD_DN;
	} else if (!PL_strncasecmp(*map_method, PAMPT_MAP_METHOD_RDN_STRING, len)) {
		ret = PAMPT_MAP_METHOD_RDN;
	} else if (!PL_strncasecmp(*map_method, PAMPT_MAP_METHOD_ENTRY_STRING, len)) {
		ret = PAMPT_MAP_METHOD_ENTRY;
	} else {
		*err = 1;
	}

	if (!*err) {
		if (end && *end) {
			*map_method = end + 1;
		} else {
			*map_method = NULL;
		}
	}

	return ret;
}
开发者ID:Firstyear,项目名称:ds,代码行数:38,代码来源:pam_ptconfig.c


示例16: sizeof

NS_IMETHODIMP
nsHTTPCompressConv::AsyncConvertData(const char *aFromType,
                                     const char *aToType,
                                     nsIStreamListener *aListener,
                                     nsISupports *aCtxt)
{
    if (!PL_strncasecmp(aFromType, HTTP_COMPRESS_TYPE, sizeof(HTTP_COMPRESS_TYPE)-1) ||
            !PL_strncasecmp(aFromType, HTTP_X_COMPRESS_TYPE, sizeof(HTTP_X_COMPRESS_TYPE)-1))
        mMode = HTTP_COMPRESS_COMPRESS;

    else if (!PL_strncasecmp(aFromType, HTTP_GZIP_TYPE, sizeof(HTTP_GZIP_TYPE)-1) ||
             !PL_strncasecmp(aFromType, HTTP_X_GZIP_TYPE, sizeof(HTTP_X_GZIP_TYPE)-1))
        mMode = HTTP_COMPRESS_GZIP;

    else if (!PL_strncasecmp(aFromType, HTTP_DEFLATE_TYPE, sizeof(HTTP_DEFLATE_TYPE)-1))
        mMode = HTTP_COMPRESS_DEFLATE;

    // hook ourself up with the receiving listener.
    mListener = aListener;
    NS_ADDREF(mListener);

    mAsyncConvContext = aCtxt;
    return NS_OK;
}
开发者ID:qiuyang001,项目名称:Spidermonkey,代码行数:24,代码来源:nsHTTPCompressConv.cpp


示例17: PL_strcasestr

PL_strcasestr(const char *big, const char *little)
{
    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);

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

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


示例18: adjust_idl_switch

/*
 * adjust_idl_switch
 * if the current nsslapd-idl-switch is different from ldbmversion,
 * update the value of nsslapd-idl-switch (in LDBM_CONFIG_ENTRY)
 */
int
adjust_idl_switch(char *ldbmversion, struct ldbminfo *li)
{
    int rval = 0;

    li->li_flags |= LI_FORCE_MOD_CONFIG;
    if ((0 == PL_strncasecmp(ldbmversion, BDB_IMPL, strlen(BDB_IMPL))) ||
        (0 == PL_strcmp(ldbmversion, LDBM_VERSION)))    /* db: new idl */
    {
        if (!idl_get_idl_new())   /* config: old idl */
        {
            replace_ldbm_config_value(CONFIG_IDL_SWITCH, "new", li);
            LDAPDebug(LDAP_DEBUG_ANY, 
                "Warning: Dbversion %s does not meet nsslapd-idl-switch: \"old\"; "
                "nsslapd-idl-switch is updated to \"new\"\n",

                ldbmversion, 0, 0);
        }
    }
    else if ((0 == strcmp(ldbmversion, LDBM_VERSION_OLD)) ||
             (0 == PL_strcmp(ldbmversion, LDBM_VERSION_61)) ||
             (0 == PL_strcmp(ldbmversion, LDBM_VERSION_62)) ||
             (0 == strcmp(ldbmversion, LDBM_VERSION_60)))    /* db: old */
    {
        if (idl_get_idl_new())   /* config: new */
        {
            replace_ldbm_config_value(CONFIG_IDL_SWITCH, "old", li);
            LDAPDebug(LDAP_DEBUG_ANY, 
                "Warning: Dbversion %s does not meet nsslapd-idl-switch: \"new\"; "
                "nsslapd-idl-switch is updated to \"old\"\n",
                ldbmversion, 0, 0);
        }
    }
    else
    {
         LDAPDebug(LDAP_DEBUG_ANY, 
                   "Warning: Dbversion %s is not supported\n", 
                   ldbmversion, 0, 0);
         rval = 1;
    }

    /* ldbminfo is a common resource; should clean up when the job is done */
    li->li_flags &= ~LI_FORCE_MOD_CONFIG;
    return rval;
}
开发者ID:leto,项目名称:389-ds,代码行数:50,代码来源:upgrade.c


示例19: Check

// Verify that nsCRT versions of string comparison routines get the
// same answers as the native non-unicode versions. We only pass in
// iso-latin-1 strings, so the comparison must be valid.
static void Check(const char* s1, const char* s2, PRIntn n)
{
  PRIntn clib = PL_strcmp(s1, s2);
  PRIntn clib_n = PL_strncmp(s1, s2, n);
  PRIntn clib_case = PL_strcasecmp(s1, s2);
  PRIntn clib_case_n = PL_strncasecmp(s1, s2, n);

  nsAutoString t1,t2; 
  t1.AssignWithConversion(s1);
  t2.AssignWithConversion(s2);
  const PRUnichar* us1 = t1.get();
  const PRUnichar* us2 = t2.get();

  PRIntn u2 = nsCRT::strcmp(us1, us2);
  PRIntn u2_n = nsCRT::strncmp(us1, us2, n);

  NS_ASSERTION(sign(clib) == sign(u2), "strcmp");
  NS_ASSERTION(sign(clib_n) == sign(u2_n), "strncmp");
}
开发者ID:bringhurst,项目名称:vbox,代码行数:22,代码来源:TestCRT.cpp


示例20: PL_strncasestr

PL_strncasestr(const char *big, const char *little, PRUint32 max)
{
    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);
    if( ll > max ) return (char *)0;
    max -= ll;
    max++;

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

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



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ PM8058_GPIO_PM_TO_SYS函数代码示例发布时间:2022-05-30
下一篇:
C++ PL_strlen函数代码示例发布时间: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