]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Rename some internal functions as other related functions.
authorMichihiro NAKAJIMA <ggcueroad@gmail.com>
Fri, 16 Mar 2012 07:08:26 +0000 (16:08 +0900)
committerMichihiro NAKAJIMA <ggcueroad@gmail.com>
Sat, 17 Mar 2012 06:28:51 +0000 (15:28 +0900)
  archive_strcpy_in_locale ==> archive_strcpy_l
  archive_strncpy_in_locale ==> archive_strncpy_l
  archive_strncat_in_locale ==> archive_strncat_l

libarchive/archive_string.c
libarchive/archive_string.h
libarchive/archive_write_set_format_iso9660.c
libarchive/archive_write_set_format_pax.c
libarchive/test/test_archive_string_conversion.c

index 93e29c006f7722cc6d783d22c87335c28fd92500..2728a376c6696606148e342caa4c9632e0cff47e 100644 (file)
@@ -1879,8 +1879,8 @@ archive_string_conversion_set_opt(struct archive_string_conv *sc, int opt)
  *
  * Copy one archive_string to another in locale conversion.
  *
- *     archive_strncpy_in_locale();
- *     archive_strcpy_in_locale();
+ *     archive_strncat_l();
+ *     archive_strncpy_l();
  *
  */
 
@@ -1926,15 +1926,15 @@ utf16nbytes(const void *_p, size_t n)
 }
 
 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;
@@ -3887,7 +3887,7 @@ archive_mstring_get_utf8(struct archive *a, struct archive_mstring *aes,
                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);
@@ -4016,7 +4016,7 @@ archive_mstring_get_mbs_l(struct archive_mstring *aes,
                                *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)
@@ -4117,7 +4117,7 @@ archive_mstring_copy_mbs_len_l(struct archive_mstring *aes,
                 * 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;
@@ -4149,7 +4149,7 @@ archive_mstring_copy_mbs_len_l(struct archive_mstring *aes,
                        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
@@ -4193,7 +4193,7 @@ archive_mstring_update_utf8(struct archive *a, struct archive_mstring *aes,
        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)
index a5c0436fc4ab57394e703a815ded748e953a5d66..23f49165749c01be99e005ebc4c6b026bc848b9d 100644 (file)
@@ -117,13 +117,13 @@ archive_string_conversion_set_opt(struct archive_string_conv *, int);
 /* 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 *);
 
 
@@ -164,8 +164,8 @@ archive_wstrcat(struct archive_wstring *, const wchar_t *);
        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) \
index 3277803e6865c5f1f4e9891d7d0376ab3c6c8331..483de90865890a97e7d62559bc8e5895ddc3a2c7 100644 (file)
@@ -2244,7 +2244,7 @@ set_str_utf16be(struct archive_write *a, unsigned char *p, const char *s,
                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");
@@ -6274,7 +6274,7 @@ isoent_gen_joliet_identifier(struct archive_write *a, struct isoent *isoent,
                 * 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) {
index dec6bc3630949b1ceae0120116935ae808a0e9db..3b0f4ae294da0619031be0352959ed0c0642729a 100644 (file)
@@ -334,8 +334,7 @@ archive_write_pax_header_xattrs(struct archive_write *a,
                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)
index 3d217a10f996dcfbaa11f04b3fe133478d770219..1fc116818fa1e6167c47f4504adf4ff73adcd19b 100644 (file)
@@ -380,7 +380,7 @@ test_archive_string_normalization(int mac_nfd)
                        /*
                         * 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"
@@ -396,7 +396,7 @@ test_archive_string_normalization(int mac_nfd)
                        /*
                         * 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);
@@ -405,7 +405,7 @@ test_archive_string_normalization(int mac_nfd)
                        /*
                         * 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);
@@ -414,7 +414,7 @@ test_archive_string_normalization(int mac_nfd)
                        /*
                         * 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"
@@ -429,7 +429,7 @@ test_archive_string_normalization(int mac_nfd)
                        /*
                         * 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"
@@ -445,7 +445,7 @@ test_archive_string_normalization(int mac_nfd)
                        /*
                         * 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);
@@ -454,7 +454,7 @@ test_archive_string_normalization(int mac_nfd)
                        /*
                         * 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);
@@ -463,7 +463,7 @@ test_archive_string_normalization(int mac_nfd)
                        /*
                         * 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);
@@ -472,7 +472,7 @@ test_archive_string_normalization(int mac_nfd)
                        /*
                         * 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);
@@ -481,7 +481,7 @@ test_archive_string_normalization(int mac_nfd)
                        /*
                         * 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);