Changeset 2119


Ignore:
Timestamp:
06/02/07 01:49:07 (6 years ago)
Author:
laforge
Message:

use PATH_MAX where apropriate

Location:
trunk/src/target/OM-2007/panel-plugins/openmoko-panel-mainmenu/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/target/OM-2007/panel-plugins/openmoko-panel-mainmenu/src/mokodesktop.c

    r1496 r2119  
    180180  struct stat    stat_info; 
    181181 
    182   char vfolder_path_root[512]; 
    183   char vfolder_path[512]; 
    184   char orig_wd[256]; 
     182  char vfolder_path_root[PATH_MAX]; 
     183  char vfolder_path[PATH_MAX]; 
     184  char orig_wd[PATH_MAX]; 
    185185 
    186186  int   desktops_dirs_n  = APP_PATHS_N; 
     
    193193  MBDotDesktop            *dd, *user_overides = NULL; 
    194194 
    195   char                     app_paths[APP_PATHS_N][256]; 
     195  char                     app_paths[APP_PATHS_N][PATH_MAX]; 
    196196  struct dirent          **namelist; 
    197197/* 
     
    203203        ItemTypeDotDesktop  = type_reg_cnt; 
    204204   
    205   snprintf( vfolder_path_root, 512, "%s/.matchbox/vfolders/Root.directory",  
     205  snprintf( vfolder_path_root, PATH_MAX, "%s/.matchbox/vfolders/Root.directory",  
    206206            mb_util_get_homedir()); 
    207   snprintf( vfolder_path, 512, "%s/.matchbox/vfolders",  
     207  snprintf( vfolder_path, PATH_MAX, "%s/.matchbox/vfolders",  
    208208            mb_util_get_homedir()); 
    209209 
    210210 if (stat(vfolder_path_root, &stat_info)) 
    211211    { 
    212       snprintf(vfolder_path_root, 512, VFOLDERDIR"/vfolders/Root.directory"); 
    213       snprintf(vfolder_path, 512, VFOLDERDIR "/vfolders" ); 
     212      snprintf(vfolder_path_root, PATH_MAX, VFOLDERDIR"/vfolders/Root.directory"); 
     213      snprintf(vfolder_path, PATH_MAX, VFOLDERDIR "/vfolders" ); 
    214214    } 
    215215  
     
    249249   
    250250   
    251   //snprintf(app_paths[0], 256, "%s/applications", DATADIR); 
    252   snprintf(app_paths[0], 256, "/usr/share/applications"); 
    253   snprintf(app_paths[1], 256, "/usr/share/applications"); 
    254   snprintf(app_paths[2], 256, "/usr/local/share/applications"); 
    255   snprintf(app_paths[3], 256, "%s/.applications", mb_util_get_homedir()); 
    256  
    257   if (getcwd(orig_wd, 255) == (char *)NULL) 
     251  //snprintf(app_paths[0], PATH_MAX-1, "%s/applications", DATADIR); 
     252  snprintf(app_paths[0], PATH_MAX-1, "/usr/share/applications"); 
     253  snprintf(app_paths[1], PATH_MAX-1, "/usr/share/applications"); 
     254  snprintf(app_paths[2], PATH_MAX-1, "/usr/local/share/applications"); 
     255  snprintf(app_paths[3], PATH_MAX-1, "%s/.applications", mb_util_get_homedir()); 
     256 
     257  if (getcwd(orig_wd, PATH_MAX-1) == (char *)NULL) 
    258258    { 
    259259      fprintf(stderr, "Cant get current directory\n"); 
     
    301301                          { 
    302302                              MokoDesktopItem *folder = NULL; 
    303                               char             full_path[512]; 
     303                              char             full_path[PATH_MAX]; 
    304304                              char          *folder_name = NULL; 
    305305 
  • trunk/src/target/OM-2007/panel-plugins/openmoko-panel-mainmenu/src/mokodesktop.h

    r1768 r2119  
    99#include <signal.h> 
    1010#include <sys/types.h> 
     11#include <sys/param.h> 
    1112#include <sys/stat.h> 
    1213#include <dirent.h> 
  • trunk/src/target/OM-2007/panel-plugins/openmoko-panel-mainmenu/src/stylusmenu.c

    r1713 r2119  
    44 *  Authored by Sun Zhiyong <sunzhiyong@fic-sh.com.cn> 
    55 * 
    6  *  Copyright (C) 2006 First International Computer Inc. 
     6 *  Copyright (C) 2006-2007 OpenMoko, Inc. 
    77 * 
    88 *  This program is free software; you can redistribute it and/or modify 
    9  *  it under the terms of the GNU Public License as published by 
    10  *  the Free Software Foundation; version 2.1 of the license. 
     9 *  it under the terms of the GNU General Public License as published by 
     10 *  the Free Software Foundation; version 2.0 of the license. 
    1111 * 
    1212 *  This program is distributed in the hope that it will be useful, 
     
    4242     else 
    4343     { 
    44        char path[512]; 
    45        snprintf (path, 512, "%s/%s", PIXMAP_PATH, item_new->icon_name); 
     44       char path[PATH_MAX]; 
     45       snprintf (path, PATH_MAX, "%s/%s", PIXMAP_PATH, item_new->icon_name); 
    4646       if (access (path, 0) == 0) 
    4747           menu_item = moko_build_new_menu_item (item_new->name, path); 
    4848       else 
    4949         { 
    50              snprintf (path, 512, "%s/%s", PKGDATADIR, "default-app-icon.xpm"); 
     50             snprintf (path, PATH_MAX, "%s/%s", PKGDATADIR, "default-app-icon.xpm"); 
    5151             menu_item = moko_build_new_menu_item (item_new->name, path); 
    5252             //moko_fill_model(self->list_store, path, item_new->name, item_new); 
     
    7070        else 
    7171        { 
    72           char path[512]; 
    73           snprintf (path, 512, "%s/%s", PIXMAP_PATH, tmp_item->icon_name); 
     72          char path[PATH_MAX]; 
     73          snprintf (path, PATH_MAX, "%s/%s", PIXMAP_PATH, tmp_item->icon_name); 
    7474          if (access (path, 0) == 0) 
    7575            menu_item = moko_build_new_menu_item (tmp_item->name, path); 
    7676          else 
    7777          { 
    78                 snprintf (path, 512, "%s/%s", PKGDATADIR, "default-app-icon.xpm"); 
     78                snprintf (path, PATH_MAX, "%s/%s", PKGDATADIR, "default-app-icon.xpm"); 
    7979                menu_item = moko_build_new_menu_item (tmp_item->name, path); 
    8080             //moko_fill_model(self->list_store, path, item_new->name, item_new); 
Note: See TracChangeset for help on using the changeset viewer.