Skip to content

Commit e61c527

Browse files
brad-richardsonReenigneArcher
authored andcommitted
Use signed int32
1 parent f22a0de commit e61c527

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

src/confighttp.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -311,9 +311,8 @@ void saveApp(resp_https_t response, req_https_t request) {
311311
pt::read_json(config::stream.file_apps, fileTree);
312312

313313
// Moonlight checks the id of an item to determine if an item was changed
314-
// Add a property named "id" to the inputTree with a random id (min of 1 as "0" indicates no app running)
315-
// Fixed to 32-bit integer because some Moonlight clients cannot accept more than that
316-
inputTree.put("id", util::generate_uint32(1, std::numeric_limits<std::uint32_t>::max()));
314+
// Needs to be 32-bit positive, signed integer due to client limitations (min of 1 as "0" indicates no app running)
315+
inputTree.put("id", util::generate_int32(1, std::numeric_limits<std::int32_t>::max()));
317316

318317
if(inputTree.get_child("prep-cmd").empty()) {
319318
inputTree.erase("prep-cmd");

src/rand.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,18 @@
55

66
namespace util {
77

8-
static uint32_t generate_uint32(std::default_random_engine &engine, uint32_t min, uint32_t max) {
9-
std::uniform_int_distribution<std::uint32_t> dist(min, max);
8+
static int32_t generate_int32(std::default_random_engine &engine, int32_t min, int32_t max) {
9+
std::uniform_int_distribution<std::int32_t> dist(min, max);
1010

1111
return dist(engine);
1212
}
1313

14-
static uint32_t generate_uint32(uint32_t min, uint32_t max) {
14+
static int32_t generate_int32(int32_t min, int32_t max) {
1515
std::random_device r;
1616

1717
std::default_random_engine engine { r() };
1818

19-
return util::generate_uint32(engine, min, max);
19+
return util::generate_int32(engine, min, max);
2020
}
2121

2222
} // namespace util

0 commit comments

Comments
 (0)