PRBool forced = (mask & esc_Forced); PRBool ignoreNonAscii = (mask & esc_OnlyASCII); PRBool ignoreAscii = (mask & esc_OnlyNonASCII); PRBool writing = (mask & esc_AlwaysCopy); PRBool colon = (mask & esc_Colon);
PRBool forced = (flags & esc_Forced); PRBool ignoreNonAscii = (flags & esc_OnlyASCII); PRBool ignoreAscii = (flags & esc_OnlyNonASCII); PRBool writing = (flags & esc_AlwaysCopy); PRBool colon = (flags & esc_Colon);
NS_COM PRBool NS_EscapeURL(const char *part,                           PRInt32 partLen,                           PRInt16 mask,                           nsACString &result){    if (!part) {        NS_NOTREACHED("null pointer");        return PR_FALSE;    }    int i = 0;    static const char hexChars[] = "0123456789ABCDEF";    if (partLen < 0)        partLen = strlen(part);    PRBool forced = (mask & esc_Forced);    PRBool ignoreNonAscii = (mask & esc_OnlyASCII);    PRBool ignoreAscii = (mask & esc_OnlyNonASCII);    PRBool writing = (mask & esc_AlwaysCopy);    PRBool colon = (mask & esc_Colon);    register const unsigned char* src = (const unsigned char *) part;    char tempBuffer[100];    unsigned int tempBufferPos = 0;    for (i = 0; i < partLen; i++)    {      unsigned char c = *src++;      // if the char has not to be escaped or whatever follows % is       // a valid escaped string, just copy the char.      //      // Also the % will not be escaped until forced      // See bugzilla bug 61269 for details why we changed this      //      // And, we will not escape non-ascii characters if requested.      // On special request we will also escape the colon even when      // not covered by the matrix.      // ignoreAscii is not honored for control characters (C0 and DEL)      if ((NO_NEED_ESC(c) || (c == HEX_ESCAPE && !forced)                          || (c > 0x7f && ignoreNonAscii)                          || (c > 0x1f && c < 0x7f && ignoreAscii))          && !(c == ':' && colon))      {        if (writing)          tempBuffer[tempBufferPos++] = c;      }      else /* do the escape magic */      {        if (!writing)        {          result.Append(part, i);          writing = PR_TRUE;        }        tempBuffer[tempBufferPos++] = HEX_ESCAPE;        tempBuffer[tempBufferPos++] = hexChars[c >> 4];	/* high nibble */        tempBuffer[tempBufferPos++] = hexChars[c & 0x0f]; /* low nibble */      } 	        if (tempBufferPos >= sizeof(tempBuffer) - 4) 	  {        NS_ASSERTION(writing, "should be writing");        tempBuffer[tempBufferPos] = '\0';        result += tempBuffer;        tempBufferPos = 0; 	  }	}    if (writing) {      tempBuffer[tempBufferPos] = '\0';      result += tempBuffer;    }    return writing;}