mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-31 04:56:20 +00:00
[Repositories] Add more precise types to repository generator (#2391)
* Make utils/scripts/generators/repository-generator.pl aware of more datatypes This adds support for unsigned and more integer types. It also avoids using parsing functions that require casting (still needed in some cases) Having the data types in the Repository structs better map to the types in the database will allow us to avoid casting when we pull data out of them. And as a benefit, assume something is wrong if we do :) Hopefully clean up some warnings due to casting too. Co-authored-by: Akkadius <akkadius1@gmail.com>
This commit is contained in:
committed by
GitHub
parent
fcf01f6d87
commit
6f7fa98996
@@ -19,12 +19,12 @@
|
||||
class BaseSharedTasksRepository {
|
||||
public:
|
||||
struct SharedTasks {
|
||||
int64 id;
|
||||
int task_id;
|
||||
time_t accepted_time;
|
||||
time_t expire_time;
|
||||
time_t completion_time;
|
||||
int is_locked;
|
||||
int64_t id;
|
||||
int32_t task_id;
|
||||
time_t accepted_time;
|
||||
time_t expire_time;
|
||||
time_t completion_time;
|
||||
int8_t is_locked;
|
||||
};
|
||||
|
||||
static std::string PrimaryKey()
|
||||
@@ -135,11 +135,11 @@ public:
|
||||
SharedTasks e{};
|
||||
|
||||
e.id = strtoll(row[0], nullptr, 10);
|
||||
e.task_id = atoi(row[1]);
|
||||
e.task_id = static_cast<int32_t>(atoi(row[1]));
|
||||
e.accepted_time = strtoll(row[2] ? row[2] : "-1", nullptr, 10);
|
||||
e.expire_time = strtoll(row[3] ? row[3] : "-1", nullptr, 10);
|
||||
e.completion_time = strtoll(row[4] ? row[4] : "-1", nullptr, 10);
|
||||
e.is_locked = atoi(row[5]);
|
||||
e.is_locked = static_cast<int8_t>(atoi(row[5]));
|
||||
|
||||
return e;
|
||||
}
|
||||
@@ -274,11 +274,11 @@ public:
|
||||
SharedTasks e{};
|
||||
|
||||
e.id = strtoll(row[0], nullptr, 10);
|
||||
e.task_id = atoi(row[1]);
|
||||
e.task_id = static_cast<int32_t>(atoi(row[1]));
|
||||
e.accepted_time = strtoll(row[2] ? row[2] : "-1", nullptr, 10);
|
||||
e.expire_time = strtoll(row[3] ? row[3] : "-1", nullptr, 10);
|
||||
e.completion_time = strtoll(row[4] ? row[4] : "-1", nullptr, 10);
|
||||
e.is_locked = atoi(row[5]);
|
||||
e.is_locked = static_cast<int8_t>(atoi(row[5]));
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -304,11 +304,11 @@ public:
|
||||
SharedTasks e{};
|
||||
|
||||
e.id = strtoll(row[0], nullptr, 10);
|
||||
e.task_id = atoi(row[1]);
|
||||
e.task_id = static_cast<int32_t>(atoi(row[1]));
|
||||
e.accepted_time = strtoll(row[2] ? row[2] : "-1", nullptr, 10);
|
||||
e.expire_time = strtoll(row[3] ? row[3] : "-1", nullptr, 10);
|
||||
e.completion_time = strtoll(row[4] ? row[4] : "-1", nullptr, 10);
|
||||
e.is_locked = atoi(row[5]);
|
||||
e.is_locked = static_cast<int8_t>(atoi(row[5]));
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user