Back to index

libcitadel  8.12
Functions | Variables
xdgmimeint.c File Reference
#include "xdgmimeint.h"
#include <ctype.h>
#include <string.h>

Go to the source code of this file.

Functions

xdg_unichar_t _xdg_utf8_to_ucs4 (const char *source)
xdg_unichar_t _xdg_ucs4_to_lower (xdg_unichar_t source)
int _xdg_utf8_validate (const char *source)
const char * _xdg_get_base_name (const char *file_name)

Variables

static const char _xdg_utf8_skip_data [256]
const char *const _xdg_utf8_skip = _xdg_utf8_skip_data

Function Documentation

const char* _xdg_get_base_name ( const char *  file_name)

Definition at line 141 of file xdgmimeint.c.

{
  const char *base_name;

  if (file_name == NULL)
    return NULL;

  base_name = strrchr (file_name, '/');

  if (base_name == NULL)
    return file_name;
  else
    return base_name + 1;
}

Here is the caller graph for this function:

Definition at line 124 of file xdgmimeint.c.

{
  /* FIXME: Do a real to_upper sometime */
  /* CaseFolding-3.2.0.txt has a table of rules. */
  if ((source & 0xFF) == source)
    return (xdg_unichar_t) tolower ((unsigned char) source);
  return source;
}

Here is the caller graph for this function:

xdg_unichar_t _xdg_utf8_to_ucs4 ( const char *  source)

Definition at line 61 of file xdgmimeint.c.

{
  xdg_unichar_t ucs32;
  if( ! ( *source & 0x80 ) )
    {
      ucs32 = *source;
    }
  else
    {
      int bytelength = 0;
      xdg_unichar_t result;
      if ( ! (*source & 0x40) )
       {
         ucs32 = *source;
       }
      else
       {
         if ( ! (*source & 0x20) )
           {
             result = *source++ & 0x1F;
             bytelength = 2;
           }
         else if ( ! (*source & 0x10) )
           {
             result = *source++ & 0x0F;
             bytelength = 3;
           }
         else if ( ! (*source & 0x08) )
           {
             result = *source++ & 0x07;
             bytelength = 4;
           }
         else if ( ! (*source & 0x04) )
           {
             result = *source++ & 0x03;
             bytelength = 5;
           }
         else if ( ! (*source & 0x02) )
           {
             result = *source++ & 0x01;
             bytelength = 6;
           }
         else
           {
             result = *source++;
             bytelength = 1;
           }

         for ( bytelength --; bytelength > 0; bytelength -- )
           {
             result <<= 6;
             result |= *source++ & 0x3F;
           }
         ucs32 = result;
       }
    }
  return ucs32;
}

Here is the caller graph for this function:

int _xdg_utf8_validate ( const char *  source)

Definition at line 134 of file xdgmimeint.c.

{
  /* FIXME: actually write */
  return TRUE;
}

Here is the caller graph for this function:


Variable Documentation

const char* const _xdg_utf8_skip = _xdg_utf8_skip_data

Definition at line 55 of file xdgmimeint.c.

const char _xdg_utf8_skip_data[256] [static]
Initial value:
 {
  1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
  1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
  1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
  1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
  1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
  1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
  2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
  3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,6,6,1,1
}

Definition at line 44 of file xdgmimeint.c.