forked from enlightenment/efl
exactness: hamonize use of PATH_MAX as maximal path length allowed
There have been to many different defines for this in exactness. Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com> Differential Revision: https://phab.enlightenment.org/D11457
This commit is contained in:
parent
f8299e0542
commit
525113650d
|
@ -19,8 +19,6 @@
|
|||
#define ORIG_SUBDIR "orig"
|
||||
#define CURRENT_SUBDIR "current"
|
||||
|
||||
#define EXACTNESS_PATH_MAX 1024
|
||||
|
||||
#define BUF_SIZE 1024
|
||||
|
||||
typedef struct
|
||||
|
@ -144,7 +142,7 @@ _exu_imgs_unpack(const char *exu_path, const char *dir, const char *ent_name)
|
|||
{
|
||||
Eo *o = evas_object_image_add(e);
|
||||
char *filename = alloca(strlen(dir) + strlen(ent_name) + 20);
|
||||
snprintf(filename, EXACTNESS_PATH_MAX, "%s/%s%c%.3d.png",
|
||||
snprintf(filename, PATH_MAX, "%s/%s%c%.3d.png",
|
||||
dir, ent_name, SHOT_DELIMITER, n++);
|
||||
evas_object_image_size_set(o, img->w, img->h);
|
||||
evas_object_image_data_set(o, img->pixels);
|
||||
|
@ -161,7 +159,7 @@ _exu_imgs_unpack(const char *exu_path, const char *dir, const char *ent_name)
|
|||
static void
|
||||
_run_test_compare(const List_Entry *ent)
|
||||
{
|
||||
char *path = alloca(EXACTNESS_PATH_MAX);
|
||||
char *path = alloca(PATH_MAX);
|
||||
char *origdir = alloca(strlen(_dest_dir) + 20);
|
||||
const char *base_dir;
|
||||
Eina_List *itr;
|
||||
|
@ -218,7 +216,7 @@ found:
|
|||
static Eina_Bool
|
||||
_run_command_prepare(const List_Entry *ent, char *buf)
|
||||
{
|
||||
char scn_path[EXACTNESS_PATH_MAX];
|
||||
char scn_path[PATH_MAX];
|
||||
Eina_Strbuf *sbuf;
|
||||
const char *base_dir;
|
||||
Eina_List *itr;
|
||||
|
@ -464,7 +462,7 @@ main(int argc, char *argv[])
|
|||
const char *list_file;
|
||||
Eina_List *itr;
|
||||
const char *base_dir;
|
||||
char tmp[EXACTNESS_PATH_MAX];
|
||||
char tmp[PATH_MAX];
|
||||
Eina_Bool mode_play = EINA_FALSE, mode_init = EINA_FALSE, mode_simulation = EINA_FALSE;
|
||||
Eina_Bool want_quit = EINA_FALSE, scan_objs = EINA_FALSE;
|
||||
Ecore_Getopt_Value values[] = {
|
||||
|
@ -548,8 +546,8 @@ main(int argc, char *argv[])
|
|||
if (mode_play)
|
||||
{
|
||||
_mode = RUN_PLAY;
|
||||
if (snprintf(tmp, EXACTNESS_PATH_MAX, "%s/%s", _dest_dir, CURRENT_SUBDIR)
|
||||
>= EXACTNESS_PATH_MAX)
|
||||
if (snprintf(tmp, PATH_MAX, "%s/%s", _dest_dir, CURRENT_SUBDIR)
|
||||
>= PATH_MAX)
|
||||
{
|
||||
fprintf(stderr, "Path too long: %s", tmp);
|
||||
ret = 1;
|
||||
|
@ -565,8 +563,8 @@ main(int argc, char *argv[])
|
|||
else if (mode_init)
|
||||
{
|
||||
_mode = RUN_INIT;
|
||||
if (snprintf(tmp, EXACTNESS_PATH_MAX, "%s/%s", _dest_dir, ORIG_SUBDIR)
|
||||
>= EXACTNESS_PATH_MAX)
|
||||
if (snprintf(tmp, PATH_MAX, "%s/%s", _dest_dir, ORIG_SUBDIR)
|
||||
>= PATH_MAX)
|
||||
{
|
||||
fprintf(stderr, "Path too long: %s", tmp);
|
||||
ret = 1;
|
||||
|
@ -614,9 +612,9 @@ main(int argc, char *argv[])
|
|||
if (_errors || _compare_errors)
|
||||
{
|
||||
FILE *report_file;
|
||||
char report_filename[EXACTNESS_PATH_MAX] = "";
|
||||
char report_filename[PATH_MAX] = "";
|
||||
/* Generate the filename. */
|
||||
snprintf(report_filename, EXACTNESS_PATH_MAX,
|
||||
snprintf(report_filename, PATH_MAX,
|
||||
"%s/%s/errors.html",
|
||||
_dest_dir, mode_init ? ORIG_SUBDIR : CURRENT_SUBDIR);
|
||||
report_file = fopen(report_filename, "w+");
|
||||
|
@ -650,8 +648,8 @@ main(int argc, char *argv[])
|
|||
EINA_LIST_FREE(_compare_errors, test_name)
|
||||
{
|
||||
Eina_Bool is_from_exu;
|
||||
char origpath[EXACTNESS_PATH_MAX];
|
||||
snprintf(origpath, EXACTNESS_PATH_MAX, "%s/%s/orig/%s",
|
||||
char origpath[PATH_MAX];
|
||||
snprintf(origpath, PATH_MAX, "%s/%s/orig/%s",
|
||||
_dest_dir, CURRENT_SUBDIR, test_name);
|
||||
is_from_exu = ecore_file_exists(origpath);
|
||||
printf("\t* %s\n", test_name);
|
||||
|
|
|
@ -32,7 +32,6 @@
|
|||
#include "exactness_private.h"
|
||||
#include "common.h"
|
||||
|
||||
#define PATH_ 1024
|
||||
#define CMD_LINE_MAX 256
|
||||
#define IMAGE_FILENAME_EXT ".png"
|
||||
#define PAUSE_KEY_STR "F2"
|
||||
|
@ -941,7 +940,7 @@ _prg_invoke(const char *full_path, int argc, char **argv)
|
|||
static Eina_Stringshare *
|
||||
_prg_full_path_guess(const char *prg)
|
||||
{
|
||||
char full_path[PATH_];
|
||||
char full_path[PATH_MAX];
|
||||
if (strchr(prg, '/')) return eina_stringshare_add(prg);
|
||||
char *env_path = eina_strdup(getenv("PATH"));
|
||||
Eina_Stringshare *ret = NULL;
|
||||
|
@ -1232,7 +1231,7 @@ int main(int argc, char **argv)
|
|||
if (!show_on_screen) setenv("ELM_ENGINE", "buffer", 1);
|
||||
if (_src_unit && _src_unit->fonts_path)
|
||||
{
|
||||
char buf[PATH_];
|
||||
char buf[PATH_MAX];
|
||||
if (!fonts_dir) fonts_dir = "./fonts";
|
||||
sprintf(buf, "%s/%s", fonts_dir, _src_unit->fonts_path);
|
||||
if (!ecore_file_exists(buf))
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
#include <exactness_private.h>
|
||||
#include "common.h"
|
||||
|
||||
#define MAX_PATH 1024
|
||||
#define STABILIZE_KEY_STR "F1"
|
||||
#define SHOT_KEY_STR "F2"
|
||||
#define SAVE_KEY_STR "F3"
|
||||
|
@ -293,7 +292,7 @@ _prg_invoke(const char *full_path, int argc, char **argv)
|
|||
static Eina_Stringshare *
|
||||
_prg_full_path_guess(const char *prg)
|
||||
{
|
||||
char full_path[MAX_PATH];
|
||||
char full_path[PATH_MAX];
|
||||
if (strchr(prg, '/')) return eina_stringshare_add(prg);
|
||||
char *env_path = eina_strdup(getenv("PATH"));
|
||||
Eina_Stringshare *ret = NULL;
|
||||
|
@ -483,7 +482,7 @@ int main(int argc, char **argv)
|
|||
/* Replace the current command line to hide the Exactness part */
|
||||
int len = argv[argc - 1] + strlen(argv[argc - 1]) - argv[opt_args];
|
||||
memcpy(argv[0], argv[opt_args], len);
|
||||
memset(argv[0] + len, 0, MAX_PATH - len);
|
||||
memset(argv[0] + len, 0, PATH_MAX - len);
|
||||
|
||||
int i;
|
||||
for (i = opt_args; i < argc; i++)
|
||||
|
|
Loading…
Reference in New Issue