Update to 1.11.0-beta1
This commit is contained in:
33
src/strgen/CMakeLists.txt
Normal file
33
src/strgen/CMakeLists.txt
Normal file
@@ -0,0 +1,33 @@
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
|
||||
if (NOT HOST_BINARY_DIR)
|
||||
project(strgen)
|
||||
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/../../cmake")
|
||||
|
||||
set(sourcefiles
|
||||
strgen.cpp
|
||||
strgen_base.cpp
|
||||
../core/alloc_func.cpp
|
||||
../misc/getoptdata.cpp
|
||||
../string.cpp
|
||||
)
|
||||
add_definitions(-DSTRGEN)
|
||||
add_executable(strgen ${sourcefiles})
|
||||
|
||||
include(Endian)
|
||||
add_endian_definition()
|
||||
|
||||
export(TARGETS strgen FILE ${CMAKE_BINARY_DIR}/strgen.cmake)
|
||||
add_dependencies(tools strgen)
|
||||
endif()
|
||||
|
||||
if(OPTION_TOOLS_ONLY)
|
||||
return()
|
||||
endif()
|
||||
|
||||
# Source Files
|
||||
add_files(strgen_base.cpp)
|
||||
|
||||
# Header Files
|
||||
add_files(strgen.h)
|
||||
@@ -304,13 +304,13 @@ struct HeaderFileWriter : HeaderWriter, FileWriter {
|
||||
/* Find the plural form with the most amount of cases. */
|
||||
int max_plural_forms = 0;
|
||||
for (uint i = 0; i < lengthof(_plural_forms); i++) {
|
||||
max_plural_forms = max(max_plural_forms, _plural_forms[i].plural_count);
|
||||
max_plural_forms = std::max(max_plural_forms, _plural_forms[i].plural_count);
|
||||
}
|
||||
|
||||
fprintf(this->fh,
|
||||
"\n"
|
||||
"static const uint LANGUAGE_PACK_VERSION = 0x%X;\n"
|
||||
"static const uint LANGUAGE_MAX_PLURAL = %d;\n"
|
||||
"static const uint LANGUAGE_MAX_PLURAL = %u;\n"
|
||||
"static const uint LANGUAGE_MAX_PLURAL_FORMS = %d;\n\n",
|
||||
(uint)data.Version(), (uint)lengthof(_plural_forms), max_plural_forms
|
||||
);
|
||||
|
||||
@@ -388,7 +388,7 @@ void EmitPlural(Buffer *buffer, char *buf, int value)
|
||||
int argidx = _cur_argidx;
|
||||
int offset = -1;
|
||||
int expected = _plural_forms[_lang.plural_form].plural_count;
|
||||
const char **words = AllocaM(const char *, max(expected, MAX_PLURALS));
|
||||
const char **words = AllocaM(const char *, std::max(expected, MAX_PLURALS));
|
||||
int nw = 0;
|
||||
|
||||
/* Parse out the number, if one exists. Otherwise default to prev arg. */
|
||||
@@ -489,7 +489,7 @@ static uint ResolveCaseName(const char *str, size_t len)
|
||||
{
|
||||
/* First get a clean copy of only the case name, then resolve it. */
|
||||
char case_str[CASE_GENDER_LEN];
|
||||
len = min(lengthof(case_str) - 1, len);
|
||||
len = std::min(lengthof(case_str) - 1, len);
|
||||
memcpy(case_str, str, len);
|
||||
case_str[len] = '\0';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user