summaryrefslogtreecommitdiffstatshomepage
path: root/src/tools
diff options
context:
space:
mode:
author Nathan Woods <npwoods@mess.org>2017-07-30 07:22:25 -0400
committer Vas Crabb <cuavas@users.noreply.github.com>2017-07-30 21:58:58 +1000
commitc04cc607020444609f49edb80912af75a627982b (patch)
tree6136711a52b9e2ca64a4c60a3366e0854ab04d08 /src/tools
parenta547f50134fadf31b5efa20a55e1daef44e466f4 (diff)
Imgtool: Eliminated Imgtool-specific rand() function
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/imgtool/imgtool.cpp16
-rw-r--r--src/tools/imgtool/imgtool.h1
-rw-r--r--src/tools/imgtool/modules/fat.cpp7
3 files changed, 5 insertions, 19 deletions
diff --git a/src/tools/imgtool/imgtool.cpp b/src/tools/imgtool/imgtool.cpp
index 15697f0dea4..f53c9e29810 100644
--- a/src/tools/imgtool/imgtool.cpp
+++ b/src/tools/imgtool/imgtool.cpp
@@ -542,22 +542,6 @@ void *imgtool::image::malloc(size_t size)
}
-//-------------------------------------------------
-// imgtool::image::rand - returns a random number
-//-------------------------------------------------
-
-uint64_t imgtool::image::rand()
-{
- // we can't use mame_rand() here
-#ifdef rand
-#undef rand
-#endif
- return ((uint64_t) std::rand()) << 32
- | ((uint64_t)std::rand()) << 0;
-}
-
-
-
/***************************************************************************
Imgtool partition management
diff --git a/src/tools/imgtool/imgtool.h b/src/tools/imgtool/imgtool.h
index 5b4879c2db8..1e973b30c70 100644
--- a/src/tools/imgtool/imgtool.h
+++ b/src/tools/imgtool/imgtool.h
@@ -104,7 +104,6 @@ namespace imgtool
static imgtoolerr_t create(const std::string &modulename, const std::string &filename, util::option_resolution *opts, ptr &image);
static imgtoolerr_t create(const imgtool_module *module, const std::string &filename, util::option_resolution *opts);
static imgtoolerr_t create(const std::string &modulename, const std::string &filename, util::option_resolution *opts);
- static uint64_t rand();
std::string info();
imgtoolerr_t get_geometry(uint32_t *tracks, uint32_t *heads, uint32_t *sectors);
diff --git a/src/tools/imgtool/modules/fat.cpp b/src/tools/imgtool/modules/fat.cpp
index a7fab14e029..aa15a4783f6 100644
--- a/src/tools/imgtool/modules/fat.cpp
+++ b/src/tools/imgtool/modules/fat.cpp
@@ -534,7 +534,10 @@ static imgtoolerr_t fat_partition_create(imgtool::image &image, uint64_t first_b
place_integer_le(header, 32, 4, (uint32_t) (block_count >> 16));
place_integer_le(header, 36, 1, 0xFF);
place_integer_le(header, 38, 1, 0x28);
- place_integer_le(header, 39, 4, imgtool::image::rand());
+ place_integer_le(header, 39, 1, std::rand());
+ place_integer_le(header, 40, 1, std::rand());
+ place_integer_le(header, 41, 1, std::rand());
+ place_integer_le(header, 42, 1, std::rand());
memcpy(&header[43], " ", 11);
memcpy(&header[54], fat_bits_string, 8);
@@ -1635,7 +1638,7 @@ static void fat_bump_dirent(imgtool::partition &partition, uint8_t *entry, size_
{
/* extreme degenerate case; simply randomize the filename */
for (i = 0; i < 6; i++)
- sfn_entry[i] = 'A' + (imgtool::image::rand() % 26);
+ sfn_entry[i] = 'A' + (std::rand() % 26);
sfn_entry[6] = '~';
sfn_entry[7] = '0';
}