mirror of
https://github.com/ModOrganizer2/libbsarch.git
synced 2026-07-27 14:06:31 -07:00
Add pre-commit hook and Github action to check formatting.
This commit is contained in:
+3
-3
@@ -19,7 +19,7 @@ AlwaysBreakBeforeMultilineStrings: false
|
||||
AlwaysBreakTemplateDeclarations: Yes
|
||||
BinPackArguments: false
|
||||
BinPackParameters: false
|
||||
BraceWrapping:
|
||||
BraceWrapping:
|
||||
AfterClass: true
|
||||
AfterControlStatement: true
|
||||
AfterEnum: true
|
||||
@@ -55,13 +55,13 @@ DerivePointerAlignment: false
|
||||
DisableFormat: false
|
||||
ExperimentalAutoDetectBinPacking: false
|
||||
FixNamespaceComments: true
|
||||
ForEachMacros:
|
||||
ForEachMacros:
|
||||
- forever
|
||||
- foreach
|
||||
- Q_FOREACH
|
||||
- BOOST_FOREACH
|
||||
IncludeBlocks: Preserve
|
||||
IncludeCategories:
|
||||
IncludeCategories:
|
||||
- Regex: '^<Q.*'
|
||||
Priority: 200
|
||||
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
# Set the default behavior, in case people don't have core.autocrlf set.
|
||||
* text=auto
|
||||
|
||||
# Explicitly declare text files you want to always be normalized and converted
|
||||
# to native line endings on checkout.
|
||||
*.cpp text eol=crlf
|
||||
*.h text eol=crlf
|
||||
@@ -0,0 +1,17 @@
|
||||
name: Lint libbsarch
|
||||
|
||||
on:
|
||||
push:
|
||||
pull_request:
|
||||
types: [opened, synchronize, reopened]
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Check format
|
||||
uses: ModOrganizer2/check-formatting-action@master
|
||||
with:
|
||||
check-path: "."
|
||||
exclude-regex: "third-party"
|
||||
@@ -0,0 +1,20 @@
|
||||
repos:
|
||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||
rev: v5.0.0
|
||||
hooks:
|
||||
- id: trailing-whitespace
|
||||
- id: end-of-file-fixer
|
||||
- id: check-merge-conflict
|
||||
- id: check-case-conflict
|
||||
- repo: https://github.com/pre-commit/mirrors-clang-format
|
||||
rev: v19.1.5
|
||||
hooks:
|
||||
- id: clang-format
|
||||
'types_or': [c++, c]
|
||||
|
||||
ci:
|
||||
autofix_commit_msg: "[pre-commit.ci] Auto fixes from pre-commit.com hooks."
|
||||
autofix_prs: true
|
||||
autoupdate_commit_msg: "[pre-commit.ci] Pre-commit autoupdate."
|
||||
autoupdate_schedule: quarterly
|
||||
submodules: false
|
||||
@@ -20,7 +20,7 @@ type
|
||||
TwbBSResultMessageBuffer = packed record
|
||||
buffer: TwbBSResultBuffer;
|
||||
message: TwbBSResultMessage;
|
||||
end;
|
||||
end;
|
||||
|
||||
{Shared}
|
||||
|
||||
|
||||
@@ -62,17 +62,17 @@ public:
|
||||
void *context)
|
||||
{
|
||||
const auto &path = *static_cast<convertible_string *>(context) + '/' + convertible_string(file_path);
|
||||
|
||||
|
||||
auto image = std::make_unique<DirectX::ScratchImage>();
|
||||
DirectX::TexMetadata info;
|
||||
|
||||
|
||||
const auto hr = LoadFromDDSFile(PREPARE_PATH_LIBBSARCH(path), DirectX::DDS_FLAGS_BAD_DXTN_TAILS, &info, *image);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
//Do not throw here. Exceptions will be ignored
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
dds_info->width = info.width;
|
||||
dds_info->height = info.height;
|
||||
dds_info->mipmaps = info.mipLevels;
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
namespace libbsarch {
|
||||
/*!
|
||||
* \brief The bs_archive_auto class is a convenience class. It manages both bs_archive and bs_archive_entries.
|
||||
* \brief The bs_archive_auto class is a convenience class. It manages both bs_archive and bs_archive_entries.
|
||||
* It is recommended when packing from disk/extracting to disk
|
||||
* Otherwise, if using memory, the use of these two separate classes is recommended
|
||||
*/
|
||||
|
||||
@@ -69,14 +69,12 @@ void bs_archive_auto::save_to_disk(const convertible_string &archive_path)
|
||||
{
|
||||
switch (file.data.index())
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
case 0: {
|
||||
const auto &blob = std::get<memory_blob>(file.data);
|
||||
bs_archive::add_file_from_memory(file.path_in_archive, blob);
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
case 1: {
|
||||
const auto &file_path = std::get<convertible_string>(file.data);
|
||||
const auto &blob = disk_blob(file.path_in_archive, file_path, bool());
|
||||
bs_archive::add_file_from_disk(blob);
|
||||
|
||||
@@ -3,8 +3,7 @@
|
||||
namespace libbsarch {
|
||||
bs_archive_entries::bs_archive_entries()
|
||||
: _entries(bsa_entry_list_create())
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
bs_archive_entries::bs_archive_entries(const std::vector<convertible_string> &entries)
|
||||
: _entries(bsa_entry_list_create())
|
||||
@@ -15,8 +14,7 @@ bs_archive_entries::bs_archive_entries(const std::vector<convertible_string> &en
|
||||
|
||||
bs_archive_entries::bs_archive_entries(const bsa_entry_list_t &entries)
|
||||
: _entries(entries)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
bs_archive_entries::~bs_archive_entries()
|
||||
{
|
||||
|
||||
+127
-75
@@ -3,152 +3,204 @@
|
||||
|
||||
namespace libbsarch {
|
||||
|
||||
BSARCH_DLL_API(bsa_entry_list_t) bsa_entry_list_create() {
|
||||
return NULL;
|
||||
BSARCH_DLL_API(bsa_entry_list_t) bsa_entry_list_create()
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
BSARCH_DLL_API(bsa_result_message_t) bsa_entry_list_free(bsa_entry_list_t entry_list) {
|
||||
return { 0 };
|
||||
BSARCH_DLL_API(bsa_result_message_t) bsa_entry_list_free(bsa_entry_list_t entry_list)
|
||||
{
|
||||
return {0};
|
||||
}
|
||||
|
||||
BSARCH_DLL_API(uint32_t) bsa_entry_list_count(bsa_entry_list_t entry_list) {
|
||||
return 0;
|
||||
BSARCH_DLL_API(uint32_t) bsa_entry_list_count(bsa_entry_list_t entry_list)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
BSARCH_DLL_API(bsa_result_message_t) bsa_entry_list_add(bsa_entry_list_t entry_list, const wchar_t *entry_string) {
|
||||
return { 0 };
|
||||
BSARCH_DLL_API(bsa_result_message_t) bsa_entry_list_add(bsa_entry_list_t entry_list, const wchar_t *entry_string)
|
||||
{
|
||||
return {0};
|
||||
}
|
||||
|
||||
BSARCH_DLL_API(uint32_t) bsa_entry_list_get(bsa_entry_list_t entry_list, uint32_t index, uint32_t string_buffer_size, wchar_t *string_buffer) {
|
||||
return 0;
|
||||
BSARCH_DLL_API(uint32_t)
|
||||
bsa_entry_list_get(bsa_entry_list_t entry_list, uint32_t index, uint32_t string_buffer_size, wchar_t *string_buffer)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
BSARCH_DLL_API(bsa_archive_t) bsa_create() {
|
||||
return NULL;
|
||||
BSARCH_DLL_API(bsa_archive_t) bsa_create()
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
BSARCH_DLL_API(bsa_result_message_t) bsa_free(bsa_archive_t archive) {
|
||||
return { 0 };
|
||||
BSARCH_DLL_API(bsa_result_message_t) bsa_free(bsa_archive_t archive)
|
||||
{
|
||||
return {0};
|
||||
}
|
||||
|
||||
BSARCH_DLL_API(bsa_result_message_t) bsa_load_from_file(bsa_archive_t archive, const wchar_t *file_path) {
|
||||
return { 0 };
|
||||
BSARCH_DLL_API(bsa_result_message_t) bsa_load_from_file(bsa_archive_t archive, const wchar_t *file_path)
|
||||
{
|
||||
return {0};
|
||||
}
|
||||
|
||||
BSARCH_DLL_API(bsa_result_message_t) bsa_create_archive(bsa_archive_t archive, const wchar_t *file_path, bsa_archive_type_t archive_type, bsa_entry_list_t entry_list) {
|
||||
return { 0 };
|
||||
BSARCH_DLL_API(bsa_result_message_t)
|
||||
bsa_create_archive(bsa_archive_t archive,
|
||||
const wchar_t *file_path,
|
||||
bsa_archive_type_t archive_type,
|
||||
bsa_entry_list_t entry_list)
|
||||
{
|
||||
return {0};
|
||||
}
|
||||
|
||||
BSARCH_DLL_API(bsa_result_message_t) bsa_save(bsa_archive_t archive) {
|
||||
return { 0 };
|
||||
BSARCH_DLL_API(bsa_result_message_t) bsa_save(bsa_archive_t archive)
|
||||
{
|
||||
return {0};
|
||||
}
|
||||
|
||||
BSARCH_DLL_API(bsa_result_message_t) bsa_add_file_from_disk(bsa_archive_t archive, const wchar_t *file_path, const wchar_t *source_path) {
|
||||
return { 0 };
|
||||
BSARCH_DLL_API(bsa_result_message_t)
|
||||
bsa_add_file_from_disk(bsa_archive_t archive, const wchar_t *file_path, const wchar_t *source_path)
|
||||
{
|
||||
return {0};
|
||||
}
|
||||
|
||||
BSARCH_DLL_API(bsa_result_message_t) bsa_add_file_from_disk_root(bsa_archive_t archive, const wchar_t* root_dir, const wchar_t* source_path) {
|
||||
return { 0 };
|
||||
BSARCH_DLL_API(bsa_result_message_t)
|
||||
bsa_add_file_from_disk_root(bsa_archive_t archive, const wchar_t *root_dir, const wchar_t *source_path)
|
||||
{
|
||||
return {0};
|
||||
}
|
||||
|
||||
BSARCH_DLL_API(bsa_result_message_t) bsa_add_file_from_memory(bsa_archive_t archive, const wchar_t *file_path, uint32_t size, bsa_buffer_t data) {
|
||||
return { 0 };
|
||||
BSARCH_DLL_API(bsa_result_message_t)
|
||||
bsa_add_file_from_memory(bsa_archive_t archive, const wchar_t *file_path, uint32_t size, bsa_buffer_t data)
|
||||
{
|
||||
return {0};
|
||||
}
|
||||
|
||||
BSARCH_DLL_API(bsa_file_record_t) bsa_find_file_record(bsa_archive_t archive, const wchar_t *file_path) {
|
||||
return NULL;
|
||||
BSARCH_DLL_API(bsa_file_record_t) bsa_find_file_record(bsa_archive_t archive, const wchar_t *file_path)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
BSARCH_DLL_API(bsa_result_message_buffer_t) bsa_extract_file_data_by_record(bsa_archive_t archive, bsa_file_record_t file_record) {
|
||||
return { 0 };
|
||||
BSARCH_DLL_API(bsa_result_message_buffer_t)
|
||||
bsa_extract_file_data_by_record(bsa_archive_t archive, bsa_file_record_t file_record)
|
||||
{
|
||||
return {0};
|
||||
}
|
||||
|
||||
BSARCH_DLL_API(bsa_result_message_buffer_t) bsa_extract_file_data_by_filename(bsa_archive_t archive, const wchar_t *file_path) {
|
||||
return { 0 };
|
||||
BSARCH_DLL_API(bsa_result_message_buffer_t)
|
||||
bsa_extract_file_data_by_filename(bsa_archive_t archive, const wchar_t *file_path)
|
||||
{
|
||||
return {0};
|
||||
}
|
||||
|
||||
BSARCH_DLL_API(bsa_result_message_t) bsa_file_data_free(bsa_archive_t archive, bsa_result_buffer_t file_data_result) {
|
||||
return { 0 };
|
||||
BSARCH_DLL_API(bsa_result_message_t) bsa_file_data_free(bsa_archive_t archive, bsa_result_buffer_t file_data_result)
|
||||
{
|
||||
return {0};
|
||||
}
|
||||
|
||||
BSARCH_DLL_API(bsa_result_message_t) bsa_extract_file(bsa_archive_t archive, const wchar_t *file_path, const wchar_t *save_as) {
|
||||
return { 0 };
|
||||
BSARCH_DLL_API(bsa_result_message_t)
|
||||
bsa_extract_file(bsa_archive_t archive, const wchar_t *file_path, const wchar_t *save_as)
|
||||
{
|
||||
return {0};
|
||||
}
|
||||
|
||||
BSARCH_DLL_API(bsa_result_message_t) bsa_iterate_files(bsa_archive_t archive, bsa_file_iteration_proc_t file_iteration_proc, void *context) {
|
||||
return { 0 };
|
||||
BSARCH_DLL_API(bsa_result_message_t)
|
||||
bsa_iterate_files(bsa_archive_t archive, bsa_file_iteration_proc_t file_iteration_proc, void *context)
|
||||
{
|
||||
return {0};
|
||||
}
|
||||
|
||||
BSARCH_DLL_API(bool) bsa_file_exists(bsa_archive_t archive, const wchar_t *file_path) {
|
||||
return false;
|
||||
BSARCH_DLL_API(bool) bsa_file_exists(bsa_archive_t archive, const wchar_t *file_path)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
BSARCH_DLL_API(bsa_result_message_t) bsa_get_resource_list(bsa_archive_t archive, bsa_entry_list_t entry_result_list, const wchar_t *folder) {
|
||||
return { 0 };
|
||||
BSARCH_DLL_API(bsa_result_message_t)
|
||||
bsa_get_resource_list(bsa_archive_t archive, bsa_entry_list_t entry_result_list, const wchar_t *folder)
|
||||
{
|
||||
return {0};
|
||||
}
|
||||
|
||||
BSARCH_DLL_API(bsa_result_message_t) bsa_resolve_hash(bsa_archive_t archive, uint64_t hash, bsa_entry_list_t entry_result_list) {
|
||||
return { 0 };
|
||||
BSARCH_DLL_API(bsa_result_message_t)
|
||||
bsa_resolve_hash(bsa_archive_t archive, uint64_t hash, bsa_entry_list_t entry_result_list)
|
||||
{
|
||||
return {0};
|
||||
}
|
||||
|
||||
BSARCH_DLL_API(bsa_result_message_t) bsa_close(bsa_archive_t archive) {
|
||||
return { 0 };
|
||||
BSARCH_DLL_API(bsa_result_message_t) bsa_close(bsa_archive_t archive)
|
||||
{
|
||||
return {0};
|
||||
}
|
||||
|
||||
BSARCH_DLL_API(uint32_t) bsa_filename_get(bsa_archive_t archive, uint32_t string_buffer_size, wchar_t *string_buffer) {
|
||||
return 0;
|
||||
BSARCH_DLL_API(uint32_t) bsa_filename_get(bsa_archive_t archive, uint32_t string_buffer_size, wchar_t *string_buffer)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
BSARCH_DLL_API(bsa_archive_type_t) bsa_archive_type_get(bsa_archive_t archive) {
|
||||
return bsa_archive_type_t::baNone;
|
||||
BSARCH_DLL_API(bsa_archive_type_t) bsa_archive_type_get(bsa_archive_t archive)
|
||||
{
|
||||
return bsa_archive_type_t::baNone;
|
||||
}
|
||||
|
||||
BSARCH_DLL_API(uint32_t) bsa_version_get(bsa_archive_t archive) {
|
||||
return 0;
|
||||
BSARCH_DLL_API(uint32_t) bsa_version_get(bsa_archive_t archive)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
BSARCH_DLL_API(uint32_t) bsa_format_name_get(bsa_archive_t archive, uint32_t string_buffer_size, wchar_t *string_buffer) {
|
||||
return 0;
|
||||
BSARCH_DLL_API(uint32_t) bsa_format_name_get(bsa_archive_t archive, uint32_t string_buffer_size, wchar_t *string_buffer)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
BSARCH_DLL_API(uint32_t) bsa_file_count_get(bsa_archive_t archive) {
|
||||
return 0;
|
||||
BSARCH_DLL_API(uint32_t) bsa_file_count_get(bsa_archive_t archive)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
BSARCH_DLL_API(uint32_t) bsa_archive_flags_get(bsa_archive_t archive) {
|
||||
return 0;
|
||||
BSARCH_DLL_API(uint32_t) bsa_archive_flags_get(bsa_archive_t archive)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
BSARCH_DLL_API(void) bsa_archive_flags_set(bsa_archive_t archive, uint32_t flags) {
|
||||
return;
|
||||
BSARCH_DLL_API(void) bsa_archive_flags_set(bsa_archive_t archive, uint32_t flags)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
BSARCH_DLL_API(uint32_t) bsa_file_flags_get(bsa_archive_t archive) {
|
||||
return 0;
|
||||
BSARCH_DLL_API(uint32_t) bsa_file_flags_get(bsa_archive_t archive)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
BSARCH_DLL_API(void) bsa_file_flags_set(bsa_archive_t archive, uint32_t flags) {
|
||||
return;
|
||||
BSARCH_DLL_API(void) bsa_file_flags_set(bsa_archive_t archive, uint32_t flags)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
BSARCH_DLL_API(bool) bsa_compress_get(bsa_archive_t archive) {
|
||||
return false;
|
||||
BSARCH_DLL_API(bool) bsa_compress_get(bsa_archive_t archive)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
BSARCH_DLL_API(void) bsa_compress_set(bsa_archive_t archive, bool flags) {
|
||||
return;
|
||||
BSARCH_DLL_API(void) bsa_compress_set(bsa_archive_t archive, bool flags)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
BSARCH_DLL_API(bool) bsa_share_data_get(bsa_archive_t archive) {
|
||||
return false;
|
||||
BSARCH_DLL_API(bool) bsa_share_data_get(bsa_archive_t archive)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
BSARCH_DLL_API(void) bsa_share_data_set(bsa_archive_t archive, bool flags) {
|
||||
return;
|
||||
BSARCH_DLL_API(void) bsa_share_data_set(bsa_archive_t archive, bool flags)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
BSARCH_DLL_API(void) bsa_file_dds_info_callback_set(bsa_archive_t archive, bsa_file_dds_info_proc_t file_dds_info_proc, void *context) {
|
||||
return;
|
||||
}
|
||||
BSARCH_DLL_API(void)
|
||||
bsa_file_dds_info_callback_set(bsa_archive_t archive, bsa_file_dds_info_proc_t file_dds_info_proc, void *context)
|
||||
{
|
||||
return;
|
||||
}
|
||||
} // namespace libbsarch
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user