diff options
| author | Cyrill Gorcunov <gorcunov@gmail.com> | 2007-07-21 07:37:18 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-21 20:49:14 -0400 |
| commit | 28de7948a896763bc97ccd416bba5b9422158350 (patch) | |
| tree | abee128b137a6fa9fa4104b7bbc4ee409467c38f /fs/udf/unicode.c | |
| parent | 71133027febfabd501fde7583b30008224f4d799 (diff) | |
UDF: coding style conversion - lindent fixups
This patch fixes up sources after conversion by Lindent.
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: Jan Kara <jack@ucw.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/udf/unicode.c')
| -rw-r--r-- | fs/udf/unicode.c | 155 |
1 files changed, 73 insertions, 82 deletions
diff --git a/fs/udf/unicode.c b/fs/udf/unicode.c index 46835240275c..9e6099c26c27 100644 --- a/fs/udf/unicode.c +++ b/fs/udf/unicode.c | |||
| @@ -29,21 +29,23 @@ | |||
| 29 | 29 | ||
| 30 | static int udf_translate_to_linux(uint8_t *, uint8_t *, int, uint8_t *, int); | 30 | static int udf_translate_to_linux(uint8_t *, uint8_t *, int, uint8_t *, int); |
| 31 | 31 | ||
| 32 | static int udf_char_to_ustr(struct ustr *dest, const uint8_t * src, int strlen) | 32 | static int udf_char_to_ustr(struct ustr *dest, const uint8_t *src, int strlen) |
| 33 | { | 33 | { |
| 34 | if ((!dest) || (!src) || (!strlen) || (strlen > UDF_NAME_LEN - 2)) | 34 | if ((!dest) || (!src) || (!strlen) || (strlen > UDF_NAME_LEN - 2)) |
| 35 | return 0; | 35 | return 0; |
| 36 | |||
| 36 | memset(dest, 0, sizeof(struct ustr)); | 37 | memset(dest, 0, sizeof(struct ustr)); |
| 37 | memcpy(dest->u_name, src, strlen); | 38 | memcpy(dest->u_name, src, strlen); |
| 38 | dest->u_cmpID = 0x08; | 39 | dest->u_cmpID = 0x08; |
| 39 | dest->u_len = strlen; | 40 | dest->u_len = strlen; |
| 41 | |||
| 40 | return strlen; | 42 | return strlen; |
| 41 | } | 43 | } |
| 42 | 44 | ||
| 43 | /* | 45 | /* |
| 44 | * udf_build_ustr | 46 | * udf_build_ustr |
| 45 | */ | 47 | */ |
| 46 | int udf_build_ustr(struct ustr *dest, dstring * ptr, int size) | 48 | int udf_build_ustr(struct ustr *dest, dstring *ptr, int size) |
| 47 | { | 49 | { |
| 48 | int usesize; | 50 | int usesize; |
| 49 | 51 | ||
| @@ -55,13 +57,14 @@ int udf_build_ustr(struct ustr *dest, dstring * ptr, int size) | |||
| 55 | dest->u_cmpID = ptr[0]; | 57 | dest->u_cmpID = ptr[0]; |
| 56 | dest->u_len = ptr[size - 1]; | 58 | dest->u_len = ptr[size - 1]; |
| 57 | memcpy(dest->u_name, ptr + 1, usesize - 1); | 59 | memcpy(dest->u_name, ptr + 1, usesize - 1); |
| 60 | |||
| 58 | return 0; | 61 | return 0; |
| 59 | } | 62 | } |
| 60 | 63 | ||
| 61 | /* | 64 | /* |
| 62 | * udf_build_ustr_exact | 65 | * udf_build_ustr_exact |
| 63 | */ | 66 | */ |
| 64 | static int udf_build_ustr_exact(struct ustr *dest, dstring * ptr, int exactsize) | 67 | static int udf_build_ustr_exact(struct ustr *dest, dstring *ptr, int exactsize) |
| 65 | { | 68 | { |
| 66 | if ((!dest) || (!ptr) || (!exactsize)) | 69 | if ((!dest) || (!ptr) || (!exactsize)) |
| 67 | return -1; | 70 | return -1; |
| @@ -70,6 +73,7 @@ static int udf_build_ustr_exact(struct ustr *dest, dstring * ptr, int exactsize) | |||
| 70 | dest->u_cmpID = ptr[0]; | 73 | dest->u_cmpID = ptr[0]; |
| 71 | dest->u_len = exactsize - 1; | 74 | dest->u_len = exactsize - 1; |
| 72 | memcpy(dest->u_name, ptr + 1, exactsize - 1); | 75 | memcpy(dest->u_name, ptr + 1, exactsize - 1); |
| 76 | |||
| 73 | return 0; | 77 | return 0; |
| 74 | } | 78 | } |
| 75 | 79 | ||
| @@ -129,20 +133,15 @@ int udf_CS0toUTF8(struct ustr *utf_o, struct ustr *ocu_i) | |||
| 129 | c = (c << 8) | ocu[i++]; | 133 | c = (c << 8) | ocu[i++]; |
| 130 | 134 | ||
| 131 | /* Compress Unicode to UTF-8 */ | 135 | /* Compress Unicode to UTF-8 */ |
| 132 | if (c < 0x80U) | 136 | if (c < 0x80U) { |
| 133 | utf_o->u_name[utf_o->u_len++] = (uint8_t) c; | 137 | utf_o->u_name[utf_o->u_len++] = (uint8_t)c; |
| 134 | else if (c < 0x800U) { | 138 | } else if (c < 0x800U) { |
| 135 | utf_o->u_name[utf_o->u_len++] = | 139 | utf_o->u_name[utf_o->u_len++] = (uint8_t)(0xc0 | (c >> 6)); |
| 136 | (uint8_t) (0xc0 | (c >> 6)); | 140 | utf_o->u_name[utf_o->u_len++] = (uint8_t)(0x80 | (c & 0x3f)); |
| 137 | utf_o->u_name[utf_o->u_len++] = | ||
| 138 | (uint8_t) (0x80 | (c & 0x3f)); | ||
| 139 | } else { | 141 | } else { |
| 140 | utf_o->u_name[utf_o->u_len++] = | 142 | utf_o->u_name[utf_o->u_len++] = (uint8_t)(0xe0 | (c >> 12)); |
| 141 | (uint8_t) (0xe0 | (c >> 12)); | 143 | utf_o->u_name[utf_o->u_len++] = (uint8_t)(0x80 | ((c >> 6) & 0x3f)); |
| 142 | utf_o->u_name[utf_o->u_len++] = | 144 | utf_o->u_name[utf_o->u_len++] = (uint8_t)(0x80 | (c & 0x3f)); |
| 143 | (uint8_t) (0x80 | ((c >> 6) & 0x3f)); | ||
| 144 | utf_o->u_name[utf_o->u_len++] = | ||
| 145 | (uint8_t) (0x80 | (c & 0x3f)); | ||
| 146 | } | 145 | } |
| 147 | } | 146 | } |
| 148 | utf_o->u_cmpID = 8; | 147 | utf_o->u_cmpID = 8; |
| @@ -173,7 +172,7 @@ int udf_CS0toUTF8(struct ustr *utf_o, struct ustr *ocu_i) | |||
| 173 | * November 12, 1997 - Andrew E. Mileski | 172 | * November 12, 1997 - Andrew E. Mileski |
| 174 | * Written, tested, and released. | 173 | * Written, tested, and released. |
| 175 | */ | 174 | */ |
| 176 | static int udf_UTF8toCS0(dstring * ocu, struct ustr *utf, int length) | 175 | static int udf_UTF8toCS0(dstring *ocu, struct ustr *utf, int length) |
| 177 | { | 176 | { |
| 178 | unsigned c, i, max_val, utf_char; | 177 | unsigned c, i, max_val, utf_char; |
| 179 | int utf_cnt, u_len; | 178 | int utf_cnt, u_len; |
| @@ -182,12 +181,12 @@ static int udf_UTF8toCS0(dstring * ocu, struct ustr *utf, int length) | |||
| 182 | ocu[0] = 8; | 181 | ocu[0] = 8; |
| 183 | max_val = 0xffU; | 182 | max_val = 0xffU; |
| 184 | 183 | ||
| 185 | try_again: | 184 | try_again: |
| 186 | u_len = 0U; | 185 | u_len = 0U; |
| 187 | utf_char = 0U; | 186 | utf_char = 0U; |
| 188 | utf_cnt = 0U; | 187 | utf_cnt = 0U; |
| 189 | for (i = 0U; i < utf->u_len; i++) { | 188 | for (i = 0U; i < utf->u_len; i++) { |
| 190 | c = (uint8_t) utf->u_name[i]; | 189 | c = (uint8_t)utf->u_name[i]; |
| 191 | 190 | ||
| 192 | /* Complete a multi-byte UTF-8 character */ | 191 | /* Complete a multi-byte UTF-8 character */ |
| 193 | if (utf_cnt) { | 192 | if (utf_cnt) { |
| @@ -213,37 +212,40 @@ static int udf_UTF8toCS0(dstring * ocu, struct ustr *utf, int length) | |||
| 213 | } else if ((c & 0xfeU) == 0xfcU) { | 212 | } else if ((c & 0xfeU) == 0xfcU) { |
| 214 | utf_char = c & 0x01U; | 213 | utf_char = c & 0x01U; |
| 215 | utf_cnt = 5; | 214 | utf_cnt = 5; |
| 216 | } else | 215 | } else { |
| 217 | goto error_out; | 216 | goto error_out; |
| 217 | } | ||
| 218 | continue; | 218 | continue; |
| 219 | } else | 219 | } else { |
| 220 | /* Single byte UTF-8 character (most common) */ | 220 | /* Single byte UTF-8 character (most common) */ |
| 221 | utf_char = c; | 221 | utf_char = c; |
| 222 | } | ||
| 222 | } | 223 | } |
| 223 | 224 | ||
| 224 | /* Choose no compression if necessary */ | 225 | /* Choose no compression if necessary */ |
| 225 | if (utf_char > max_val) { | 226 | if (utf_char > max_val) { |
| 226 | if (0xffU == max_val) { | 227 | if (max_val == 0xffU) { |
| 227 | max_val = 0xffffU; | 228 | max_val = 0xffffU; |
| 228 | ocu[0] = (uint8_t) 0x10U; | 229 | ocu[0] = (uint8_t)0x10U; |
| 229 | goto try_again; | 230 | goto try_again; |
| 230 | } | 231 | } |
| 231 | goto error_out; | 232 | goto error_out; |
| 232 | } | 233 | } |
| 233 | 234 | ||
| 234 | if (max_val == 0xffffU) { | 235 | if (max_val == 0xffffU) { |
| 235 | ocu[++u_len] = (uint8_t) (utf_char >> 8); | 236 | ocu[++u_len] = (uint8_t)(utf_char >> 8); |
| 236 | } | 237 | } |
| 237 | ocu[++u_len] = (uint8_t) (utf_char & 0xffU); | 238 | ocu[++u_len] = (uint8_t)(utf_char & 0xffU); |
| 238 | } | 239 | } |
| 239 | 240 | ||
| 240 | if (utf_cnt) { | 241 | if (utf_cnt) { |
| 241 | error_out: | 242 | error_out: |
| 242 | ocu[++u_len] = '?'; | 243 | ocu[++u_len] = '?'; |
| 243 | printk(KERN_DEBUG "udf: bad UTF-8 character\n"); | 244 | printk(KERN_DEBUG "udf: bad UTF-8 character\n"); |
| 244 | } | 245 | } |
| 245 | 246 | ||
| 246 | ocu[length - 1] = (uint8_t) u_len + 1; | 247 | ocu[length - 1] = (uint8_t)u_len + 1; |
| 248 | |||
| 247 | return u_len + 1; | 249 | return u_len + 1; |
| 248 | } | 250 | } |
| 249 | 251 | ||
| @@ -288,7 +290,7 @@ static int udf_CS0toNLS(struct nls_table *nls, struct ustr *utf_o, | |||
| 288 | return utf_o->u_len; | 290 | return utf_o->u_len; |
| 289 | } | 291 | } |
| 290 | 292 | ||
| 291 | static int udf_NLStoCS0(struct nls_table *nls, dstring * ocu, struct ustr *uni, | 293 | static int udf_NLStoCS0(struct nls_table *nls, dstring *ocu, struct ustr *uni, |
| 292 | int length) | 294 | int length) |
| 293 | { | 295 | { |
| 294 | unsigned len, i, max_val; | 296 | unsigned len, i, max_val; |
| @@ -299,7 +301,7 @@ static int udf_NLStoCS0(struct nls_table *nls, dstring * ocu, struct ustr *uni, | |||
| 299 | ocu[0] = 8; | 301 | ocu[0] = 8; |
| 300 | max_val = 0xffU; | 302 | max_val = 0xffU; |
| 301 | 303 | ||
| 302 | try_again: | 304 | try_again: |
| 303 | u_len = 0U; | 305 | u_len = 0U; |
| 304 | for (i = 0U; i < uni->u_len; i++) { | 306 | for (i = 0U; i < uni->u_len; i++) { |
| 305 | len = nls->char2uni(&uni->u_name[i], uni->u_len - i, &uni_char); | 307 | len = nls->char2uni(&uni->u_name[i], uni->u_len - i, &uni_char); |
| @@ -308,21 +310,21 @@ static int udf_NLStoCS0(struct nls_table *nls, dstring * ocu, struct ustr *uni, | |||
| 308 | 310 | ||
| 309 | if (uni_char > max_val) { | 311 | if (uni_char > max_val) { |
| 310 | max_val = 0xffffU; | 312 | max_val = 0xffffU; |
| 311 | ocu[0] = (uint8_t) 0x10U; | 313 | ocu[0] = (uint8_t)0x10U; |
| 312 | goto try_again; | 314 | goto try_again; |
| 313 | } | 315 | } |
| 314 | 316 | ||
| 315 | if (max_val == 0xffffU) | 317 | if (max_val == 0xffffU) |
| 316 | ocu[++u_len] = (uint8_t) (uni_char >> 8); | 318 | ocu[++u_len] = (uint8_t)(uni_char >> 8); |
| 317 | ocu[++u_len] = (uint8_t) (uni_char & 0xffU); | 319 | ocu[++u_len] = (uint8_t)(uni_char & 0xffU); |
| 318 | i += len - 1; | 320 | i += len - 1; |
| 319 | } | 321 | } |
| 320 | 322 | ||
| 321 | ocu[length - 1] = (uint8_t) u_len + 1; | 323 | ocu[length - 1] = (uint8_t)u_len + 1; |
| 322 | return u_len + 1; | 324 | return u_len + 1; |
| 323 | } | 325 | } |
| 324 | 326 | ||
| 325 | int udf_get_filename(struct super_block *sb, uint8_t * sname, uint8_t * dname, | 327 | int udf_get_filename(struct super_block *sb, uint8_t *sname, uint8_t *dname, |
| 326 | int flen) | 328 | int flen) |
| 327 | { | 329 | { |
| 328 | struct ustr filename, unifilename; | 330 | struct ustr filename, unifilename; |
| @@ -334,30 +336,29 @@ int udf_get_filename(struct super_block *sb, uint8_t * sname, uint8_t * dname, | |||
| 334 | 336 | ||
| 335 | if (UDF_QUERY_FLAG(sb, UDF_FLAG_UTF8)) { | 337 | if (UDF_QUERY_FLAG(sb, UDF_FLAG_UTF8)) { |
| 336 | if (!udf_CS0toUTF8(&filename, &unifilename)) { | 338 | if (!udf_CS0toUTF8(&filename, &unifilename)) { |
| 337 | udf_debug("Failed in udf_get_filename: sname = %s\n", | 339 | udf_debug("Failed in udf_get_filename: sname = %s\n", sname); |
| 338 | sname); | ||
| 339 | return 0; | 340 | return 0; |
| 340 | } | 341 | } |
| 341 | } else if (UDF_QUERY_FLAG(sb, UDF_FLAG_NLS_MAP)) { | 342 | } else if (UDF_QUERY_FLAG(sb, UDF_FLAG_NLS_MAP)) { |
| 342 | if (!udf_CS0toNLS | 343 | if (!udf_CS0toNLS(UDF_SB(sb)->s_nls_map, &filename, &unifilename)) { |
| 343 | (UDF_SB(sb)->s_nls_map, &filename, &unifilename)) { | 344 | udf_debug("Failed in udf_get_filename: sname = %s\n", sname); |
| 344 | udf_debug("Failed in udf_get_filename: sname = %s\n", | ||
| 345 | sname); | ||
| 346 | return 0; | 345 | return 0; |
| 347 | } | 346 | } |
| 348 | } else | 347 | } else { |
| 349 | return 0; | 348 | return 0; |
| 349 | } | ||
| 350 | 350 | ||
| 351 | if ((len = | 351 | len = udf_translate_to_linux(dname, filename.u_name, filename.u_len, |
| 352 | udf_translate_to_linux(dname, filename.u_name, filename.u_len, | 352 | unifilename.u_name, unifilename.u_len); |
| 353 | unifilename.u_name, unifilename.u_len))) { | 353 | if (len) { |
| 354 | return len; | 354 | return len; |
| 355 | } | 355 | } |
| 356 | |||
| 356 | return 0; | 357 | return 0; |
| 357 | } | 358 | } |
| 358 | 359 | ||
| 359 | int udf_put_filename(struct super_block *sb, const uint8_t * sname, | 360 | int udf_put_filename(struct super_block *sb, const uint8_t *sname, |
| 360 | uint8_t * dname, int flen) | 361 | uint8_t *dname, int flen) |
| 361 | { | 362 | { |
| 362 | struct ustr unifilename; | 363 | struct ustr unifilename; |
| 363 | int namelen; | 364 | int namelen; |
| @@ -367,31 +368,29 @@ int udf_put_filename(struct super_block *sb, const uint8_t * sname, | |||
| 367 | } | 368 | } |
| 368 | 369 | ||
| 369 | if (UDF_QUERY_FLAG(sb, UDF_FLAG_UTF8)) { | 370 | if (UDF_QUERY_FLAG(sb, UDF_FLAG_UTF8)) { |
| 370 | if (! | 371 | namelen = udf_UTF8toCS0(dname, &unifilename, UDF_NAME_LEN); |
| 371 | (namelen = | 372 | if (!namelen) { |
| 372 | udf_UTF8toCS0(dname, &unifilename, UDF_NAME_LEN))) { | ||
| 373 | return 0; | 373 | return 0; |
| 374 | } | 374 | } |
| 375 | } else if (UDF_QUERY_FLAG(sb, UDF_FLAG_NLS_MAP)) { | 375 | } else if (UDF_QUERY_FLAG(sb, UDF_FLAG_NLS_MAP)) { |
| 376 | if (! | 376 | namelen = udf_NLStoCS0(UDF_SB(sb)->s_nls_map, dname, &unifilename, UDF_NAME_LEN); |
| 377 | (namelen = | 377 | if (!namelen) { |
| 378 | udf_NLStoCS0(UDF_SB(sb)->s_nls_map, dname, &unifilename, | ||
| 379 | UDF_NAME_LEN))) { | ||
| 380 | return 0; | 378 | return 0; |
| 381 | } | 379 | } |
| 382 | } else | 380 | } else { |
| 383 | return 0; | 381 | return 0; |
| 382 | } | ||
| 384 | 383 | ||
| 385 | return namelen; | 384 | return namelen; |
| 386 | } | 385 | } |
| 387 | 386 | ||
| 388 | #define ILLEGAL_CHAR_MARK '_' | 387 | #define ILLEGAL_CHAR_MARK '_' |
| 389 | #define EXT_MARK '.' | 388 | #define EXT_MARK '.' |
| 390 | #define CRC_MARK '#' | 389 | #define CRC_MARK '#' |
| 391 | #define EXT_SIZE 5 | 390 | #define EXT_SIZE 5 |
| 392 | 391 | ||
| 393 | static int udf_translate_to_linux(uint8_t * newName, uint8_t * udfName, | 392 | static int udf_translate_to_linux(uint8_t *newName, uint8_t *udfName, int udfLen, |
| 394 | int udfLen, uint8_t * fidName, int fidNameLen) | 393 | uint8_t *fidName, int fidNameLen) |
| 395 | { | 394 | { |
| 396 | int index, newIndex = 0, needsCRC = 0; | 395 | int index, newIndex = 0, needsCRC = 0; |
| 397 | int extIndex = 0, newExtIndex = 0, hasExt = 0; | 396 | int extIndex = 0, newExtIndex = 0, hasExt = 0; |
| @@ -399,8 +398,8 @@ static int udf_translate_to_linux(uint8_t * newName, uint8_t * udfName, | |||
| 399 | uint8_t curr; | 398 | uint8_t curr; |
| 400 | const uint8_t hexChar[] = "0123456789ABCDEF"; | 399 | const uint8_t hexChar[] = "0123456789ABCDEF"; |
| 401 | 400 | ||
| 402 | if (udfName[0] == '.' && (udfLen == 1 || | 401 | if (udfName[0] == '.' && |
| 403 | (udfLen == 2 && udfName[1] == '.'))) { | 402 | (udfLen == 1 || (udfLen == 2 && udfName[1] == '.'))) { |
| 404 | needsCRC = 1; | 403 | needsCRC = 1; |
| 405 | newIndex = udfLen; | 404 | newIndex = udfLen; |
| 406 | memcpy(newName, udfName, udfLen); | 405 | memcpy(newName, udfName, udfLen); |
| @@ -410,16 +409,13 @@ static int udf_translate_to_linux(uint8_t * newName, uint8_t * udfName, | |||
| 410 | if (curr == '/' || curr == 0) { | 409 | if (curr == '/' || curr == 0) { |
| 411 | needsCRC = 1; | 410 | needsCRC = 1; |
| 412 | curr = ILLEGAL_CHAR_MARK; | 411 | curr = ILLEGAL_CHAR_MARK; |
| 413 | while (index + 1 < udfLen | 412 | while (index + 1 < udfLen && (udfName[index + 1] == '/' || |
| 414 | && (udfName[index + 1] == '/' | 413 | udfName[index + 1] == 0)) |
| 415 | || udfName[index + 1] == 0)) | ||
| 416 | index++; | 414 | index++; |
| 417 | } | 415 | } if (curr == EXT_MARK && (udfLen - index - 1) <= EXT_SIZE) { |
| 418 | if (curr == EXT_MARK | 416 | if (udfLen == index + 1) { |
| 419 | && (udfLen - index - 1) <= EXT_SIZE) { | ||
| 420 | if (udfLen == index + 1) | ||
| 421 | hasExt = 0; | 417 | hasExt = 0; |
| 422 | else { | 418 | } else { |
| 423 | hasExt = 1; | 419 | hasExt = 1; |
| 424 | extIndex = index; | 420 | extIndex = index; |
| 425 | newExtIndex = newIndex; | 421 | newExtIndex = newIndex; |
| @@ -437,23 +433,16 @@ static int udf_translate_to_linux(uint8_t * newName, uint8_t * udfName, | |||
| 437 | 433 | ||
| 438 | if (hasExt) { | 434 | if (hasExt) { |
| 439 | int maxFilenameLen; | 435 | int maxFilenameLen; |
| 440 | for (index = 0; | 436 | for(index = 0; index < EXT_SIZE && extIndex + index + 1 < udfLen; index++) { |
| 441 | index < EXT_SIZE && extIndex + index + 1 < udfLen; | ||
| 442 | index++) { | ||
| 443 | curr = udfName[extIndex + index + 1]; | 437 | curr = udfName[extIndex + index + 1]; |
| 444 | 438 | ||
| 445 | if (curr == '/' || curr == 0) { | 439 | if (curr == '/' || curr == 0) { |
| 446 | needsCRC = 1; | 440 | needsCRC = 1; |
| 447 | curr = ILLEGAL_CHAR_MARK; | 441 | curr = ILLEGAL_CHAR_MARK; |
| 448 | while (extIndex + index + 2 < udfLen | 442 | while(extIndex + index + 2 < udfLen && |
| 449 | && (index + 1 < EXT_SIZE | 443 | (index + 1 < EXT_SIZE |
| 450 | && | 444 | && (udfName[extIndex + index + 2] == '/' || |
| 451 | (udfName | 445 | udfName[extIndex + index + 2] == 0))) |
| 452 | [extIndex + index + 2] == | ||
| 453 | '/' | ||
| 454 | || udfName[extIndex + | ||
| 455 | index + 2] == | ||
| 456 | 0))) | ||
| 457 | index++; | 446 | index++; |
| 458 | } | 447 | } |
| 459 | ext[localExtIndex++] = curr; | 448 | ext[localExtIndex++] = curr; |
| @@ -463,8 +452,9 @@ static int udf_translate_to_linux(uint8_t * newName, uint8_t * udfName, | |||
| 463 | newIndex = maxFilenameLen; | 452 | newIndex = maxFilenameLen; |
| 464 | else | 453 | else |
| 465 | newIndex = newExtIndex; | 454 | newIndex = newExtIndex; |
| 466 | } else if (newIndex > 250) | 455 | } else if (newIndex > 250) { |
| 467 | newIndex = 250; | 456 | newIndex = 250; |
| 457 | } | ||
| 468 | newName[newIndex++] = CRC_MARK; | 458 | newName[newIndex++] = CRC_MARK; |
| 469 | valueCRC = udf_crc(fidName, fidNameLen, 0); | 459 | valueCRC = udf_crc(fidName, fidNameLen, 0); |
| 470 | newName[newIndex++] = hexChar[(valueCRC & 0xf000) >> 12]; | 460 | newName[newIndex++] = hexChar[(valueCRC & 0xf000) >> 12]; |
| @@ -478,5 +468,6 @@ static int udf_translate_to_linux(uint8_t * newName, uint8_t * udfName, | |||
| 478 | newName[newIndex++] = ext[index]; | 468 | newName[newIndex++] = ext[index]; |
| 479 | } | 469 | } |
| 480 | } | 470 | } |
| 471 | |||
| 481 | return newIndex; | 472 | return newIndex; |
| 482 | } | 473 | } |
