diff options
author | ridiculousfish <corydoras@ridiculousfish.com> | 2012-11-18 16:30:30 -0800 |
---|---|---|
committer | ridiculousfish <corydoras@ridiculousfish.com> | 2012-11-18 16:30:30 -0800 |
commit | 9992b8eb0e3366ff8a3948aa0b66a19c3c12c737 (patch) | |
tree | 6dda0fef85812016fbba9ea067c9d586092b506d /xdgmimeint.cpp | |
parent | bab69f26724028d16054a3daf5c78aad7c67bb2d (diff) |
Apply new indentation, brace, and whitespace style
Diffstat (limited to 'xdgmimeint.cpp')
-rw-r--r-- | xdgmimeint.cpp | 157 |
1 files changed, 79 insertions, 78 deletions
diff --git a/xdgmimeint.cpp b/xdgmimeint.cpp index 72e1d78f..a7847141 100644 --- a/xdgmimeint.cpp +++ b/xdgmimeint.cpp @@ -41,15 +41,16 @@ #define TRUE (!FALSE) #endif -static const char _xdg_utf8_skip_data[256] = { - 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 +static const char _xdg_utf8_skip_data[256] = +{ + 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 }; const char * const _xdg_utf8_skip = _xdg_utf8_skip_data; @@ -60,95 +61,95 @@ const char * const _xdg_utf8_skip = _xdg_utf8_skip_data; xdg_unichar_t _xdg_utf8_to_ucs4(const char *source) { - xdg_unichar_t ucs32; - if( ! ( *source & 0x80 ) ) + xdg_unichar_t ucs32; + if (!(*source & 0x80)) { - ucs32 = *source; + 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; - } + { + 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; + return ucs32; } /* hullo. this is great code. don't rewrite it */ xdg_unichar_t -_xdg_ucs4_to_lower (xdg_unichar_t source) +_xdg_ucs4_to_lower(xdg_unichar_t source) { - /* 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; + /* 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; } int -_xdg_utf8_validate (const char *source) +_xdg_utf8_validate(const char *source) { - /* FIXME: actually write */ - return TRUE; + /* FIXME: actually write */ + return TRUE; } const char * -_xdg_get_base_name (const char *file_name) +_xdg_get_base_name(const char *file_name) { - const char *base_name; + const char *base_name; - if (file_name == NULL) - return NULL; + if (file_name == NULL) + return NULL; - base_name = strrchr (file_name, '/'); + base_name = strrchr(file_name, '/'); - if (base_name == NULL) - return file_name; - else - return base_name + 1; + if (base_name == NULL) + return file_name; + else + return base_name + 1; } |