gnome-commander r1475 - in trunk: . src
- From: epiotr svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-commander r1475 - in trunk: . src
- Date: Mon, 7 Jan 2008 18:36:16 +0000 (GMT)
Author: epiotr
Date: Mon Jan 7 18:36:16 2008
New Revision: 1475
URL: http://svn.gnome.org/viewvc/gnome-commander?rev=1475&view=rev
Log:
Simplified gnome_cmd_file_get_extension()
Modified:
trunk/ChangeLog
trunk/src/gnome-cmd-file.cc
Modified: trunk/ChangeLog
==============================================================================
--- trunk/ChangeLog (original)
+++ trunk/ChangeLog Mon Jan 7 18:36:16 2008
@@ -1,3 +1,8 @@
+2008-01-07 Piotr Eljasiak <epiotr use pl>
+
+ * src/gnome-cmd-file.cc:
+ Simplified gnome_cmd_file_get_extension()
+
2008-01-06 Piotr Eljasiak <epiotr use pl>
* src/gnome-cmd-file-selector.cc:
Modified: trunk/src/gnome-cmd-file.cc
==============================================================================
--- trunk/src/gnome-cmd-file.cc (original)
+++ trunk/src/gnome-cmd-file.cc Mon Jan 7 18:36:16 2008
@@ -391,22 +391,16 @@
const gchar *gnome_cmd_file_get_extension (GnomeCmdFile *file)
{
- gint i, len;
-
g_return_val_if_fail (file != NULL, NULL);
g_return_val_if_fail (file->info != NULL, NULL);
if (file->info->type == GNOME_VFS_FILE_TYPE_DIRECTORY)
return NULL;
- len = strlen (file->info->name);
- for (i=len; i>0; i--)
- {
- if (file->info->name[i] == '.')
- return &file->info->name[i+1];
- }
+ const char *s = strrchr (file->info->name, '.'); // does NOT work on UTF-8 strings, should be (MUCH SLOWER):
+ // const char *s = g_utf8_strrchr (file->info->name, -1, '.');
- return NULL;
+ return s ? s+1 : NULL;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]