aboutsummaryrefslogtreecommitdiffhomepage
path: root/xdgmimeglob.cpp
diff options
context:
space:
mode:
authorGravatar Łukasz Niemier <lukasz@niemier.pl>2012-11-18 11:23:22 +0100
committerGravatar Łukasz Niemier <lukasz@niemier.pl>2012-11-18 11:23:22 +0100
commit47df1ae40adecd0a02fc7dd06ab0745cb18c3fe0 (patch)
tree13bf3e8fdcae60fdfb5fa5e26c95818dc7a49790 /xdgmimeglob.cpp
parentb79854ad1aa814d9d35d76a1929b4726fa4bffa5 (diff)
Remove trailing whitespaces and change tabs to spaces
Diffstat (limited to 'xdgmimeglob.cpp')
-rw-r--r--xdgmimeglob.cpp126
1 files changed, 63 insertions, 63 deletions
diff --git a/xdgmimeglob.cpp b/xdgmimeglob.cpp
index a485765b..6b6c410e 100644
--- a/xdgmimeglob.cpp
+++ b/xdgmimeglob.cpp
@@ -16,7 +16,7 @@
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
@@ -37,12 +37,12 @@
#include <string.h>
#include <fnmatch.h>
-#ifndef FALSE
-#define FALSE (0)
+#ifndef FALSE
+#define FALSE (0)
#endif
-#ifndef TRUE
-#define TRUE (!FALSE)
+#ifndef TRUE
+#define TRUE (!FALSE)
#endif
typedef struct XdgGlobHashNode XdgGlobHashNode;
@@ -95,9 +95,9 @@ _xdg_glob_list_free (XdgGlobList *glob_list)
next = ptr->next;
if (ptr->data)
- free ((void *) ptr->data);
+ free ((void *) ptr->data);
if (ptr->mime_type)
- free ((void *) ptr->mime_type);
+ free ((void *) ptr->mime_type);
free (ptr);
ptr = next;
@@ -106,8 +106,8 @@ _xdg_glob_list_free (XdgGlobList *glob_list)
static XdgGlobList *
_xdg_glob_list_append (XdgGlobList *glob_list,
- void *data,
- const char *mime_type)
+ void *data,
+ const char *mime_type)
{
XdgGlobList *new_element;
XdgGlobList *tmp_element;
@@ -130,8 +130,8 @@ _xdg_glob_list_append (XdgGlobList *glob_list,
#if 0
static XdgGlobList *
_xdg_glob_list_prepend (XdgGlobList *glob_list,
- void *data,
- const char *mime_type)
+ void *data,
+ const char *mime_type)
{
XdgGlobList *new_element;
@@ -159,7 +159,7 @@ _xdg_glob_hash_node_new (void)
static void
_xdg_glob_hash_node_dump (XdgGlobHashNode *glob_hash_node,
- int depth)
+ int depth)
{
int i;
for (i = 0; i < depth; i++)
@@ -178,8 +178,8 @@ _xdg_glob_hash_node_dump (XdgGlobHashNode *glob_hash_node,
static XdgGlobHashNode *
_xdg_glob_hash_insert_text (XdgGlobHashNode *glob_hash_node,
- const char *text,
- const char *mime_type)
+ const char *text,
+ const char *mime_type)
{
XdgGlobHashNode *node;
xdg_unichar_t character;
@@ -209,33 +209,33 @@ _xdg_glob_hash_insert_text (XdgGlobHashNode *glob_hash_node,
node = prev_node->next;
while (node != NULL)
- {
- if (character < node->character)
- {
- node = _xdg_glob_hash_node_new ();
- node->character = character;
- node->next = prev_node->next;
- prev_node->next = node;
-
- found_node = TRUE;
- break;
- }
- else if (character == node->character)
- {
- found_node = TRUE;
- break;
- }
- prev_node = node;
- node = node->next;
- }
+ {
+ if (character < node->character)
+ {
+ node = _xdg_glob_hash_node_new ();
+ node->character = character;
+ node->next = prev_node->next;
+ prev_node->next = node;
+
+ found_node = TRUE;
+ break;
+ }
+ else if (character == node->character)
+ {
+ found_node = TRUE;
+ break;
+ }
+ prev_node = node;
+ node = node->next;
+ }
if (! found_node)
- {
- node = _xdg_glob_hash_node_new ();
- node->character = character;
- node->next = prev_node->next;
- prev_node->next = node;
- }
+ {
+ node = _xdg_glob_hash_node_new ();
+ node->character = character;
+ node->next = prev_node->next;
+ prev_node->next = node;
+ }
}
text = _xdg_utf8_next_char (text);
@@ -252,8 +252,8 @@ _xdg_glob_hash_insert_text (XdgGlobHashNode *glob_hash_node,
static const char *
_xdg_glob_hash_node_lookup_file_name (XdgGlobHashNode *glob_hash_node,
- const char *file_name,
- int ignore_case)
+ const char *file_name,
+ int ignore_case)
{
XdgGlobHashNode *node;
xdg_unichar_t character;
@@ -268,22 +268,22 @@ _xdg_glob_hash_node_lookup_file_name (XdgGlobHashNode *glob_hash_node,
for (node = glob_hash_node; node && character >= node->character; node = node->next)
{
if (character == node->character)
- {
- file_name = _xdg_utf8_next_char (file_name);
- if (*file_name == '\000')
- return node->mime_type;
- else
- return _xdg_glob_hash_node_lookup_file_name (node->child,
- file_name,
- ignore_case);
- }
+ {
+ file_name = _xdg_utf8_next_char (file_name);
+ if (*file_name == '\000')
+ return node->mime_type;
+ else
+ return _xdg_glob_hash_node_lookup_file_name (node->child,
+ file_name,
+ ignore_case);
+ }
}
return NULL;
}
const char *
_xdg_glob_hash_lookup_file_name (XdgGlobHash *glob_hash,
- const char *file_name)
+ const char *file_name)
{
XdgGlobList *list;
const char *mime_type;
@@ -302,11 +302,11 @@ _xdg_glob_hash_lookup_file_name (XdgGlobHash *glob_hash,
mime_type = (_xdg_glob_hash_node_lookup_file_name (glob_hash->simple_node, ptr, FALSE));
if (mime_type != NULL)
return mime_type;
-
+
mime_type = (_xdg_glob_hash_node_lookup_file_name (glob_hash->simple_node, ptr, TRUE));
if (mime_type != NULL)
return mime_type;
-
+
ptr = strchr (ptr+1, '.');
}
@@ -344,7 +344,7 @@ _xdg_glob_hash_free_nodes (XdgGlobHashNode *node)
if (node->next)
_xdg_glob_hash_free_nodes (node->next);
if (node->mime_type)
- free ((void *) node->mime_type);
+ free ((void *) node->mime_type);
free (node);
}
}
@@ -370,9 +370,9 @@ _xdg_glob_determine_type (const char *glob)
while (*ptr != '\000')
{
if (*ptr == '*' && first_char)
- maybe_in_simple_glob = TRUE;
+ maybe_in_simple_glob = TRUE;
else if (*ptr == '\\' || *ptr == '[' || *ptr == '?' || *ptr == '*')
- return XDG_GLOB_FULL;
+ return XDG_GLOB_FULL;
first_char = FALSE;
ptr = _xdg_utf8_next_char (ptr);
@@ -386,8 +386,8 @@ _xdg_glob_determine_type (const char *glob)
/* glob must be valid UTF-8 */
void
_xdg_glob_hash_append_glob (XdgGlobHash *glob_hash,
- const char *glob,
- const char *mime_type)
+ const char *glob,
+ const char *mime_type)
{
XdgGlobType type;
@@ -422,7 +422,7 @@ _xdg_glob_hash_dump (XdgGlobHash *glob_hash)
else
{
for (list = glob_hash->literal_list; list; list = list->next)
- printf (" %s - %s\n", (char *)list->data, list->mime_type);
+ printf (" %s - %s\n", (char *)list->data, list->mime_type);
}
printf ("\nSIMPLE GLOBS\n");
_xdg_glob_hash_node_dump (glob_hash->simple_node, 4);
@@ -435,14 +435,14 @@ _xdg_glob_hash_dump (XdgGlobHash *glob_hash)
else
{
for (list = glob_hash->full_list; list; list = list->next)
- printf (" %s - %s\n", (char *)list->data, list->mime_type);
+ printf (" %s - %s\n", (char *)list->data, list->mime_type);
}
}
void
_xdg_mime_glob_read_from_file (XdgGlobHash *glob_hash,
- const char *file_name)
+ const char *file_name)
{
FILE *glob_file;
char line[255];
@@ -459,11 +459,11 @@ _xdg_mime_glob_read_from_file (XdgGlobHash *glob_hash,
{
char *colon;
if (line[0] == '#')
- continue;
+ continue;
colon = strchr (line, ':');
if (colon == NULL)
- continue;
+ continue;
*(colon++) = '\000';
colon[strlen (colon) -1] = '\000';
_xdg_glob_hash_append_glob (glob_hash, colon, line);