Changeset 5c702a8 in mainline for uspace/srv/fs/udf/udf_osta.c


Ignore:
Timestamp:
2012-08-27T17:21:38Z (12 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
0d57c3e
Parents:
5d94b16c
Message:

dead and unfinished code elimination

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/fs/udf/udf_osta.c

    r5d94b16c r5c702a8  
    9696 *
    9797 */
    98 size_t udf_uncompress_unicode(size_t number_of_bytes, uint8_t *udf_compressed,
    99     uint16_t *unicode, size_t unicode_max_len)
     98static size_t udf_uncompress_unicode(size_t number_of_bytes,
     99    uint8_t *udf_compressed, uint16_t *unicode, size_t unicode_max_len)
    100100{
    101101        /* Use udf_compressed to store current byte being read. */
     
    129129       
    130130        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 order
    136  * to obtain correct results. Returns an error if the compression ID
    137  * is invalid.
    138  *
    139  * NOTE: This routine assumes the implementation already knows,
    140  * by the local environment, how many bits are appropriate and therefore
    141  * does no checking to test if the input characters fit into that number
    142  * 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 char
    169                          * 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;
    181131}
    182132
Note: See TracChangeset for help on using the changeset viewer.