lib/icu/Util: use class AllocatedArray

This commit is contained in:
Max Kellermann
2016-04-12 21:32:02 +02:00
parent 60f32d0bce
commit 33a4dbe1e5
4 changed files with 19 additions and 27 deletions

View File

@@ -23,7 +23,7 @@
#include "util/Error.hxx"
#include "util/Macros.hxx"
#include "util/AllocatedString.hxx"
#include "util/WritableBuffer.hxx"
#include "util/AllocatedArray.hxx"
#include "util/ConstBuffer.hxx"
#include <string.h>
@@ -142,13 +142,12 @@ IcuConverter::FromUTF8(const char *s) const
// TODO: dynamic buffer?
char buffer[4096], *target = buffer;
const UChar *source = u.data;
const UChar *source = u.begin();
UErrorCode code = U_ZERO_ERROR;
ucnv_fromUnicode(converter, &target, buffer + ARRAY_SIZE(buffer),
&source, u.end(),
nullptr, true, &code);
delete[] u.data;
if (code != U_ZERO_ERROR)
return nullptr;