Skip to content

Commit 523bb6f

Browse files
committed
Minor changes
* Fix wav file reader for Lua>5.1 * Bump CMake script version to supress warning * Bump LICENSE year
1 parent 6993c66 commit 523bb6f

15 files changed

Lines changed: 910 additions & 840 deletions

.clang-format

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
Language: C
2+
BasedOnStyle: LLVM
3+
AccessModifierOffset: -4
4+
AlignAfterOpenBracket: Align
5+
AlignConsecutiveMacros: Consecutive
6+
AlignConsecutiveAssignments: Consecutive
7+
AlignConsecutiveBitFields: Consecutive
8+
AlignConsecutiveDeclarations: Consecutive
9+
AlignEscapedNewlines: Right
10+
AlignOperands: Align
11+
AlignTrailingComments: true
12+
AllowAllArgumentsOnNextLine: true
13+
PackConstructorInitializers: NextLine
14+
AllowAllParametersOfDeclarationOnNextLine: true
15+
AllowShortEnumsOnASingleLine: true
16+
AllowShortBlocksOnASingleLine: Never
17+
AllowShortCaseLabelsOnASingleLine: true
18+
AllowShortFunctionsOnASingleLine: Inline
19+
AllowShortLambdasOnASingleLine: All
20+
AllowShortIfStatementsOnASingleLine: WithoutElse
21+
AllowShortLoopsOnASingleLine: false
22+
AlwaysBreakAfterDefinitionReturnType: None
23+
BreakAfterReturnType: None
24+
AlwaysBreakBeforeMultilineStrings: false
25+
BreakTemplateDeclarations: Yes
26+
BinPackArguments: true
27+
BinPackParameters: true
28+
BraceWrapping:
29+
AfterCaseLabel: true
30+
AfterClass: true
31+
AfterControlStatement: Always
32+
AfterEnum: true
33+
AfterFunction: true
34+
AfterNamespace: false
35+
AfterObjCDeclaration: true
36+
AfterStruct: false
37+
AfterUnion: true
38+
AfterExternBlock: false
39+
BeforeCatch: false
40+
BeforeElse: false
41+
BeforeLambdaBody: true
42+
BeforeWhile: false
43+
IndentBraces: false
44+
SplitEmptyFunction: true
45+
SplitEmptyRecord: true
46+
SplitEmptyNamespace: true
47+
BreakBeforeBinaryOperators: None
48+
BreakBeforeConceptDeclarations: true
49+
BreakBeforeBraces: Attach
50+
BreakBeforeInheritanceComma: false
51+
BreakInheritanceList: BeforeColon
52+
BreakBeforeTernaryOperators: true
53+
BreakConstructorInitializersBeforeComma: false
54+
BreakConstructorInitializers: BeforeColon
55+
BreakAfterJavaFieldAnnotations: false
56+
BreakStringLiterals: true
57+
ColumnLimit: 160
58+
CompactNamespaces: false
59+
ConstructorInitializerAllOnOneLineOrOnePerLine: false
60+
ConstructorInitializerIndentWidth: 4
61+
ContinuationIndentWidth: 4
62+
Cpp11BracedListStyle: true
63+
DerivePointerAlignment: false
64+
DisableFormat: false
65+
SeparateDefinitionBlocks: Always
66+
EmptyLineBeforeAccessModifier: LogicalBlock
67+
ExperimentalAutoDetectBinPacking: false
68+
FixNamespaceComments: true
69+
IncludeBlocks: Regroup
70+
IncludeCategories:
71+
- Regex: '^<'
72+
Priority: 2
73+
SortPriority: 0
74+
CaseSensitive: false
75+
- Regex: '.*'
76+
Priority: 1
77+
SortPriority: 0
78+
CaseSensitive: false
79+
IncludeIsMainRegex: '$'
80+
IncludeIsMainSourceRegex: ''
81+
IndentCaseLabels: true
82+
IndentCaseBlocks: false
83+
IndentGotoLabels: true
84+
IndentPPDirectives: None
85+
IndentExternBlock: AfterExternBlock
86+
IndentRequires: false
87+
IndentWidth: 2
88+
IndentWrappedFunctionNames: false
89+
InsertTrailingCommas: None
90+
JavaScriptQuotes: Leave
91+
JavaScriptWrapImports: true
92+
KeepEmptyLines: { AtStartOfBlock: true }
93+
MaxEmptyLinesToKeep: 1
94+
NamespaceIndentation: None
95+
PenaltyBreakAssignment: 2
96+
PenaltyBreakBeforeFirstCallParameter: 19
97+
PenaltyBreakComment: 300
98+
PenaltyBreakFirstLessLess: 120
99+
PenaltyBreakString: 1000
100+
PenaltyBreakTemplateDeclaration: 10
101+
PenaltyExcessCharacter: 1000000
102+
PenaltyReturnTypeOnItsOwnLine: 60
103+
PenaltyIndentedWhitespace: 0
104+
PointerAlignment: Left
105+
ReflowComments: true
106+
SortIncludes: true
107+
SortJavaStaticImport: Before
108+
SortUsingDeclarations: true
109+
SpaceAfterCStyleCast: false
110+
SpaceAfterLogicalNot: false
111+
SpaceAfterTemplateKeyword: true
112+
SpaceBeforeAssignmentOperators: true
113+
SpaceBeforeCaseColon: false
114+
SpaceBeforeCpp11BracedList: true
115+
SpaceBeforeCtorInitializerColon: false
116+
SpaceBeforeInheritanceColon: false
117+
SpaceBeforeParens: ControlStatements
118+
SpaceAroundPointerQualifiers: Default
119+
SpaceBeforeRangeBasedForLoopColon: false
120+
SpaceInEmptyBlock: false
121+
SpacesInParensOptions:
122+
InEmptyParentheses: false
123+
InCStyleCasts: false
124+
SpacesBeforeTrailingComments: 1
125+
SpacesInAngles: false
126+
SpacesInConditionalStatement: false
127+
SpacesInContainerLiterals: true
128+
SpacesInSquareBrackets: false
129+
SpaceBeforeSquareBrackets: false
130+
BitFieldColonSpacing: Both
131+
Standard: Latest
132+
LineEnding: LF
133+
UseTab: Never

CMakeLists.txt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
1+
cmake_minimum_required(VERSION 3.10 FATAL_ERROR)
22

33
if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR)
4-
message(FATAL_ERROR "Prevented in-tree build. Please create a build directory outside of the game source code and run \"cmake -S ${CMAKE_SOURCE_DIR} -B .\" from there")
4+
message(FATAL_ERROR "Prevented in-tree build. Please create a build directory outside of the game source code and run \"cmake -S ${CMAKE_SOURCE_DIR} -B .\" from there")
55
endif()
66

77
# Включает/выключает преобразование JSON строки в Lua таблицу
@@ -18,14 +18,17 @@ add_library(luavosk SHARED
1818
)
1919

2020
unset(_FLL_ARG)
21+
2122
if(DEFINED LUA_VERSION)
2223
set(_FLL_ARG EXACT)
2324
endif()
2425

2526
find_package(Lua ${LUA_VERSION} ${_FLL_ARG} REQUIRED)
27+
2628
if(USE_JSON_PARSER STREQUAL yes)
2729
target_compile_definitions(luavosk PRIVATE VOSK_ENABLE_JSON)
2830
endif()
31+
2932
target_link_libraries(luavosk ${LUA_LIBRARIES})
3033
target_include_directories(luavosk PRIVATE ${LUA_INCLUDE_DIR})
3134
set_target_properties(luavosk PROPERTIES PREFIX "")

LICENSE

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
MIT License
2-
3-
Copyright (c) 2023 igor725
4-
5-
Permission is hereby granted, free of charge, to any person obtaining a copy
6-
of this software and associated documentation files (the "Software"), to deal
7-
in the Software without restriction, including without limitation the rights
8-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9-
copies of the Software, and to permit persons to whom the Software is
10-
furnished to do so, subject to the following conditions:
11-
12-
The above copyright notice and this permission notice shall be included in all
13-
copies or substantial portions of the Software.
14-
15-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21-
SOFTWARE.
1+
MIT License
2+
3+
Copyright (c) 2026 igor725
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

src/luahelp.h

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,39 @@
11
#ifndef LUAVOSK_HELP_H
22
#define LUAVOSK_HELP_H
33
#include "main.h"
4+
45
#include <lauxlib.h>
5-
#include <lua.h>
6+
#include <lua.h> // IWYU pragma: export
67
#include <lualib.h>
78

89
#if LUA_VERSION_NUM == 501
9-
# define lua_rawlen lua_objlen
10+
#define lua_rawlen lua_objlen
1011

11-
# ifndef LUA_JITLIBNAME
12-
# define luaL_setmetatable(L, tname) (luaL_getmetatable(L, tname), lua_setmetatable(L, -2))
13-
# define luaL_setfuncs(L, l, nup) luaL_register(L, NULL, l)
12+
#ifndef LUA_JITLIBNAME
13+
#define luaL_setmetatable(L, tname) (luaL_getmetatable(L, tname), lua_setmetatable(L, -2))
14+
#define luaL_setfuncs(L, l, nup) luaL_register(L, NULL, l)
1415

15-
static inline void *luaL_testudata(lua_State *L, int ud, const char *tname) {
16-
void *p = lua_touserdata(L, ud);
17-
if (p != NULL) {
18-
if (lua_getmetatable(L, ud)) {
19-
lua_getfield(L, LUA_REGISTRYINDEX, tname);
20-
if (lua_rawequal(L, -1, -2)) {
21-
lua_pop(L, 2);
22-
return p;
23-
}
24-
}
25-
}
26-
return NULL;
27-
}
28-
# endif
16+
static inline void* luaL_testudata(lua_State* L, int ud, const char* tname) {
17+
void* p = lua_touserdata(L, ud);
18+
if (p != NULL) {
19+
if (lua_getmetatable(L, ud)) {
20+
lua_getfield(L, LUA_REGISTRYINDEX, tname);
21+
if (lua_rawequal(L, -1, -2)) {
22+
lua_pop(L, 2);
23+
return p;
24+
}
25+
}
26+
}
27+
return NULL;
28+
}
29+
#endif
2930
#endif
3031

31-
static void inline luahelp_newmt(lua_State *L, vstr name, const luaL_Reg *funcs) {
32-
luaL_newmetatable(L, name);
33-
lua_pushvalue(L, -1);
34-
lua_setfield(L, -2, "__index");
35-
luaL_setfuncs(L, funcs, 0);
36-
lua_pop(L, 1);
32+
static void inline luahelp_newmt(lua_State* L, vstr name, const luaL_Reg* funcs) {
33+
luaL_newmetatable(L, name);
34+
lua_pushvalue(L, -1);
35+
lua_setfield(L, -2, "__index");
36+
luaL_setfuncs(L, funcs, 0);
37+
lua_pop(L, 1);
3738
}
3839
#endif

0 commit comments

Comments
 (0)