summaryrefslogtreecommitdiff
path: root/src/bin/exactness
diff options
context:
space:
mode:
authorStefan Schmidt <s.schmidt@samsung.com>2020-03-03 17:36:15 +0100
committerStefan Schmidt <s.schmidt@samsung.com>2020-03-12 16:41:05 +0100
commit525113650d7551f57d1b7e2006fbb071232b0f5f (patch)
tree073b90f8cab35b2b744478b9f6529172fb8b104f /src/bin/exactness
parentf8299e054234d73ba27b0bf7a6a07120279c92f1 (diff)
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
Diffstat (limited to 'src/bin/exactness')
-rw-r--r--src/bin/exactness/exactness.c26
-rw-r--r--src/bin/exactness/player.c5
-rw-r--r--src/bin/exactness/recorder.c5
3 files changed, 16 insertions, 20 deletions
diff --git a/src/bin/exactness/exactness.c b/src/bin/exactness/exactness.c
index ebcae7f4a1..c594b28a60 100644
--- a/src/bin/exactness/exactness.c
+++ b/src/bin/exactness/exactness.c
@@ -19,8 +19,6 @@
19#define ORIG_SUBDIR "orig" 19#define ORIG_SUBDIR "orig"
20#define CURRENT_SUBDIR "current" 20#define CURRENT_SUBDIR "current"
21 21
22#define EXACTNESS_PATH_MAX 1024
23
24#define BUF_SIZE 1024 22#define BUF_SIZE 1024
25 23
26typedef struct 24typedef struct
@@ -144,7 +142,7 @@ _exu_imgs_unpack(const char *exu_path, const char *dir, const char *ent_name)
144 { 142 {
145 Eo *o = evas_object_image_add(e); 143 Eo *o = evas_object_image_add(e);
146 char *filename = alloca(strlen(dir) + strlen(ent_name) + 20); 144 char *filename = alloca(strlen(dir) + strlen(ent_name) + 20);
147 snprintf(filename, EXACTNESS_PATH_MAX, "%s/%s%c%.3d.png", 145 snprintf(filename, PATH_MAX, "%s/%s%c%.3d.png",
148 dir, ent_name, SHOT_DELIMITER, n++); 146 dir, ent_name, SHOT_DELIMITER, n++);
149 evas_object_image_size_set(o, img->w, img->h); 147 evas_object_image_size_set(o, img->w, img->h);
150 evas_object_image_data_set(o, img->pixels); 148 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)
161static void 159static void
162_run_test_compare(const List_Entry *ent) 160_run_test_compare(const List_Entry *ent)
163{ 161{
164 char *path = alloca(EXACTNESS_PATH_MAX); 162 char *path = alloca(PATH_MAX);
165 char *origdir = alloca(strlen(_dest_dir) + 20); 163 char *origdir = alloca(strlen(_dest_dir) + 20);
166 const char *base_dir; 164 const char *base_dir;
167 Eina_List *itr; 165 Eina_List *itr;
@@ -218,7 +216,7 @@ found:
218static Eina_Bool 216static Eina_Bool
219_run_command_prepare(const List_Entry *ent, char *buf) 217_run_command_prepare(const List_Entry *ent, char *buf)
220{ 218{
221 char scn_path[EXACTNESS_PATH_MAX]; 219 char scn_path[PATH_MAX];
222 Eina_Strbuf *sbuf; 220 Eina_Strbuf *sbuf;
223 const char *base_dir; 221 const char *base_dir;
224 Eina_List *itr; 222 Eina_List *itr;
@@ -464,7 +462,7 @@ main(int argc, char *argv[])
464 const char *list_file; 462 const char *list_file;
465 Eina_List *itr; 463 Eina_List *itr;
466 const char *base_dir; 464 const char *base_dir;
467 char tmp[EXACTNESS_PATH_MAX]; 465 char tmp[PATH_MAX];
468 Eina_Bool mode_play = EINA_FALSE, mode_init = EINA_FALSE, mode_simulation = EINA_FALSE; 466 Eina_Bool mode_play = EINA_FALSE, mode_init = EINA_FALSE, mode_simulation = EINA_FALSE;
469 Eina_Bool want_quit = EINA_FALSE, scan_objs = EINA_FALSE; 467 Eina_Bool want_quit = EINA_FALSE, scan_objs = EINA_FALSE;
470 Ecore_Getopt_Value values[] = { 468 Ecore_Getopt_Value values[] = {
@@ -548,8 +546,8 @@ main(int argc, char *argv[])
548 if (mode_play) 546 if (mode_play)
549 { 547 {
550 _mode = RUN_PLAY; 548 _mode = RUN_PLAY;
551 if (snprintf(tmp, EXACTNESS_PATH_MAX, "%s/%s", _dest_dir, CURRENT_SUBDIR) 549 if (snprintf(tmp, PATH_MAX, "%s/%s", _dest_dir, CURRENT_SUBDIR)
552 >= EXACTNESS_PATH_MAX) 550 >= PATH_MAX)
553 { 551 {
554 fprintf(stderr, "Path too long: %s", tmp); 552 fprintf(stderr, "Path too long: %s", tmp);
555 ret = 1; 553 ret = 1;
@@ -565,8 +563,8 @@ main(int argc, char *argv[])
565 else if (mode_init) 563 else if (mode_init)
566 { 564 {
567 _mode = RUN_INIT; 565 _mode = RUN_INIT;
568 if (snprintf(tmp, EXACTNESS_PATH_MAX, "%s/%s", _dest_dir, ORIG_SUBDIR) 566 if (snprintf(tmp, PATH_MAX, "%s/%s", _dest_dir, ORIG_SUBDIR)
569 >= EXACTNESS_PATH_MAX) 567 >= PATH_MAX)
570 { 568 {
571 fprintf(stderr, "Path too long: %s", tmp); 569 fprintf(stderr, "Path too long: %s", tmp);
572 ret = 1; 570 ret = 1;
@@ -614,9 +612,9 @@ main(int argc, char *argv[])
614 if (_errors || _compare_errors) 612 if (_errors || _compare_errors)
615 { 613 {
616 FILE *report_file; 614 FILE *report_file;
617 char report_filename[EXACTNESS_PATH_MAX] = ""; 615 char report_filename[PATH_MAX] = "";
618 /* Generate the filename. */ 616 /* Generate the filename. */
619 snprintf(report_filename, EXACTNESS_PATH_MAX, 617 snprintf(report_filename, PATH_MAX,
620 "%s/%s/errors.html", 618 "%s/%s/errors.html",
621 _dest_dir, mode_init ? ORIG_SUBDIR : CURRENT_SUBDIR); 619 _dest_dir, mode_init ? ORIG_SUBDIR : CURRENT_SUBDIR);
622 report_file = fopen(report_filename, "w+"); 620 report_file = fopen(report_filename, "w+");
@@ -650,8 +648,8 @@ main(int argc, char *argv[])
650 EINA_LIST_FREE(_compare_errors, test_name) 648 EINA_LIST_FREE(_compare_errors, test_name)
651 { 649 {
652 Eina_Bool is_from_exu; 650 Eina_Bool is_from_exu;
653 char origpath[EXACTNESS_PATH_MAX]; 651 char origpath[PATH_MAX];
654 snprintf(origpath, EXACTNESS_PATH_MAX, "%s/%s/orig/%s", 652 snprintf(origpath, PATH_MAX, "%s/%s/orig/%s",
655 _dest_dir, CURRENT_SUBDIR, test_name); 653 _dest_dir, CURRENT_SUBDIR, test_name);
656 is_from_exu = ecore_file_exists(origpath); 654 is_from_exu = ecore_file_exists(origpath);
657 printf("\t* %s\n", test_name); 655 printf("\t* %s\n", test_name);
diff --git a/src/bin/exactness/player.c b/src/bin/exactness/player.c
index 9e5629aa5b..b11a843205 100644
--- a/src/bin/exactness/player.c
+++ b/src/bin/exactness/player.c
@@ -32,7 +32,6 @@
32#include "exactness_private.h" 32#include "exactness_private.h"
33#include "common.h" 33#include "common.h"
34 34
35#define PATH_ 1024
36#define CMD_LINE_MAX 256 35#define CMD_LINE_MAX 256
37#define IMAGE_FILENAME_EXT ".png" 36#define IMAGE_FILENAME_EXT ".png"
38#define PAUSE_KEY_STR "F2" 37#define PAUSE_KEY_STR "F2"
@@ -941,7 +940,7 @@ _prg_invoke(const char *full_path, int argc, char **argv)
941static Eina_Stringshare * 940static Eina_Stringshare *
942_prg_full_path_guess(const char *prg) 941_prg_full_path_guess(const char *prg)
943{ 942{
944 char full_path[PATH_]; 943 char full_path[PATH_MAX];
945 if (strchr(prg, '/')) return eina_stringshare_add(prg); 944 if (strchr(prg, '/')) return eina_stringshare_add(prg);
946 char *env_path = eina_strdup(getenv("PATH")); 945 char *env_path = eina_strdup(getenv("PATH"));
947 Eina_Stringshare *ret = NULL; 946 Eina_Stringshare *ret = NULL;
@@ -1232,7 +1231,7 @@ int main(int argc, char **argv)
1232 if (!show_on_screen) setenv("ELM_ENGINE", "buffer", 1); 1231 if (!show_on_screen) setenv("ELM_ENGINE", "buffer", 1);
1233 if (_src_unit && _src_unit->fonts_path) 1232 if (_src_unit && _src_unit->fonts_path)
1234 { 1233 {
1235 char buf[PATH_]; 1234 char buf[PATH_MAX];
1236 if (!fonts_dir) fonts_dir = "./fonts"; 1235 if (!fonts_dir) fonts_dir = "./fonts";
1237 sprintf(buf, "%s/%s", fonts_dir, _src_unit->fonts_path); 1236 sprintf(buf, "%s/%s", fonts_dir, _src_unit->fonts_path);
1238 if (!ecore_file_exists(buf)) 1237 if (!ecore_file_exists(buf))
diff --git a/src/bin/exactness/recorder.c b/src/bin/exactness/recorder.c
index 812ef737e7..f8eefe591e 100644
--- a/src/bin/exactness/recorder.c
+++ b/src/bin/exactness/recorder.c
@@ -25,7 +25,6 @@
25#include <exactness_private.h> 25#include <exactness_private.h>
26#include "common.h" 26#include "common.h"
27 27
28#define MAX_PATH 1024
29#define STABILIZE_KEY_STR "F1" 28#define STABILIZE_KEY_STR "F1"
30#define SHOT_KEY_STR "F2" 29#define SHOT_KEY_STR "F2"
31#define SAVE_KEY_STR "F3" 30#define SAVE_KEY_STR "F3"
@@ -293,7 +292,7 @@ _prg_invoke(const char *full_path, int argc, char **argv)
293static Eina_Stringshare * 292static Eina_Stringshare *
294_prg_full_path_guess(const char *prg) 293_prg_full_path_guess(const char *prg)
295{ 294{
296 char full_path[MAX_PATH]; 295 char full_path[PATH_MAX];
297 if (strchr(prg, '/')) return eina_stringshare_add(prg); 296 if (strchr(prg, '/')) return eina_stringshare_add(prg);
298 char *env_path = eina_strdup(getenv("PATH")); 297 char *env_path = eina_strdup(getenv("PATH"));
299 Eina_Stringshare *ret = NULL; 298 Eina_Stringshare *ret = NULL;
@@ -483,7 +482,7 @@ int main(int argc, char **argv)
483 /* Replace the current command line to hide the Exactness part */ 482 /* Replace the current command line to hide the Exactness part */
484 int len = argv[argc - 1] + strlen(argv[argc - 1]) - argv[opt_args]; 483 int len = argv[argc - 1] + strlen(argv[argc - 1]) - argv[opt_args];
485 memcpy(argv[0], argv[opt_args], len); 484 memcpy(argv[0], argv[opt_args], len);
486 memset(argv[0] + len, 0, MAX_PATH - len); 485 memset(argv[0] + len, 0, PATH_MAX - len);
487 486
488 int i; 487 int i;
489 for (i = opt_args; i < argc; i++) 488 for (i = opt_args; i < argc; i++)