*
* Copy one archive_string to another in locale conversion.
*
- * archive_strncpy_in_locale();
- * archive_strcpy_in_locale();
+ * archive_strncat_l();
+ * archive_strncpy_l();
*
*/
}
int
-archive_strncpy_in_locale(struct archive_string *as, const void *_p, size_t n,
+archive_strncpy_l(struct archive_string *as, const void *_p, size_t n,
struct archive_string_conv *sc)
{
as->length = 0;
- return (archive_strncat_in_locale(as, _p, n, sc));
+ return (archive_strncat_l(as, _p, n, sc));
}
int
-archive_strncat_in_locale(struct archive_string *as, const void *_p, size_t n,
+archive_strncat_l(struct archive_string *as, const void *_p, size_t n,
struct archive_string_conv *sc)
{
const void *s;
sc = archive_string_conversion_to_charset(a, "UTF-8", 1);
if (sc == NULL)
return (-1);/* Couldn't allocate memory for sc. */
- r = archive_strncpy_in_locale(&(aes->aes_mbs), aes->aes_mbs.s,
+ r = archive_strncpy_l(&(aes->aes_mbs), aes->aes_mbs.s,
aes->aes_mbs.length, sc);
if (a == NULL)
free_sconv_object(sc);
*length = aes->aes_mbs.length;
return (0);
}
- ret = archive_strncpy_in_locale(&(aes->aes_mbs_in_locale),
+ ret = archive_strncpy_l(&(aes->aes_mbs_in_locale),
aes->aes_mbs.s, aes->aes_mbs.length, sc);
*p = aes->aes_mbs_in_locale.s;
if (length != NULL)
* Translate multi-bytes from some character-set to UTF-8.
*/
sc->cd = sc->cd_w;
- r = archive_strncpy_in_locale(&(aes->aes_utf8), mbs, len, sc);
+ r = archive_strncpy_l(&(aes->aes_utf8), mbs, len, sc);
sc->cd = cd;
if (r != 0) {
aes->aes_set = 0;
aes->aes_set = 0;
}
#else
- r = archive_strncpy_in_locale(&(aes->aes_mbs), mbs, len, sc);
+ r = archive_strncpy_l(&(aes->aes_mbs), mbs, len, sc);
if (r == 0)
aes->aes_set = AES_SET_MBS; /* Only MBS form is set now. */
else
sc = archive_string_conversion_from_charset(a, "UTF-8", 1);
if (sc == NULL)
return (-1);/* Couldn't allocate memory for sc. */
- r = archive_strcpy_in_locale(&(aes->aes_mbs), utf8, sc);
+ r = archive_strcpy_l(&(aes->aes_mbs), utf8, sc);
if (a == NULL)
free_sconv_object(sc);
if (r != 0)
/* Copy one archive_string to another in locale conversion.
* Return -1 if conversion failes. */
int
-archive_strncpy_in_locale(struct archive_string *, const void *, size_t,
+archive_strncpy_l(struct archive_string *, const void *, size_t,
struct archive_string_conv *);
/* Copy one archive_string to another in locale conversion.
* Return -1 if conversion failes. */
int
-archive_strncat_in_locale(struct archive_string *, const void *, size_t,
+archive_strncat_l(struct archive_string *, const void *, size_t,
struct archive_string_conv *);
archive_strncpy((as), (p), ((p) == NULL ? 0 : strlen(p)))
#define archive_wstrcpy(as,p) \
archive_wstrncpy((as), (p), ((p) == NULL ? 0 : wcslen(p)))
-#define archive_strcpy_in_locale(as,p,lo) \
- archive_strncpy_in_locale((as), (p), ((p) == NULL ? 0 : strlen(p)), (lo))
+#define archive_strcpy_l(as,p,lo) \
+ archive_strncpy_l((as), (p), ((p) == NULL ? 0 : strlen(p)), (lo))
/* Copy a C string to an archive_string with limit, resizing as necessary. */
#define archive_strncpy(as,p,l) \
onepad = 0;
if (vdc == VDC_UCS2) {
struct iso9660 *iso9660 = a->format_data;
- if (archive_strncpy_in_locale(&iso9660->utf16be, s, strlen(s),
+ if (archive_strncpy_l(&iso9660->utf16be, s, strlen(s),
iso9660->sconv_to_utf16be) != 0 && errno == ENOMEM) {
archive_set_error(&a->archive, ENOMEM,
"Can't allocate memory for UTF-16BE");
* Get a length of MBS of a full-pathname.
*/
if ((int)np->file->basename_utf16.length > ffmax) {
- if (archive_strncpy_in_locale(&iso9660->mbs,
+ if (archive_strncpy_l(&iso9660->mbs,
(const char *)np->identifier, l,
iso9660->sconv_from_utf16be) != 0 &&
errno == ENOMEM) {
url_encoded_name = url_encode(name);
if (url_encoded_name != NULL) {
/* Convert narrow-character to UTF-8. */
- r = archive_strcpy_in_locale(
- &(pax->l_url_encoded_name),
+ r = archive_strcpy_l(&(pax->l_url_encoded_name),
url_encoded_name, pax->sconv_utf8);
free(url_encoded_name); /* Done with this. */
if (r == 0)
/*
* Normalize an NFC string for import.
*/
- assertEqualInt(0, archive_strcpy_in_locale(
+ assertEqualInt(0, archive_strcpy_l(
&utf8, utf8_nfc, f_sconv8));
if (should_be_nfc) {
failure("NFC(%s) should not be converted to"
/*
* Normalize an NFD string for import.
*/
- assertEqualInt(0, archive_strcpy_in_locale(
+ assertEqualInt(0, archive_strcpy_l(
&utf8, utf8_nfd, f_sconv8));
failure("NFD(%s) should not be any changed:%d",
nfd, line);
/*
* Copy an NFD string for export.
*/
- assertEqualInt(0, archive_strcpy_in_locale(
+ assertEqualInt(0, archive_strcpy_l(
&utf8, utf8_nfd, t_sconv8));
failure("NFD(%s) should not be any changed:%d",
nfd, line);
/*
* Normalize an NFC string in UTF-16BE for import.
*/
- assertEqualInt(0, archive_strncpy_in_locale(
+ assertEqualInt(0, archive_strncpy_l(
&utf8, utf16be_nfc, 100000, f_sconv16be));
if (should_be_nfc) {
failure("NFC(%s) should not be converted to"
/*
* Normalize an NFC string in UTF-16LE for import.
*/
- assertEqualInt(0, archive_strncpy_in_locale(
+ assertEqualInt(0, archive_strncpy_l(
&utf8, utf16le_nfc, 100000, f_sconv16le));
if (should_be_nfc) {
failure("NFC(%s) should not be converted to"
/*
* Normalize an NFD string for import.
*/
- assertEqualInt(0, archive_strcpy_in_locale(
+ assertEqualInt(0, archive_strcpy_l(
&utf8, utf8_nfd, f_sconv8));
failure("NFD(%s) should be converted to NFC(%s):%d",
nfd, nfc, line);
/*
* Normalize an NFC string for import.
*/
- assertEqualInt(0, archive_strcpy_in_locale(
+ assertEqualInt(0, archive_strcpy_l(
&utf8, utf8_nfc, f_sconv8));
failure("NFC(%s) should not be any changed:%d",
nfc, line);
/*
* Copy an NFC string for export.
*/
- assertEqualInt(0, archive_strcpy_in_locale(
+ assertEqualInt(0, archive_strcpy_l(
&utf8, utf8_nfc, t_sconv8));
failure("NFC(%s) should not be any changed:%d",
nfc, line);
/*
* Normalize an NFD string in UTF-16BE for import.
*/
- assertEqualInt(0, archive_strncpy_in_locale(
+ assertEqualInt(0, archive_strncpy_l(
&utf8, utf16be_nfd, 100000, f_sconv16be));
failure("NFD(%s) should be converted to NFC(%s):%d",
nfd, nfc, line);
/*
* Normalize an NFD string in UTF-16LE for import.
*/
- assertEqualInt(0, archive_strncpy_in_locale(
+ assertEqualInt(0, archive_strncpy_l(
&utf8, utf16le_nfd, 100000, f_sconv16le));
failure("NFD(%s) should be converted to NFC(%s):%d",
nfd, nfc, line);