Changeset ac31040 in mainline for uspace/srv/fs/udf/udf_osta.c
- Timestamp:
- 2012-09-04T19:48:22Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 78ca12b
- Parents:
- 85f7369 (diff), 8ec4144 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/fs/udf/udf_osta.c
r85f7369 rac31040 96 96 * 97 97 */ 98 s ize_t udf_uncompress_unicode(size_t number_of_bytes, uint8_t *udf_compressed,99 uint 16_t *unicode, size_t unicode_max_len)98 static size_t udf_uncompress_unicode(size_t number_of_bytes, 99 uint8_t *udf_compressed, uint16_t *unicode, size_t unicode_max_len) 100 100 { 101 101 /* Use udf_compressed to store current byte being read. */ … … 129 129 130 130 return unicode_idx; 131 }132 133 /** Convert Unicode wide characters to OSTA CS0 compressed Unicode string.134 *135 * The Unicode MUST be in the byte order of the compiler in order136 * to obtain correct results. Returns an error if the compression ID137 * is invalid.138 *139 * NOTE: This routine assumes the implementation already knows,140 * by the local environment, how many bits are appropriate and therefore141 * does no checking to test if the input characters fit into that number142 * of bits or not.143 *144 * @param[in] number_of_chars Number of unicode characters.145 * @param[in] comp_id Compression ID to be used.146 * @param[in] unicode Unicode characters to compress.147 * @param[out] udf_compressed Compressed string, as bytes.148 *149 * @return The total number of bytes in the compressed OSTA CS0 string,150 * including the compression ID.151 *152 */153 size_t udf_compress_unicode(size_t number_of_chars, uint8_t comp_id,154 uint16_t *unicode, uint8_t *udf_compressed)155 {156 if ((comp_id != 8) && (comp_id != 16))157 return 0;158 159 /* Place compression code in first byte. */160 udf_compressed[0] = comp_id;161 162 size_t byte_idx = 1;163 size_t unicode_idx = 0;164 165 while (unicode_idx < number_of_chars) {166 if (comp_id == 16) {167 /*168 * First, place the high bits of the char169 * into the byte stream.170 */171 udf_compressed[byte_idx++] =172 (unicode[unicode_idx] & 0xFF00) >> 8;173 }174 175 /* Then place the low bits into the stream. */176 udf_compressed[byte_idx++] = unicode[unicode_idx] & 0x00FF;177 unicode_idx++;178 }179 180 return byte_idx;181 131 } 182 132
Note:
See TracChangeset
for help on using the changeset viewer.