r2119 - trunk/src/target/OM-2007/panel-plugins/openmoko-panel-mainmenu/src
laforge at sita.openmoko.org
laforge at sita.openmoko.org
Sat Jun 2 01:49:08 CEST 2007
Author: laforge
Date: 2007-06-02 01:49:07 +0200 (Sat, 02 Jun 2007)
New Revision: 2119
Modified:
trunk/src/target/OM-2007/panel-plugins/openmoko-panel-mainmenu/src/mokodesktop.c
trunk/src/target/OM-2007/panel-plugins/openmoko-panel-mainmenu/src/mokodesktop.h
trunk/src/target/OM-2007/panel-plugins/openmoko-panel-mainmenu/src/stylusmenu.c
Log:
use PATH_MAX where apropriate
Modified: trunk/src/target/OM-2007/panel-plugins/openmoko-panel-mainmenu/src/mokodesktop.c
===================================================================
--- trunk/src/target/OM-2007/panel-plugins/openmoko-panel-mainmenu/src/mokodesktop.c 2007-06-01 23:07:41 UTC (rev 2118)
+++ trunk/src/target/OM-2007/panel-plugins/openmoko-panel-mainmenu/src/mokodesktop.c 2007-06-01 23:49:07 UTC (rev 2119)
@@ -179,9 +179,9 @@
DIR *dp;
struct stat stat_info;
- char vfolder_path_root[512];
- char vfolder_path[512];
- char orig_wd[256];
+ char vfolder_path_root[PATH_MAX];
+ char vfolder_path[PATH_MAX];
+ char orig_wd[PATH_MAX];
int desktops_dirs_n = APP_PATHS_N;
@@ -192,7 +192,7 @@
MokoDesktopItem *item_new = NULL;
MBDotDesktop *dd, *user_overides = NULL;
- char app_paths[APP_PATHS_N][256];
+ char app_paths[APP_PATHS_N][PATH_MAX];
struct dirent **namelist;
/*
top_head_item = mokodesktop_item_new_with_params ("Home",
@@ -202,15 +202,15 @@
*/
ItemTypeDotDesktop = type_reg_cnt;
- snprintf( vfolder_path_root, 512, "%s/.matchbox/vfolders/Root.directory",
+ snprintf( vfolder_path_root, PATH_MAX, "%s/.matchbox/vfolders/Root.directory",
mb_util_get_homedir());
- snprintf( vfolder_path, 512, "%s/.matchbox/vfolders",
+ snprintf( vfolder_path, PATH_MAX, "%s/.matchbox/vfolders",
mb_util_get_homedir());
if (stat(vfolder_path_root, &stat_info))
{
- snprintf(vfolder_path_root, 512, VFOLDERDIR"/vfolders/Root.directory");
- snprintf(vfolder_path, 512, VFOLDERDIR "/vfolders" );
+ snprintf(vfolder_path_root, PATH_MAX, VFOLDERDIR"/vfolders/Root.directory");
+ snprintf(vfolder_path, PATH_MAX, VFOLDERDIR "/vfolders" );
}
fprintf(stdout, "moko: vfolder_path_root=[%s]\n", vfolder_path_root);
@@ -248,13 +248,13 @@
}
- //snprintf(app_paths[0], 256, "%s/applications", DATADIR);
- snprintf(app_paths[0], 256, "/usr/share/applications");
- snprintf(app_paths[1], 256, "/usr/share/applications");
- snprintf(app_paths[2], 256, "/usr/local/share/applications");
- snprintf(app_paths[3], 256, "%s/.applications", mb_util_get_homedir());
+ //snprintf(app_paths[0], PATH_MAX-1, "%s/applications", DATADIR);
+ snprintf(app_paths[0], PATH_MAX-1, "/usr/share/applications");
+ snprintf(app_paths[1], PATH_MAX-1, "/usr/share/applications");
+ snprintf(app_paths[2], PATH_MAX-1, "/usr/local/share/applications");
+ snprintf(app_paths[3], PATH_MAX-1, "%s/.applications", mb_util_get_homedir());
- if (getcwd(orig_wd, 255) == (char *)NULL)
+ if (getcwd(orig_wd, PATH_MAX-1) == (char *)NULL)
{
fprintf(stderr, "Cant get current directory\n");
return -1;
@@ -300,7 +300,7 @@
&& mb_dotdesktop_get(dd, "Exec"))
{
MokoDesktopItem *folder = NULL;
- char full_path[512];
+ char full_path[PATH_MAX];
char *folder_name = NULL;
add_a_dotdesktop_item (top_head_item, dd, folder);
Modified: trunk/src/target/OM-2007/panel-plugins/openmoko-panel-mainmenu/src/mokodesktop.h
===================================================================
--- trunk/src/target/OM-2007/panel-plugins/openmoko-panel-mainmenu/src/mokodesktop.h 2007-06-01 23:07:41 UTC (rev 2118)
+++ trunk/src/target/OM-2007/panel-plugins/openmoko-panel-mainmenu/src/mokodesktop.h 2007-06-01 23:49:07 UTC (rev 2119)
@@ -8,6 +8,7 @@
#include <fcntl.h>
#include <signal.h>
#include <sys/types.h>
+#include <sys/param.h>
#include <sys/stat.h>
#include <dirent.h>
#include <ctype.h>
Modified: trunk/src/target/OM-2007/panel-plugins/openmoko-panel-mainmenu/src/stylusmenu.c
===================================================================
--- trunk/src/target/OM-2007/panel-plugins/openmoko-panel-mainmenu/src/stylusmenu.c 2007-06-01 23:07:41 UTC (rev 2118)
+++ trunk/src/target/OM-2007/panel-plugins/openmoko-panel-mainmenu/src/stylusmenu.c 2007-06-01 23:49:07 UTC (rev 2119)
@@ -3,11 +3,11 @@
*
* Authored by Sun Zhiyong <sunzhiyong at fic-sh.com.cn>
*
- * Copyright (C) 2006 First International Computer Inc.
+ * Copyright (C) 2006-2007 OpenMoko, Inc.
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Public License as published by
- * the Free Software Foundation; version 2.1 of the license.
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2.0 of the license.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -41,13 +41,13 @@
}
else
{
- char path[512];
- snprintf (path, 512, "%s/%s", PIXMAP_PATH, item_new->icon_name);
+ char path[PATH_MAX];
+ snprintf (path, PATH_MAX, "%s/%s", PIXMAP_PATH, item_new->icon_name);
if (access (path, 0) == 0)
menu_item = moko_build_new_menu_item (item_new->name, path);
else
{
- snprintf (path, 512, "%s/%s", PKGDATADIR, "default-app-icon.xpm");
+ snprintf (path, PATH_MAX, "%s/%s", PKGDATADIR, "default-app-icon.xpm");
menu_item = moko_build_new_menu_item (item_new->name, path);
//moko_fill_model(self->list_store, path, item_new->name, item_new);
}
@@ -69,13 +69,13 @@
}
else
{
- char path[512];
- snprintf (path, 512, "%s/%s", PIXMAP_PATH, tmp_item->icon_name);
+ char path[PATH_MAX];
+ snprintf (path, PATH_MAX, "%s/%s", PIXMAP_PATH, tmp_item->icon_name);
if (access (path, 0) == 0)
menu_item = moko_build_new_menu_item (tmp_item->name, path);
else
{
- snprintf (path, 512, "%s/%s", PKGDATADIR, "default-app-icon.xpm");
+ snprintf (path, PATH_MAX, "%s/%s", PKGDATADIR, "default-app-icon.xpm");
menu_item = moko_build_new_menu_item (tmp_item->name, path);
//moko_fill_model(self->list_store, path, item_new->name, item_new);
}
More information about the commitlog
mailing list