Added an assertion in |copy_string|. Changed some comments.

This commit is contained in:
scc%netscape.com 2000-05-12 05:16:00 +00:00
Родитель 4332726ebb
Коммит cfa6bc6d60
3 изменённых файлов: 24 добавлений и 12 удалений

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

@ -17,15 +17,15 @@
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Original Author:
* Scott Collins <scc@mozilla.org>
*
* Contributor(s):
* Scott Collins <scc@netscape.com>
*/
#ifndef _nsAReadableString_h__
#define _nsAReadableString_h__
// WORK IN PROGRESS
#ifndef nscore_h___
#include "nscore.h"
// for |PRUnichar|
@ -1026,7 +1026,11 @@ copy_string( InputIterator first, InputIterator last, OutputIterator result )
typedef nsCharSinkTraits<OutputIterator> sink_traits;
while ( first != last )
first += PRInt32(sink_traits::write(result, source_traits::read(first), source_traits::readable_size(first, last)));
{
PRInt32 count_copied = PRInt32(sink_traits::write(result, source_traits::read(first), source_traits::readable_size(first, last)));
NS_ASSERTION(count_copied > 0, "|copy_string| will never terminate");
first += count_copied;
}
return result;
}

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

@ -17,15 +17,15 @@
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Original Author:
* Scott Collins <scc@mozilla.org>
*
* Contributor(s):
* Scott Collins <scc@netscape.com>
*/
#ifndef _nsAReadableString_h__
#define _nsAReadableString_h__
// WORK IN PROGRESS
#ifndef nscore_h___
#include "nscore.h"
// for |PRUnichar|
@ -1026,7 +1026,11 @@ copy_string( InputIterator first, InputIterator last, OutputIterator result )
typedef nsCharSinkTraits<OutputIterator> sink_traits;
while ( first != last )
first += PRInt32(sink_traits::write(result, source_traits::read(first), source_traits::readable_size(first, last)));
{
PRInt32 count_copied = PRInt32(sink_traits::write(result, source_traits::read(first), source_traits::readable_size(first, last)));
NS_ASSERTION(count_copied > 0, "|copy_string| will never terminate");
first += count_copied;
}
return result;
}

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

@ -17,15 +17,15 @@
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Original Author:
* Scott Collins <scc@mozilla.org>
*
* Contributor(s):
* Scott Collins <scc@netscape.com>
*/
#ifndef _nsAReadableString_h__
#define _nsAReadableString_h__
// WORK IN PROGRESS
#ifndef nscore_h___
#include "nscore.h"
// for |PRUnichar|
@ -1026,7 +1026,11 @@ copy_string( InputIterator first, InputIterator last, OutputIterator result )
typedef nsCharSinkTraits<OutputIterator> sink_traits;
while ( first != last )
first += PRInt32(sink_traits::write(result, source_traits::read(first), source_traits::readable_size(first, last)));
{
PRInt32 count_copied = PRInt32(sink_traits::write(result, source_traits::read(first), source_traits::readable_size(first, last)));
NS_ASSERTION(count_copied > 0, "|copy_string| will never terminate");
first += count_copied;
}
return result;
}