corrected string usage errors and removed warning

This commit is contained in:
rickg%netscape.com 1999-08-29 17:35:19 +00:00
Родитель 94d63a5d92
Коммит 3e1c22acb7
8 изменённых файлов: 28 добавлений и 22 удалений

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

@ -216,7 +216,7 @@ PRBool CDTDDebug::DebugRecord(char * path, nsString& aURLRef, char * filename)
// where the vector contains the verification path and
// the filename contains the debug source dump
char buffer[513];
aURLRef.ToCString(buffer,sizeof(buffer)-1);
aURLRef.ToCString(buffer,sizeof(buffer));
sprintf(string,"%s %s %s\r\n", buffer, path, filename);
// get the file size, read in the file and parse it line at

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

@ -256,7 +256,7 @@ nsresult CStartToken::Consume(PRUnichar aChar, nsScanner& aScanner) {
*/
void CStartToken::DebugDumpSource(ostream& out) {
char buffer[1000];
mTextValue.ToCString(buffer,sizeof(buffer)-1);
mTextValue.ToCString(buffer,sizeof(buffer));
out << "<" << buffer;
if(!mAttributed)
out << ">";
@ -382,7 +382,7 @@ PRInt32 CEndToken::GetTokenType(void) {
*/
void CEndToken::DebugDumpSource(ostream& out) {
char buffer[1000];
mTextValue.ToCString(buffer,sizeof(buffer)-1);
mTextValue.ToCString(buffer,sizeof(buffer));
out << "</" << buffer << ">";
}
@ -1103,9 +1103,9 @@ void CAttributeToken::SanitizeKey() {
*/
void CAttributeToken::DebugDumpToken(ostream& out) {
char buffer[200];
mTextKey.ToCString(buffer,sizeof(buffer)-1);
mTextKey.ToCString(buffer,sizeof(buffer));
out << "[" << GetClassName() << "] " << buffer << "=";
mTextValue.ToCString(buffer,sizeof(buffer)-1);
mTextValue.ToCString(buffer,sizeof(buffer));
out << buffer << ": " << mTypeID << endl;
}
@ -1305,10 +1305,10 @@ nsresult CAttributeToken::Consume(PRUnichar aChar, nsScanner& aScanner) {
*/
void CAttributeToken::DebugDumpSource(ostream& out) {
static char buffer[1000];
mTextKey.ToCString(buffer,sizeof(buffer)-1);
mTextKey.ToCString(buffer,sizeof(buffer));
out << " " << buffer;
if(mTextValue.Length()){
mTextValue.ToCString(buffer,sizeof(buffer)-1);
mTextValue.ToCString(buffer,sizeof(buffer));
out << "=" << buffer;
}
if(mLastAttribute)
@ -1789,7 +1789,7 @@ nsresult CSkippedContentToken::Consume(PRUnichar aChar,nsScanner& aScanner) {
*/
void CSkippedContentToken::DebugDumpSource(ostream& out) {
static char buffer[1000];
mTextKey.ToCString(buffer,sizeof(buffer)-1);
mTextKey.ToCString(buffer,sizeof(buffer));
out << " " << buffer;
if(mLastAttribute)
out<<">";

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

@ -1177,13 +1177,15 @@ nsresult nsParser::OnStopRequest(nsIChannel* channel, nsISupports* aContext,
nsresult nsParser::OnStopRequest(nsIURI* aURL, nsresult status, const PRUnichar* aMsg)
#endif
{
nsresult result=NS_OK;
if(eOnStart==mParserContext->mStreamListenerState) {
//If you're here, then OnDataAvailable() never got called.
//Prior to necko, we never dealt with this case, but the problem may have existed.
//What we'll do (for now at least) is construct the worlds smallest HTML document.
nsAutoString temp("<BODY></BODY>");
mParserContext->mScanner->Append(temp);
nsresult result=ResumeParse(nsnull, PR_TRUE);
result=ResumeParse(nsnull, PR_TRUE);
}
mParserContext->mStreamListenerState=eOnStop;
@ -1193,7 +1195,7 @@ nsresult nsParser::OnStopRequest(nsIURI* aURL, nsresult status, const PRUnichar*
mParserFilter->Finish();
mParserContext->mScanner->SetIncremental(PR_FALSE);
nsresult result=ResumeParse(nsnull, PR_TRUE);
result=ResumeParse(nsnull, PR_TRUE);
// If the parser isn't enabled, we don't finish parsing till
// it is reenabled.

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

@ -139,7 +139,8 @@ void CToken::DebugDumpToken(ostream& anOutputStream) {
*/
void CToken::DebugDumpSource(ostream& anOutputStream) {
char buf[256];
anOutputStream << mTextValue.ToCString(buf,256);
mTextValue.ToCString(buf,sizeof(buf));
anOutputStream << buf;
}
/**

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

@ -216,7 +216,7 @@ PRBool CDTDDebug::DebugRecord(char * path, nsString& aURLRef, char * filename)
// where the vector contains the verification path and
// the filename contains the debug source dump
char buffer[513];
aURLRef.ToCString(buffer,sizeof(buffer)-1);
aURLRef.ToCString(buffer,sizeof(buffer));
sprintf(string,"%s %s %s\r\n", buffer, path, filename);
// get the file size, read in the file and parse it line at

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

@ -256,7 +256,7 @@ nsresult CStartToken::Consume(PRUnichar aChar, nsScanner& aScanner) {
*/
void CStartToken::DebugDumpSource(ostream& out) {
char buffer[1000];
mTextValue.ToCString(buffer,sizeof(buffer)-1);
mTextValue.ToCString(buffer,sizeof(buffer));
out << "<" << buffer;
if(!mAttributed)
out << ">";
@ -382,7 +382,7 @@ PRInt32 CEndToken::GetTokenType(void) {
*/
void CEndToken::DebugDumpSource(ostream& out) {
char buffer[1000];
mTextValue.ToCString(buffer,sizeof(buffer)-1);
mTextValue.ToCString(buffer,sizeof(buffer));
out << "</" << buffer << ">";
}
@ -1103,9 +1103,9 @@ void CAttributeToken::SanitizeKey() {
*/
void CAttributeToken::DebugDumpToken(ostream& out) {
char buffer[200];
mTextKey.ToCString(buffer,sizeof(buffer)-1);
mTextKey.ToCString(buffer,sizeof(buffer));
out << "[" << GetClassName() << "] " << buffer << "=";
mTextValue.ToCString(buffer,sizeof(buffer)-1);
mTextValue.ToCString(buffer,sizeof(buffer));
out << buffer << ": " << mTypeID << endl;
}
@ -1305,10 +1305,10 @@ nsresult CAttributeToken::Consume(PRUnichar aChar, nsScanner& aScanner) {
*/
void CAttributeToken::DebugDumpSource(ostream& out) {
static char buffer[1000];
mTextKey.ToCString(buffer,sizeof(buffer)-1);
mTextKey.ToCString(buffer,sizeof(buffer));
out << " " << buffer;
if(mTextValue.Length()){
mTextValue.ToCString(buffer,sizeof(buffer)-1);
mTextValue.ToCString(buffer,sizeof(buffer));
out << "=" << buffer;
}
if(mLastAttribute)
@ -1789,7 +1789,7 @@ nsresult CSkippedContentToken::Consume(PRUnichar aChar,nsScanner& aScanner) {
*/
void CSkippedContentToken::DebugDumpSource(ostream& out) {
static char buffer[1000];
mTextKey.ToCString(buffer,sizeof(buffer)-1);
mTextKey.ToCString(buffer,sizeof(buffer));
out << " " << buffer;
if(mLastAttribute)
out<<">";

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

@ -1177,13 +1177,15 @@ nsresult nsParser::OnStopRequest(nsIChannel* channel, nsISupports* aContext,
nsresult nsParser::OnStopRequest(nsIURI* aURL, nsresult status, const PRUnichar* aMsg)
#endif
{
nsresult result=NS_OK;
if(eOnStart==mParserContext->mStreamListenerState) {
//If you're here, then OnDataAvailable() never got called.
//Prior to necko, we never dealt with this case, but the problem may have existed.
//What we'll do (for now at least) is construct the worlds smallest HTML document.
nsAutoString temp("<BODY></BODY>");
mParserContext->mScanner->Append(temp);
nsresult result=ResumeParse(nsnull, PR_TRUE);
result=ResumeParse(nsnull, PR_TRUE);
}
mParserContext->mStreamListenerState=eOnStop;
@ -1193,7 +1195,7 @@ nsresult nsParser::OnStopRequest(nsIURI* aURL, nsresult status, const PRUnichar*
mParserFilter->Finish();
mParserContext->mScanner->SetIncremental(PR_FALSE);
nsresult result=ResumeParse(nsnull, PR_TRUE);
result=ResumeParse(nsnull, PR_TRUE);
// If the parser isn't enabled, we don't finish parsing till
// it is reenabled.

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

@ -139,7 +139,8 @@ void CToken::DebugDumpToken(ostream& anOutputStream) {
*/
void CToken::DebugDumpSource(ostream& anOutputStream) {
char buf[256];
anOutputStream << mTextValue.ToCString(buf,256);
mTextValue.ToCString(buf,sizeof(buf));
anOutputStream << buf;
}
/**