libisofs  1.5.4
About: libisofs is a library to create an ISO 9660 filesystem, supports extensions like RockRidge or Joliet, makes bootable ISO 9660, and records file attributes which are of interest for data backups.
  Fossies Dox: libisofs-1.5.4.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

hfsplus_case.c File Reference
#include "libisofs.h"
Include dependency graph for hfsplus_case.c:

Go to the source code of this file.

Functions

static int what_page (uint16_t x)
 
static uint16_t cmp_name_page0 (uint16_t x)
 
uint16_t iso_hfsplus_cichar (uint16_t x)
 

Variables

static uint8_t utf16be_transl []
 Maps UTF-16BE double-byte characters to the representative of their equivalence class under the relation of HFS+ case-insensitivity. More...
 
static int utf16be_transl_count = 329
 
static int utf16be_transl_starts []
 

Function Documentation

◆ cmp_name_page0()

static uint16_t cmp_name_page0 ( uint16_t  x)
static

Definition at line 412 of file hfsplus_case.c.

413 {
414  uint8_t *low;
415 
416  low = ((uint8_t *) &x) + 1;
417 
418  if (x == 0)
419  return 0xffff;
420  if (*low <= 0x40)
421  ;
422  else if (*low <= 0x5a)
423  *low = *low + 0x20;
424  else if (*low < 0xc6)
425  ;
426  else if (*low == 0xc6)
427  *low = 0xe6;
428  else if (*low == 0xd0)
429  *low = 0xf0;
430  else if (*low == 0xd8)
431  *low = 0xf8;
432  else if (*low == 0xde)
433  *low = 0xfe;
434  return x;
435 }

Referenced by iso_hfsplus_cichar().

◆ iso_hfsplus_cichar()

uint16_t iso_hfsplus_cichar ( uint16_t  x)

Definition at line 444 of file hfsplus_case.c.

445 {
446  int page, i;
447  uint16_t ret;
448  uint8_t low, high;
449 
450  high = ((uint8_t *) &x)[0];
451  low = ((uint8_t *) &x)[1];
452 
453  page = what_page(x);
454  if (page < 0)
455  return x; /* No translation needed */
456  if (page == 0)
457  return cmp_name_page0(x); /* Accelerator for ASCII subset */
458 
459  for (i = utf16be_transl_starts[page] * 4; i < utf16be_transl_count * 4;
460  i += 4) {
461  if (utf16be_transl[i] != high)
462  break;
463  if (utf16be_transl[i + 1] == low) {
464  ((uint8_t *) &ret)[0] = utf16be_transl[i + 2];
465  ((uint8_t *) &ret)[1] = utf16be_transl[i + 3];
466  return ret;
467  }
468  }
469  return x;
470 }
static int what_page(uint16_t x)
Definition: hfsplus_case.c:380
static uint8_t utf16be_transl[]
Maps UTF-16BE double-byte characters to the representative of their equivalence class under the relat...
Definition: hfsplus_case.c:35
static int utf16be_transl_count
Definition: hfsplus_case.c:367
static uint16_t cmp_name_page0(uint16_t x)
Definition: hfsplus_case.c:412
static int utf16be_transl_starts[]
Definition: hfsplus_case.c:375

References cmp_name_page0(), utf16be_transl, utf16be_transl_count, utf16be_transl_starts, and what_page().

Referenced by iso_get_hfsplus_name().

◆ what_page()

static int what_page ( uint16_t  x)
static

Definition at line 380 of file hfsplus_case.c.

381 {
382  switch(((uint8_t *) &x)[0]) {
383  case 0:
384  return 0;
385  case 1:
386  return 1;
387  case 3:
388  return 2;
389  case 4:
390  return 3;
391  case 5:
392  return 4;
393  case 16:
394  return 5;
395  case 32:
396  return 6;
397  case 33:
398  return 7;
399  case 254:
400  return 8;
401  case 255:
402  return 9;
403  default:
404  return -1; /* no mapping */
405  }
406 }

Referenced by iso_hfsplus_cichar().

Variable Documentation

◆ utf16be_transl

uint8_t utf16be_transl[]
static

Maps UTF-16BE double-byte characters to the representative of their equivalence class under the relation of HFS+ case-insensitivity.

Definition at line 35 of file hfsplus_case.c.

Referenced by iso_hfsplus_cichar().

◆ utf16be_transl_count

int utf16be_transl_count = 329
static

Definition at line 367 of file hfsplus_case.c.

Referenced by iso_hfsplus_cichar().

◆ utf16be_transl_starts

int utf16be_transl_starts[]
static
Initial value:
= {
0, 31, 81, 112, 195, 233, 271, 286, 302, 303
}

Definition at line 375 of file hfsplus_case.c.

Referenced by iso_hfsplus_cichar().