Revision: 77274
http://sourceforge.net/p/brlcad/code/77274
Author: brlcad
Date: 2020-09-29 18:32:46 +0000 (Tue, 29 Sep 2020)
Log Message:
-----------
the size check was wrong if the skip option is being used. set the stage for
this being advisory since we certainly can compare different size images.
Modified Paths:
--------------
brlcad/trunk/bench/pixcmp.c
Modified: brlcad/trunk/bench/pixcmp.c
===================================================================
--- brlcad/trunk/bench/pixcmp.c 2020-09-29 18:09:58 UTC (rev 77273)
+++ brlcad/trunk/bench/pixcmp.c 2020-09-29 18:32:46 UTC (rev 77274)
@@ -191,6 +191,10 @@
}
/* printf("Skip from FILE1: %ld and from FILE2: %ld\n", f1_skip, f2_skip);
*/
+ if (!print_bytes) {
+ f1_skip *= 3;
+ f2_skip *= 3;
+ }
if (BU_STR_EQUAL(argv[0], "-")) {
f1 = stdin;
@@ -205,18 +209,25 @@
exit(FILE_ERROR);
}
- stat(argv[0], &sf1);
- stat(argv[1], &sf2);
+ fstat(fileno(f1), &sf1);
+ fstat(fileno(f2), &sf2);
- if (sf1.st_size != sf2.st_size) {
- bu_exit(FILE_ERROR, "Different file sizes found: %s(%d) and %s(%d).
Cannot perform pixcmp.\n", argv[0], (int)sf1.st_size, argv[1],
(int)sf2.st_size);
+ if ((sf1.st_size - f1_skip) != (sf2.st_size - f2_skip)) {
+ bu_log("WARNING: Different image sizes detected\n");
+ if (print_bytes) {
+ bu_log("\t%s: %7zu bytes (%8zu bytes, skipping %7zu)\n",
+ argv[0], sf1.st_size - f1_skip, sf1.st_size, f1_skip);
+ bu_log("\t%s: %7zu bytes (%8zu bytes, skipping %7zu)\n",
+ argv[1], sf2.st_size - f2_skip, sf2.st_size, f2_skip);
+ } else {
+ bu_log("\t%s: %7zu pixels (%8zu bytes, skipping %7zu)\n",
+ argv[0], (sf1.st_size - f1_skip)/3, sf1.st_size, f1_skip);
+ bu_log("\t%s: %7zu pixels (%8zu bytes, skipping %7zu)\n",
+ argv[1], (sf2.st_size - f2_skip)/3, sf2.st_size, f2_skip);
+ }
+ bu_exit(1, "ERROR: Cannot pixcmp due to different images sizes
(unimplemented).\n");
}
- if (!print_bytes) {
- f1_skip *= 3;
- f2_skip *= 3;
- }
-
/* skip requested pixels/bytes in FILE1 */
if (f1_skip && fseek(f1, f1_skip, SEEK_SET)) {
bu_log("ERROR: Unable to seek %zd %s%s in FILE1\n",
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits