]> git.saurik.com Git - apple/xnu.git/blobdiff - bsd/vfs/vfs_utfconv.c
xnu-792.22.5.tar.gz
[apple/xnu.git] / bsd / vfs / vfs_utfconv.c
index 6651c4f38108b8d7dc4ae7bba8ac3648fc5d7a9c..7a363eb49c1c94cedce1f8df0198fe2a968a812e 100644 (file)
@@ -33,7 +33,7 @@
 #include <sys/param.h>
 #include <sys/utfconv.h>
 #include <sys/errno.h>
 #include <sys/param.h>
 #include <sys/utfconv.h>
 #include <sys/errno.h>
-#include <architecture/byte_order.h>
+#include <libkern/OSByteOrder.h>
 
 /*
  * UTF-8 (Unicode Transformation Format)
 
 /*
  * UTF-8 (Unicode Transformation Format)
@@ -181,7 +181,7 @@ utf8_encodelen(const u_int16_t * ucsp, size_t ucslen, u_int16_t altslash,
                ucs_ch = *ucsp++;
 
                if (swapbytes)
                ucs_ch = *ucsp++;
 
                if (swapbytes)
-                       ucs_ch = NXSwapShort(ucs_ch);
+                       ucs_ch = OSSwapInt16(ucs_ch);
                if (ucs_ch == '/')
                        ucs_ch = altslash ? altslash : '_';
                else if (ucs_ch == '\0')
                if (ucs_ch == '/')
                        ucs_ch = altslash ? altslash : '_';
                else if (ucs_ch == '\0')
@@ -238,7 +238,7 @@ utf8_encodestr(const u_int16_t * ucsp, size_t ucslen, u_int8_t * utf8p,
                        --extra;
                        ucs_ch = *chp++;
                } else {
                        --extra;
                        ucs_ch = *chp++;
                } else {
-                       ucs_ch = swapbytes ? NXSwapShort(*ucsp++) : *ucsp++;
+                       ucs_ch = swapbytes ? OSSwapInt16(*ucsp++) : *ucsp++;
 
                        if (decompose && unicode_decomposeable(ucs_ch)) {
                                extra = unicode_decompose(ucs_ch, sequence) - 1;
 
                        if (decompose && unicode_decomposeable(ucs_ch)) {
                                extra = unicode_decompose(ucs_ch, sequence) - 1;
@@ -282,7 +282,7 @@ utf8_encodestr(const u_int16_t * ucsp, size_t ucslen, u_int8_t * utf8p,
                                u_int16_t ch2;
                                u_int32_t pair;
 
                                u_int16_t ch2;
                                u_int32_t pair;
 
-                               ch2 = swapbytes ? NXSwapShort(*ucsp) : *ucsp;
+                               ch2 = swapbytes ? OSSwapInt16(*ucsp) : *ucsp;
                                if (ch2 >= SP_LOW_FIRST && ch2 <= SP_LOW_LAST) {
                                        pair = ((ucs_ch - SP_HIGH_FIRST) << SP_HALF_SHIFT)
                                                + (ch2 - SP_LOW_FIRST) + SP_HALF_BASE;
                                if (ch2 >= SP_LOW_FIRST && ch2 <= SP_LOW_LAST) {
                                        pair = ((ucs_ch - SP_HIGH_FIRST) << SP_HALF_SHIFT)
                                                + (ch2 - SP_LOW_FIRST) + SP_HALF_BASE;
@@ -420,13 +420,13 @@ utf8_decodestr(const u_int8_t* utf8p, size_t utf8len, u_int16_t* ucsp,
                                ucs_ch = (ch >> SP_HALF_SHIFT) + SP_HIGH_FIRST;
                                if (ucs_ch < SP_HIGH_FIRST || ucs_ch > SP_HIGH_LAST)
                                        goto invalid;
                                ucs_ch = (ch >> SP_HALF_SHIFT) + SP_HIGH_FIRST;
                                if (ucs_ch < SP_HIGH_FIRST || ucs_ch > SP_HIGH_LAST)
                                        goto invalid;
-                               *ucsp++ = swapbytes ? NXSwapShort(ucs_ch) : ucs_ch;
+                               *ucsp++ = swapbytes ? OSSwapInt16(ucs_ch) : ucs_ch;
                                if (ucsp >= bufend)
                                        goto toolong;
                                ucs_ch = (ch & SP_HALF_MASK) + SP_LOW_FIRST;
                                if (ucs_ch < SP_LOW_FIRST || ucs_ch > SP_LOW_LAST)
                                        goto invalid;
                                if (ucsp >= bufend)
                                        goto toolong;
                                ucs_ch = (ch & SP_HALF_MASK) + SP_LOW_FIRST;
                                if (ucs_ch < SP_LOW_FIRST || ucs_ch > SP_LOW_LAST)
                                        goto invalid;
-                               *ucsp++ = swapbytes ? NXSwapShort(ucs_ch) : ucs_ch;
+                               *ucsp++ = swapbytes ? OSSwapInt16(ucs_ch) : ucs_ch;
                                continue;
                        default:
                                goto invalid;
                                continue;
                        default:
                                goto invalid;
@@ -440,7 +440,7 @@ utf8_decodestr(const u_int8_t* utf8p, size_t utf8len, u_int16_t* ucsp,
 
                                        for (i = 0; i < count; ++i) {
                                                ucs_ch = sequence[i];
 
                                        for (i = 0; i < count; ++i) {
                                                ucs_ch = sequence[i];
-                                               *ucsp++ = swapbytes ? NXSwapShort(ucs_ch) : ucs_ch;
+                                               *ucsp++ = swapbytes ? OSSwapInt16(ucs_ch) : ucs_ch;
                                                if (ucsp >= bufend)
                                                        goto toolong;
                                        }
                                                if (ucsp >= bufend)
                                                        goto toolong;
                                        }
@@ -451,7 +451,7 @@ utf8_decodestr(const u_int8_t* utf8p, size_t utf8len, u_int16_t* ucsp,
                                u_int16_t composite, base;
 
                                if (unicode_combinable(ucs_ch)) {
                                u_int16_t composite, base;
 
                                if (unicode_combinable(ucs_ch)) {
-                                       base = swapbytes ? NXSwapShort(*(ucsp - 1)) : *(ucsp - 1);
+                                       base = swapbytes ? OSSwapInt16(*(ucsp - 1)) : *(ucsp - 1);
                                        composite = unicode_combine(base, ucs_ch);
                                        if (composite) {
                                                --ucsp;
                                        composite = unicode_combine(base, ucs_ch);
                                        if (composite) {
                                                --ucsp;
@@ -476,7 +476,7 @@ utf8_decodestr(const u_int8_t* utf8p, size_t utf8len, u_int16_t* ucsp,
                        }
                        combcharcnt = 0;  /* start over */
                }
                        }
                        combcharcnt = 0;  /* start over */
                }
-               *ucsp++ = swapbytes ? NXSwapShort(ucs_ch) : ucs_ch;
+               *ucsp++ = swapbytes ? OSSwapInt16(ucs_ch) : ucs_ch;
        }
        /*
         * Make a previous combining sequence canonical
        }
        /*
         * Make a previous combining sequence canonical