From 2e198fd2efee9229f1412fef165e4bd7bd7298d5 Mon Sep 17 00:00:00 2001 From: rdb Date: Fri, 6 Sep 2019 11:55:17 +0200 Subject: [PATCH] downloadertools: remove check_adler, check_md5, check_crc Tools to check hashes are readily available from thirdparty sources; there is no good reason why a 3D engine should provide them. --- makepanda/makepanda.py | 18 +-- makepanda/makepanda.vcproj | 3 - panda/src/downloadertools/check_adler.cxx | 26 ---- panda/src/downloadertools/check_crc.cxx | 26 ---- panda/src/downloadertools/check_md5.cxx | 155 ---------------------- 5 files changed, 1 insertion(+), 227 deletions(-) delete mode 100644 panda/src/downloadertools/check_adler.cxx delete mode 100644 panda/src/downloadertools/check_crc.cxx delete mode 100644 panda/src/downloadertools/check_md5.cxx diff --git a/makepanda/makepanda.py b/makepanda/makepanda.py index 436b64a9c6..c1f1056a1b 100755 --- a/makepanda/makepanda.py +++ b/makepanda/makepanda.py @@ -4603,23 +4603,7 @@ if PkgSkip("OPENAL") == 0 and not RUNTIME: # if (PkgSkip("OPENSSL")==0 and not RTDIST and not RUNTIME and PkgSkip("DEPLOYTOOLS")==0): - OPTS=['DIR:panda/src/downloadertools', 'OPENSSL', 'ZLIB', 'ADVAPI', 'WINSOCK2', 'WINSHELL', 'WINGDI', 'WINUSER'] - - if not PkgSkip("ZLIB"): - TargetAdd('check_adler_check_adler.obj', opts=OPTS, input='check_adler.cxx') - TargetAdd('check_adler.exe', input=['check_adler_check_adler.obj']) - TargetAdd('check_adler.exe', input=COMMON_PANDA_LIBS) - TargetAdd('check_adler.exe', opts=OPTS) - - TargetAdd('check_crc_check_crc.obj', opts=OPTS, input='check_crc.cxx') - TargetAdd('check_crc.exe', input=['check_crc_check_crc.obj']) - TargetAdd('check_crc.exe', input=COMMON_PANDA_LIBS) - TargetAdd('check_crc.exe', opts=OPTS) - - TargetAdd('check_md5_check_md5.obj', opts=OPTS, input='check_md5.cxx') - TargetAdd('check_md5.exe', input=['check_md5_check_md5.obj']) - TargetAdd('check_md5.exe', input=COMMON_PANDA_LIBS) - TargetAdd('check_md5.exe', opts=OPTS) + OPTS=['DIR:panda/src/downloadertools', 'OPENSSL', 'ADVAPI', 'WINSOCK2', 'WINSHELL', 'WINGDI', 'WINUSER'] TargetAdd('pdecrypt_pdecrypt.obj', opts=OPTS, input='pdecrypt.cxx') TargetAdd('pdecrypt.exe', input=['pdecrypt_pdecrypt.obj']) diff --git a/makepanda/makepanda.vcproj b/makepanda/makepanda.vcproj index f8825312b0..1cbb36aba6 100644 --- a/makepanda/makepanda.vcproj +++ b/makepanda/makepanda.vcproj @@ -2080,12 +2080,9 @@ - - - diff --git a/panda/src/downloadertools/check_adler.cxx b/panda/src/downloadertools/check_adler.cxx deleted file mode 100644 index dbea94f8b7..0000000000 --- a/panda/src/downloadertools/check_adler.cxx +++ /dev/null @@ -1,26 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file check_adler.cxx - */ - -#include "download_utils.h" - -int -main(int argc, char *argv[]) { - if (argc < 2) { - std::cerr << "Usage: check_adler " << std::endl; - return 1; - } - - Filename source_file = argv[1]; - - std::cout << check_adler(source_file); - - return 0; -} diff --git a/panda/src/downloadertools/check_crc.cxx b/panda/src/downloadertools/check_crc.cxx deleted file mode 100644 index e98de20b57..0000000000 --- a/panda/src/downloadertools/check_crc.cxx +++ /dev/null @@ -1,26 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file check_crc.cxx - */ - -#include "download_utils.h" - -int -main(int argc, char *argv[]) { - if (argc < 2) { - std::cerr << "Usage: check_crc " << std::endl; - return 1; - } - - Filename source_file = argv[1]; - - std::cout << check_crc(source_file); - - return 0; -} diff --git a/panda/src/downloadertools/check_md5.cxx b/panda/src/downloadertools/check_md5.cxx deleted file mode 100644 index 2cc3ce508e..0000000000 --- a/panda/src/downloadertools/check_md5.cxx +++ /dev/null @@ -1,155 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file check_md5.cxx - */ - -#include "pandabase.h" -#include "hashVal.h" -#include "filename.h" -#include "panda_getopt.h" -#include "preprocess_argv.h" - -using std::cerr; -using std::cout; - -bool output_decimal = false; -bool suppress_filename = false; -pofstream binary_output; - -void -usage() { - cerr << - "\n" - "Usage:\n\n" - "check_md5 [-q] [-d] [-b filename] [-i \"input string\"] [file1 file2 ...]\n" - "check_md5 -h\n\n"; -} - -void -help() { - usage(); - cerr << - "This program outputs the MD5 hash of one or more files (or of a string\n" - "passed on the command line with -i).\n\n" - - "An MD5 hash is a 128-bit value. The output is presented as a 32-digit\n" - "hexadecimal string by default, but with -d, it is presented as four\n" - "big-endian unsigned 32-bit decimal integers. Normally the filename\n" - "of each file is printed along with the hash; -q suppresses this.\n\n" - - "To write the 16 bytes (per input file) of the output directly to a\n" - "binary file, use -b with the name of the file to receive the output.\n"; -} - -void -output_hash(const std::string &filename, const HashVal &hash) { - if (!suppress_filename && !filename.empty()) { - cout << filename << " "; - } - if (output_decimal) { - hash.output_dec(cout); - } else { - hash.output_hex(cout); - } - cout << "\n"; - - // Also output to the binary_output file if it is open. No sweat if it's - // not. - hash.output_binary(binary_output); -} - - -int -main(int argc, char **argv) { - extern char *optarg; - extern int optind; - const char *optstr = "i:db:qh"; - - bool got_input_string = false; - std::string input_string; - Filename binary_output_filename; - - preprocess_argv(argc, argv); - int flag = getopt(argc, argv, optstr); - - while (flag != EOF) { - switch (flag) { - case 'i': - got_input_string = true; - input_string = optarg; - break; - - case 'd': - output_decimal = true; - break; - - case 'b': - binary_output_filename = Filename::binary_filename(std::string(optarg)); - break; - - case 'q': - suppress_filename = true; - break; - - case 'h': - help(); - exit(1); - - default: - exit(1); - } - flag = getopt(argc, argv, optstr); - } - - argc -= (optind-1); - argv += (optind-1); - - if (argc < 2 && !got_input_string) { - usage(); - exit(1); - } - - if (!binary_output_filename.empty()) { - if (!binary_output_filename.open_write(binary_output)) { - cerr << "Unable to open " << binary_output_filename << ".\n"; - exit(1); - } - } - - if (got_input_string) { - HashVal hash; - hash.hash_string(input_string); - output_hash("", hash); - } - - bool okflag = true; - - for (int i = 1; i < argc; i++) { - Filename source_file = Filename::from_os_specific(argv[i]); - - if (!source_file.exists()) { - cerr << source_file << " not found!\n"; - okflag = false; - } else { - HashVal hash; - if (!hash.hash_file(source_file)) { - cerr << "Unable to read " << source_file << "\n"; - okflag = false; - } else { - output_hash(source_file.get_basename(), hash); - } - } - } - - if (!okflag) { - exit(1); - } - - return 0; -}