Bug 252541 remove nsString::IsSpace and nsString::IsASCII

r=darin sr=dbaron
This commit is contained in:
cbiesinger%web.de 2004-07-25 12:12:39 +00:00
Родитель b39229fabe
Коммит edd98105f6
6 изменённых файлов: 13 добавлений и 49 удалений

Просмотреть файл

@ -95,6 +95,7 @@
#include "nsDOMString.h"
#include "nsGenericElement.h"
#include "nsNodeInfoManager.h"
#include "nsCRT.h"
static const char kJSStackContractID[] = "@mozilla.org/js/xpc/ContextStack;1";
static NS_DEFINE_IID(kParserServiceCID, NS_PARSERSERVICE_CID);
@ -1268,7 +1269,7 @@ nsContentUtils::TrimWhitespace(const nsAString& aStr, PRBool aTrimTrailing)
aStr.EndReading(end);
// Skip whitespace charaters in the beginning
while (start != end && nsString::IsSpace(*start)) {
while (start != end && nsCRT::IsAsciiSpace(*start)) {
++start;
}
@ -1277,7 +1278,7 @@ nsContentUtils::TrimWhitespace(const nsAString& aStr, PRBool aTrimTrailing)
while (end != start) {
--end;
if (!nsString::IsSpace(*end)) {
if (!nsCRT::IsAsciiSpace(*end)) {
// Step back to the last non-whitespace character.
++end;

Просмотреть файл

@ -506,11 +506,11 @@ nsHTMLContentSerializer::EscapeURI(const nsAString& aURI, nsAString& aEscapedURI
// But we eventually want to use UTF-8 instead of a document charset, then the code would be much simpler.
// See HTML 4.01 spec, "Appendix B.2.1 Non-ASCII characters in URI attribute values"
nsCOMPtr<nsITextToSubURI> textToSubURI;
nsAutoString uri(aURI); // in order to use FindCharInSet(), IsASCII()
nsAutoString uri(aURI); // in order to use FindCharInSet()
nsresult rv = NS_OK;
if (!mCharSet.IsEmpty() && !uri.IsASCII()) {
if (!mCharSet.IsEmpty() && !IsASCII(uri)) {
textToSubURI = do_GetService(NS_ITEXTTOSUBURI_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
}

Просмотреть файл

@ -89,6 +89,8 @@
#include "nsAutoPtr.h"
#include "nsIMsgVCardService.h"
#include "nsCRT.h"
// according to RFC 2849
// SEP = (CR LF / LF)
// so we LF for unix and beos (since that is the natural line ending for
@ -580,7 +582,7 @@ nsresult AddressBookParser::str_parse_line(
}
/* trim any space between type and : */
for ( p = s - 1; p > line && nsString::IsSpace( *p ); p-- ) {
for ( p = s - 1; p > line && nsCRT::IsAsciiSpace( *p ); p-- ) {
*p = '\0';
}
*s++ = '\0';

Просмотреть файл

@ -508,7 +508,7 @@ nsresult nsMsgSearchTerm::ParseValue(char *inStream)
if (IS_STRING_ATTRIBUTE(m_attribute))
{
PRBool quoteVal = PR_FALSE;
while (nsString::IsSpace(*inStream))
while (nsCRT::IsAsciiSpace(*inStream))
inStream++;
// need to remove pair of '"', if present
if (*inStream == '"')
@ -564,7 +564,7 @@ nsMsgSearchTerm::ParseOperator(char *inStream, nsMsgSearchOpValue *value)
{
NS_ENSURE_ARG_POINTER(value);
PRInt16 operatorVal;
while (nsString::IsSpace(*inStream))
while (nsCRT::IsAsciiSpace(*inStream))
inStream++;
char *commaSep = PL_strchr(inStream, ',');
@ -581,7 +581,7 @@ nsMsgSearchTerm::ParseOperator(char *inStream, nsMsgSearchOpValue *value)
nsresult
nsMsgSearchTerm::ParseAttribute(char *inStream, nsMsgSearchAttribValue *attrib)
{
while (nsString::IsSpace(*inStream))
while (nsCRT::IsAsciiSpace(*inStream))
inStream++;
// if we are dealing with an arbitrary header, it may be quoted....
@ -731,12 +731,12 @@ nsresult nsMsgSearchTerm::MatchArbitraryHeader (nsIMsgSearchScopeTerm *scope,
headerValue++;
// strip leading white space
while (headerValue < buf_end && nsString::IsSpace(*headerValue))
while (headerValue < buf_end && nsCRT::IsAsciiSpace(*headerValue))
headerValue++; // advance to next character
// strip trailing white space
char * end = buf_end - 1;
while (end > headerValue && nsString::IsSpace(*end)) // while we haven't gone back past the start and we are white space....
while (end > headerValue && nsCRT::IsAsciiSpace(*end)) // while we haven't gone back past the start and we are white space....
{
*end = '\0'; // eat up the white space
end--; // move back and examine the previous character....

Просмотреть файл

@ -267,26 +267,6 @@ class nsTString_CharT : public nsTSubstring_CharT
}
/**
* Determine if given buffer is plain ascii
*
* @param aBuffer -- if null, then we test *this, otherwise we test given buffer
* @return TRUE if is all ascii chars or if strlen==0
*/
NS_COM PRBool IsASCII(const PRUnichar* aBuffer=0);
/**
* Determine if given char is a valid space character
*
* @param aChar is character to be tested
* @return TRUE if is valid space char
*/
NS_COM static PRBool IsSpace(PRUnichar ch);
/**
* Copies data from internal buffer onto given char* buffer
*

Просмотреть файл

@ -1110,25 +1110,6 @@ nsString::EqualsWithConversion( const char* aString, PRBool aIgnoreCase, PRInt32
return CompareWithConversion(aString, aIgnoreCase, aCount) == 0;
}
PRBool
nsString::IsASCII( const PRUnichar* aBuffer )
{
// XXX nsDependentString will compute the length of aBuffer and that is
// something we could potentially optimize away, but there probably isn't
// much point to doing so since this function is obsolete.
return ::IsASCII(aBuffer ?
NS_STATIC_CAST(const self_type&, nsDependentString(aBuffer)) : *this);
}
PRBool
nsString::IsSpace( PRUnichar c )
{
// XXX i18n
return (c == ' ') || (c == '\r') || (c == '\n') || (c == '\t');
}
/**
* ToCString, ToFloat, ToInteger
*/