Resolved a few size_t related warnings (#8085)
Disabled warnings in libconfig only for MSVS
This commit is contained in:
parent
398bae57a8
commit
9139a21adc
9
3rdparty/libconfig/scanner.c
vendored
9
3rdparty/libconfig/scanner.c
vendored
@ -2,6 +2,11 @@
|
||||
|
||||
#line 4 "scanner.c"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning( push )
|
||||
#pragma warning( disable : 4267 )
|
||||
#endif
|
||||
|
||||
#define YY_INT_ALIGNED short int
|
||||
|
||||
/* A lexical scanner generated by flex */
|
||||
@ -2365,3 +2370,7 @@ void libconfig_yyfree (void * ptr , yyscan_t yyscanner)
|
||||
#define YYTABLES_NAME "yytables"
|
||||
|
||||
#line 192 "scanner.l"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning( pop )
|
||||
#endif
|
||||
|
@ -2831,9 +2831,10 @@ void char_config_split_startpoint( char* w1_value, char* w2_value, struct s_poin
|
||||
lineitem = strtok(w2_value, ":");
|
||||
|
||||
while (lineitem != NULL && (*count) < MAX_STARTPOINT) {
|
||||
int n = sv_split(lineitem, strlen(lineitem), 0, ',', fields, fields_length, SV_NOESCAPE_NOTERMINATE);
|
||||
bool error;
|
||||
size_t n = sv_split( lineitem, strlen( lineitem ), 0, ',', fields, fields_length, SV_NOESCAPE_NOTERMINATE, error );
|
||||
|
||||
if (n + 1 < fields_length) {
|
||||
if( error || ( n + 1 ) < fields_length ){
|
||||
ShowDebug("%s: not enough arguments for %s! Skipping...\n", w1_value, lineitem);
|
||||
lineitem = strtok(NULL, ":"); //next lineitem
|
||||
continue;
|
||||
@ -2867,9 +2868,10 @@ void char_config_split_startitem(char *w1_value, char *w2_value, struct startite
|
||||
lineitem = strtok(w2_value, ":");
|
||||
|
||||
while (lineitem != NULL && i < MAX_STARTITEM) {
|
||||
int n = sv_split(lineitem, strlen(lineitem), 0, ',', fields, fields_length, SV_NOESCAPE_NOTERMINATE);
|
||||
bool error;
|
||||
size_t n = sv_split( lineitem, strlen( lineitem ), 0, ',', fields, fields_length, SV_NOESCAPE_NOTERMINATE, error );
|
||||
|
||||
if (n + 1 < fields_length) {
|
||||
if( error || ( n + 1 ) < fields_length ){
|
||||
ShowDebug("%s: not enough arguments for %s! Skipping...\n", w1_value, lineitem);
|
||||
lineitem = strtok(NULL, ":"); //next lineitem
|
||||
continue;
|
||||
|
@ -340,9 +340,8 @@ int Core::start( int argc, char **argv ){
|
||||
char *p1;
|
||||
if((p1 = strrchr(argv[0], '/')) != NULL || (p1 = strrchr(argv[0], '\\')) != NULL ){
|
||||
char *pwd = NULL; //path working directory
|
||||
int n=0;
|
||||
SERVER_NAME = ++p1;
|
||||
n = p1-argv[0]; //calc dir name len
|
||||
size_t n = p1-argv[0]; //calc dir name len
|
||||
pwd = safestrncpy((char*)malloc(n + 1), argv[0], n);
|
||||
if(chdir(pwd) != 0)
|
||||
ShowError("Couldn't change working directory to %s for %s, runtime will probably fail",pwd,SERVER_NAME);
|
||||
|
@ -61,7 +61,7 @@ char console_log_filepath[32] = "./log/unknown.log";
|
||||
char s_[SBUF_SIZE]; \
|
||||
StringBuf *d_; \
|
||||
char *v_; \
|
||||
int l_; \
|
||||
size_t l_; \
|
||||
} buf ={"",NULL,NULL,0}; \
|
||||
//define NEWBUF
|
||||
|
||||
@ -210,7 +210,7 @@ int VFPRINTF(HANDLE handle, const char *fmt, va_list argptr)
|
||||
|
||||
if( !is_console(handle) && stdout_with_ansisequence )
|
||||
{
|
||||
WriteFile(handle, BUFVAL(tempbuf), BUFLEN(tempbuf), &written, 0);
|
||||
WriteFile( handle, BUFVAL( tempbuf ), (DWORD)BUFLEN( tempbuf ), &written, 0 );
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1696,10 +1696,7 @@ void send_shortlist_add_fd(int fd)
|
||||
// Do pending network sends and eof handling from the shortlist.
|
||||
void send_shortlist_do_sends()
|
||||
{
|
||||
int i;
|
||||
|
||||
for( i = send_shortlist_count-1; i >= 0; --i )
|
||||
{
|
||||
for( int i = static_cast<int>( send_shortlist_count - 1 ); i >= 0; --i ){
|
||||
int fd = send_shortlist_array[i];
|
||||
int idx = fd/32;
|
||||
int bit = fd%32;
|
||||
|
@ -3,6 +3,8 @@
|
||||
|
||||
#include "strlib.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "cbasetypes.hpp"
|
||||
@ -348,8 +350,7 @@ bool bin2hex(char* output, unsigned char* input, size_t count)
|
||||
///
|
||||
/// @param sv Parse state
|
||||
/// @return 1 if a field was parsed, 0 if already done, -1 on error.
|
||||
int sv_parse_next(struct s_svstate* sv)
|
||||
{
|
||||
int sv_parse_next( s_svstate& sv ){
|
||||
enum {
|
||||
START_OF_FIELD,
|
||||
PARSING_FIELD,
|
||||
@ -358,19 +359,11 @@ int sv_parse_next(struct s_svstate* sv)
|
||||
TERMINATE,
|
||||
END
|
||||
} state;
|
||||
const char* str;
|
||||
int len;
|
||||
enum e_svopt opt;
|
||||
char delim;
|
||||
int i;
|
||||
|
||||
if( sv == NULL )
|
||||
return -1;// error
|
||||
|
||||
str = sv->str;
|
||||
len = sv->len;
|
||||
opt = sv->opt;
|
||||
delim = sv->delim;
|
||||
const char* str = sv.str;
|
||||
size_t len = sv.len;
|
||||
int opt = sv.opt;
|
||||
char delim = sv.delim;
|
||||
|
||||
// check opt
|
||||
if( delim == '\n' && (opt&(SV_TERMINATE_CRLF|SV_TERMINATE_LF)) )
|
||||
@ -384,9 +377,9 @@ int sv_parse_next(struct s_svstate* sv)
|
||||
return -1;// error
|
||||
}
|
||||
|
||||
if( sv->done || str == NULL )
|
||||
if( sv.done || str == NULL )
|
||||
{
|
||||
sv->done = true;
|
||||
sv.done = true;
|
||||
return 0;// nothing to parse
|
||||
}
|
||||
|
||||
@ -397,10 +390,10 @@ int sv_parse_next(struct s_svstate* sv)
|
||||
((opt&SV_TERMINATE_CR) && str[i] == '\r') || \
|
||||
((opt&SV_TERMINATE_CRLF) && i+1 < len && str[i] == '\r' && str[i+1] == '\n') )
|
||||
#define IS_C_ESCAPE() ( (opt&SV_ESCAPE_C) && str[i] == '\\' )
|
||||
#define SET_FIELD_START() sv->start = i
|
||||
#define SET_FIELD_END() sv->end = i
|
||||
#define SET_FIELD_START() sv.start = i
|
||||
#define SET_FIELD_END() sv.end = i
|
||||
|
||||
i = sv->off;
|
||||
size_t i = sv.off;
|
||||
state = START_OF_FIELD;
|
||||
while( state != END )
|
||||
{
|
||||
@ -480,14 +473,14 @@ int sv_parse_next(struct s_svstate* sv)
|
||||
else
|
||||
++i;// CR or LF
|
||||
#endif
|
||||
sv->done = true;
|
||||
sv.done = true;
|
||||
state = END;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if( IS_END() )
|
||||
sv->done = true;
|
||||
sv->off = i;
|
||||
sv.done = true;
|
||||
sv.off = i;
|
||||
|
||||
#undef IS_END
|
||||
#undef IS_DELIM
|
||||
@ -520,15 +513,20 @@ int sv_parse_next(struct s_svstate* sv)
|
||||
/// @param npos Size of the pos array
|
||||
/// @param opt Options that determine the parsing behaviour
|
||||
/// @return Number of fields found in the string or -1 if an error occured
|
||||
int sv_parse(const char* str, int len, int startoff, char delim, int* out_pos, int npos, enum e_svopt opt)
|
||||
{
|
||||
struct s_svstate sv;
|
||||
int count;
|
||||
|
||||
size_t sv_parse( const char* str, size_t len, size_t startoff, char delim, size_t* out_pos, size_t npos, int opt, bool& error ){
|
||||
// initialize
|
||||
if( out_pos == NULL ) npos = 0;
|
||||
for( count = 0; count < npos; ++count )
|
||||
out_pos[count] = -1;
|
||||
error = false;
|
||||
|
||||
if( out_pos == nullptr ){
|
||||
npos = 0;
|
||||
}
|
||||
|
||||
for( size_t i = 0; i < npos; ++i ){
|
||||
out_pos[i] = -1;
|
||||
}
|
||||
|
||||
s_svstate sv = {};
|
||||
|
||||
sv.str = str;
|
||||
sv.len = len;
|
||||
sv.off = startoff;
|
||||
@ -536,18 +534,34 @@ int sv_parse(const char* str, int len, int startoff, char delim, int* out_pos, i
|
||||
sv.delim = delim;
|
||||
sv.done = false;
|
||||
|
||||
// parse
|
||||
count = 0;
|
||||
if( npos > 0 ) out_pos[0] = startoff;
|
||||
while( !sv.done )
|
||||
{
|
||||
++count;
|
||||
if( sv_parse_next(&sv) <= 0 )
|
||||
return -1;// error
|
||||
if( npos > count*2 ) out_pos[count*2] = sv.start;
|
||||
if( npos > count*2+1 ) out_pos[count*2+1] = sv.end;
|
||||
if( npos > 0 ){
|
||||
out_pos[0] = startoff;
|
||||
}
|
||||
if( npos > 1 ) out_pos[1] = sv.off;
|
||||
|
||||
// parse
|
||||
size_t count = 0;
|
||||
|
||||
while( !sv.done ){
|
||||
++count;
|
||||
|
||||
if( sv_parse_next( sv ) <= 0 ){
|
||||
error = true;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if( npos > count * 2 ){
|
||||
out_pos[count * 2] = sv.start;
|
||||
}
|
||||
|
||||
if( npos > count * 2 + 1 ){
|
||||
out_pos[count * 2 + 1] = sv.end;
|
||||
}
|
||||
}
|
||||
|
||||
if( npos > 1 ){
|
||||
out_pos[1] = sv.off;
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
@ -570,18 +584,21 @@ int sv_parse(const char* str, int len, int startoff, char delim, int* out_pos, i
|
||||
/// @param nfields Size of the field array
|
||||
/// @param opt Options that determine the parsing behaviour
|
||||
/// @return Number of fields found in the string or -1 if an error occured
|
||||
int sv_split(char* str, int len, int startoff, char delim, char** out_fields, size_t nfields, enum e_svopt opt)
|
||||
{
|
||||
int pos[1024];
|
||||
int done;
|
||||
char* end;
|
||||
int ret = sv_parse(str, len, startoff, delim, pos, ARRAYLENGTH(pos), opt);
|
||||
size_t sv_split( char* str, size_t len, size_t startoff, char delim, char** out_fields, size_t nfields, int opt, bool& error ){
|
||||
if( out_fields == nullptr || nfields <= 0 ){
|
||||
return 0; // nothing to do
|
||||
}
|
||||
|
||||
if( ret == -1 || out_fields == NULL || nfields <= 0 )
|
||||
return ret; // nothing to do
|
||||
size_t pos[1024];
|
||||
size_t ret = sv_parse( str, len, startoff, delim, pos, ARRAYLENGTH( pos ), opt, error );
|
||||
|
||||
// An error occurred
|
||||
if( error ){
|
||||
return 0;
|
||||
}
|
||||
|
||||
// next line
|
||||
end = str + pos[1];
|
||||
char* end = str + pos[1];
|
||||
if( end[0] == '\0' )
|
||||
{
|
||||
*out_fields = end;
|
||||
@ -614,7 +631,7 @@ int sv_split(char* str, int len, int startoff, char delim, char** out_fields, si
|
||||
|
||||
// fields
|
||||
size_t i = 2;
|
||||
done = 0;
|
||||
size_t done = 0;
|
||||
while( done < ret && nfields > 0 )
|
||||
{
|
||||
if( i < ARRAYLENGTH(pos) )
|
||||
@ -630,7 +647,13 @@ int sv_split(char* str, int len, int startoff, char delim, char** out_fields, si
|
||||
}
|
||||
else
|
||||
{// get more fields
|
||||
sv_parse(str, len, pos[i-1] + 1, delim, pos, ARRAYLENGTH(pos), opt);
|
||||
sv_parse( str, len, pos[i - 1] + 1, delim, pos, ARRAYLENGTH( pos ), opt, error );
|
||||
|
||||
// An error occurred
|
||||
if( error ){
|
||||
return 0;
|
||||
}
|
||||
|
||||
i = 2;
|
||||
}
|
||||
}
|
||||
@ -862,13 +885,11 @@ const char* skip_escaped_c(const char* p)
|
||||
* @param silent : should we display error if file not found ?
|
||||
* @return true on success, false if file could not be opened
|
||||
*/
|
||||
bool sv_readdb(const char* directory, const char* filename, char delim, int mincols, int maxcols, int maxrows, bool (*parseproc)(char* fields[], int columns, int current), bool silent)
|
||||
{
|
||||
bool sv_readdb( const char* directory, const char* filename, char delim, size_t mincols, size_t maxcols, size_t maxrows, bool (*parseproc)( char* fields[], size_t columns, size_t current ), bool silent ){
|
||||
FILE* fp;
|
||||
int lines = 0;
|
||||
int entries = 0;
|
||||
size_t entries = 0;
|
||||
char** fields; // buffer for fields ([0] is reserved)
|
||||
int columns, nb_cols;
|
||||
char path[1024], *line;
|
||||
const short colsize=512;
|
||||
|
||||
@ -883,13 +904,12 @@ bool sv_readdb(const char* directory, const char* filename, char delim, int minc
|
||||
}
|
||||
|
||||
// allocate enough memory for the maximum requested amount of columns plus the reserved one
|
||||
nb_cols = maxcols+1;
|
||||
size_t nb_cols = maxcols + 1;
|
||||
fields = (char**)aMalloc(nb_cols*sizeof(char*));
|
||||
line = (char*)aMalloc(nb_cols*colsize);
|
||||
|
||||
// process rows one by one
|
||||
while( fgets(line, maxcols*colsize, fp) )
|
||||
{
|
||||
while( fgets( line, static_cast<int>( maxcols * colsize ), fp ) ){
|
||||
char *match;
|
||||
lines++;
|
||||
|
||||
@ -903,7 +923,13 @@ bool sv_readdb(const char* directory, const char* filename, char delim, int minc
|
||||
if( line[0] == '\0' || line[0] == '\n' || line[0] == '\r')
|
||||
continue;
|
||||
|
||||
columns = sv_split(line, strlen(line), 0, delim, fields, nb_cols, (e_svopt)(SV_TERMINATE_LF|SV_TERMINATE_CRLF));
|
||||
bool error;
|
||||
size_t columns = sv_split( line, strlen( line ), 0, delim, fields, nb_cols, SV_TERMINATE_LF|SV_TERMINATE_CRLF, error );
|
||||
|
||||
if( error ){
|
||||
ShowError( "sv_readdb: error in line %d of \"%s\".\n", lines, path );
|
||||
continue;
|
||||
}
|
||||
|
||||
if( columns < mincols )
|
||||
{
|
||||
@ -965,53 +991,49 @@ void _StringBuf_Init(const char *file, int line, const char *func,StringBuf* sel
|
||||
}
|
||||
|
||||
/// Appends the result of printf to the StringBuf
|
||||
int _StringBuf_Printf(const char *file, int line, const char *func,StringBuf* self, const char* fmt, ...)
|
||||
{
|
||||
int len;
|
||||
size_t _StringBuf_Printf( const char* file, int line, const char* func, StringBuf* self, const char* fmt, ... ){
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, fmt);
|
||||
len = _StringBuf_Vprintf(file,line,func,self, fmt, ap);
|
||||
size_t len = _StringBuf_Vprintf(file,line,func,self, fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
/// Appends the result of vprintf to the StringBuf
|
||||
int _StringBuf_Vprintf(const char *file, int line, const char *func,StringBuf* self, const char* fmt, va_list ap)
|
||||
{
|
||||
size_t _StringBuf_Vprintf( const char* file, int line, const char* func, StringBuf* self, const char* fmt, va_list ap ){
|
||||
for(;;)
|
||||
{
|
||||
int n, size, off;
|
||||
va_list apcopy;
|
||||
/* Try to print in the allocated space. */
|
||||
size = self->max_ - (self->ptr_ - self->buf_);
|
||||
size_t size = self->max_ - (self->ptr_ - self->buf_);
|
||||
va_copy(apcopy, ap);
|
||||
n = vsnprintf(self->ptr_, size, fmt, apcopy);
|
||||
int n = vsnprintf( self->ptr_, size, fmt, apcopy );
|
||||
va_end(apcopy);
|
||||
/* If that worked, return the length. */
|
||||
if( n > -1 && n < size )
|
||||
{
|
||||
self->ptr_ += n;
|
||||
return (int)(self->ptr_ - self->buf_);
|
||||
return self->ptr_ - self->buf_;
|
||||
}
|
||||
/* Else try again with more space. */
|
||||
self->max_ *= 2; // twice the old size
|
||||
off = (int)(self->ptr_ - self->buf_);
|
||||
size_t off = self->ptr_ - self->buf_;
|
||||
self->buf_ = (char*)aRealloc2(self->buf_, self->max_ + 1, file, line, func);
|
||||
self->ptr_ = self->buf_ + off;
|
||||
}
|
||||
}
|
||||
|
||||
/// Appends the contents of another StringBuf to the StringBuf
|
||||
int _StringBuf_Append(const char *file, int line, const char *func,StringBuf* self, const StringBuf* sbuf)
|
||||
size_t _StringBuf_Append(const char *file, int line, const char *func,StringBuf* self, const StringBuf* sbuf)
|
||||
{
|
||||
int available = self->max_ - (self->ptr_ - self->buf_);
|
||||
int needed = (int)(sbuf->ptr_ - sbuf->buf_);
|
||||
size_t available = self->max_ - (self->ptr_ - self->buf_);
|
||||
size_t needed = sbuf->ptr_ - sbuf->buf_;
|
||||
|
||||
if( needed >= available )
|
||||
{
|
||||
int off = (int)(self->ptr_ - self->buf_);
|
||||
size_t off = self->ptr_ - self->buf_;
|
||||
self->max_ += needed;
|
||||
self->buf_ = (char*)aRealloc2(self->buf_, self->max_ + 1, file, line, func);
|
||||
self->ptr_ = self->buf_ + off;
|
||||
@ -1019,26 +1041,26 @@ int _StringBuf_Append(const char *file, int line, const char *func,StringBuf* se
|
||||
|
||||
memcpy(self->ptr_, sbuf->buf_, needed);
|
||||
self->ptr_ += needed;
|
||||
return (int)(self->ptr_ - self->buf_);
|
||||
return self->ptr_ - self->buf_;
|
||||
}
|
||||
|
||||
// Appends str to the StringBuf
|
||||
int _StringBuf_AppendStr(const char *file, int line, const char *func,StringBuf* self, const char* str)
|
||||
size_t _StringBuf_AppendStr(const char *file, int line, const char *func,StringBuf* self, const char* str)
|
||||
{
|
||||
int available = self->max_ - (self->ptr_ - self->buf_);
|
||||
int needed = (int)strlen(str);
|
||||
size_t available = self->max_ - ( self->ptr_ - self->buf_ );
|
||||
size_t needed = strlen( str );
|
||||
|
||||
if( needed >= available )
|
||||
{// not enough space, expand the buffer (minimum expansion = 1024)
|
||||
int off = (int)(self->ptr_ - self->buf_);
|
||||
self->max_ += max(needed, 1024);
|
||||
size_t off = self->ptr_ - self->buf_;
|
||||
self->max_ += std::max( needed, static_cast<size_t>( 1024 ) );
|
||||
self->buf_ = (char*)aRealloc2(self->buf_, self->max_ + 1, file, line, func);
|
||||
self->ptr_ = self->buf_ + off;
|
||||
}
|
||||
|
||||
memcpy(self->ptr_, str, needed);
|
||||
self->ptr_ += needed;
|
||||
return (int)(self->ptr_ - self->buf_);
|
||||
return self->ptr_ - self->buf_;
|
||||
}
|
||||
|
||||
// Returns the length of the data in the Stringbuf
|
||||
|
@ -85,11 +85,11 @@ typedef enum e_svopt
|
||||
struct s_svstate
|
||||
{
|
||||
const char* str; //< string to parse
|
||||
int len; //< string length
|
||||
int off; //< current offset in the string
|
||||
int start; //< where the field starts
|
||||
int end; //< where the field ends
|
||||
enum e_svopt opt; //< parse options
|
||||
size_t len; //< string length
|
||||
size_t off; //< current offset in the string
|
||||
size_t start; //< where the field starts
|
||||
size_t end; //< where the field ends
|
||||
int opt; //< parse options
|
||||
char delim; //< field delimiter
|
||||
bool done; //< if all the text has been parsed
|
||||
};
|
||||
@ -99,14 +99,14 @@ struct s_svstate
|
||||
///
|
||||
/// @param sv Parse state
|
||||
/// @return 1 if a field was parsed, 0 if done, -1 on error.
|
||||
int sv_parse_next(struct s_svstate* sv);
|
||||
int sv_parse_next( s_svstate& sv );
|
||||
|
||||
/// Parses a delim-separated string.
|
||||
/// Starts parsing at startoff and fills the pos array with position pairs.
|
||||
/// out_pos[0] and out_pos[1] are the start and end of line.
|
||||
/// Other position pairs are the start and end of fields.
|
||||
/// Returns the number of fields found or -1 if an error occurs.
|
||||
int sv_parse(const char* str, int len, int startoff, char delim, int* out_pos, int npos, enum e_svopt opt);
|
||||
size_t sv_parse( const char* str, size_t len, size_t startoff, char delim, size_t* out_pos, size_t npos, int opt, bool& error );
|
||||
|
||||
/// Splits a delim-separated string.
|
||||
/// WARNING: this function modifies the input string
|
||||
@ -114,7 +114,7 @@ int sv_parse(const char* str, int len, int startoff, char delim, int* out_pos, i
|
||||
/// out_fields[0] is the start of the next line.
|
||||
/// Other entries are the start of fields (nul-teminated).
|
||||
/// Returns the number of fields found or -1 if an error occurs.
|
||||
int sv_split(char* str, int len, int startoff, char delim, char** out_fields, size_t nfields, enum e_svopt opt);
|
||||
size_t sv_split( char* str, size_t len, size_t startoff, char delim, char** out_fields, size_t nfields, int opt, bool& error );
|
||||
|
||||
/// Escapes src to out_dest according to the format of the C compiler.
|
||||
/// Returns the length of the escaped string.
|
||||
@ -132,7 +132,7 @@ const char* skip_escaped_c(const char* p);
|
||||
/// Opens and parses a file containing delim-separated columns, feeding them to the specified callback function row by row.
|
||||
/// Tracks the progress of the operation (current line number, number of successfully processed rows).
|
||||
/// Returns 'true' if it was able to process the specified file, or 'false' if it could not be read.
|
||||
bool sv_readdb(const char* directory, const char* filename, char delim, int mincols, int maxcols, int maxrows, bool (*parseproc)(char* fields[], int columns, int current), bool silent);
|
||||
bool sv_readdb( const char* directory, const char* filename, char delim, size_t mincols, size_t maxcols, size_t maxrows, bool (*parseproc)( char* fields[], size_t columns, size_t current ), bool silent );
|
||||
|
||||
|
||||
/// StringBuf - dynamic string
|
||||
@ -140,7 +140,7 @@ struct StringBuf
|
||||
{
|
||||
char *buf_;
|
||||
char *ptr_;
|
||||
unsigned int max_;
|
||||
size_t max_;
|
||||
};
|
||||
typedef struct StringBuf StringBuf;
|
||||
|
||||
@ -148,13 +148,13 @@ StringBuf* _StringBuf_Malloc(const char *file, int line, const char *func);
|
||||
#define StringBuf_Malloc() _StringBuf_Malloc(ALC_MARK)
|
||||
void _StringBuf_Init(const char *file, int line, const char *func, StringBuf* self);
|
||||
#define StringBuf_Init(self) _StringBuf_Init(ALC_MARK,self)
|
||||
int _StringBuf_Printf(const char *file, int line, const char *func, StringBuf* self, const char* fmt, ...);
|
||||
size_t _StringBuf_Printf( const char* file, int line, const char* func, StringBuf* self, const char* fmt, ... );
|
||||
#define StringBuf_Printf(self,fmt,...) _StringBuf_Printf(ALC_MARK,self,fmt, ## __VA_ARGS__)
|
||||
int _StringBuf_Vprintf(const char *file, int line, const char *func,StringBuf* self, const char* fmt, va_list args);
|
||||
size_t _StringBuf_Vprintf( const char* file, int line, const char* func, StringBuf* self, const char* fmt, va_list args );
|
||||
#define StringBuf_Vprintf(self,fmt,args) _StringBuf_Vprintf(ALC_MARK,self,fmt,args)
|
||||
int _StringBuf_Append(const char *file, int line, const char *func, StringBuf* self, const StringBuf *sbuf);
|
||||
size_t _StringBuf_Append(const char *file, int line, const char *func, StringBuf* self, const StringBuf *sbuf);
|
||||
#define StringBuf_Append(self,sbuf) _StringBuf_Append(ALC_MARK,self,sbuf)
|
||||
int _StringBuf_AppendStr(const char *file, int line, const char *func, StringBuf* self, const char* str);
|
||||
size_t _StringBuf_AppendStr(const char *file, int line, const char *func, StringBuf* self, const char* str);
|
||||
#define StringBuf_AppendStr(self,str) _StringBuf_AppendStr(ALC_MARK,self,str)
|
||||
int StringBuf_Length(StringBuf* self);
|
||||
char* StringBuf_Value(StringBuf* self);
|
||||
|
@ -117,12 +117,12 @@ bool rathena::util::safe_multiplication( int64 a, int64 b, int64& result ){
|
||||
|
||||
void rathena::util::string_left_pad_inplace(std::string& str, char padding, size_t num)
|
||||
{
|
||||
str.insert(0, min(0, num - str.length()), padding);
|
||||
str.insert( 0, std::min( static_cast<size_t>( 0 ), num - str.length() ), padding );
|
||||
}
|
||||
|
||||
std::string rathena::util::string_left_pad(const std::string& original, char padding, size_t num)
|
||||
{
|
||||
return std::string(num - min(num, original.length()), padding) + original;
|
||||
return std::string( num - std::min( num, original.length() ), padding ) + original;
|
||||
}
|
||||
|
||||
constexpr char base62_dictionary[] = {
|
||||
|
@ -292,7 +292,6 @@ int login_mmo_auth_new(const char* userid, const char* pass, const char sex, con
|
||||
*/
|
||||
int login_mmo_auth(struct login_session_data* sd, bool isServer) {
|
||||
struct mmo_account acc;
|
||||
int len;
|
||||
|
||||
char ip[16];
|
||||
ip2str(session[sd->fd]->client_addr, ip);
|
||||
@ -316,7 +315,7 @@ int login_mmo_auth(struct login_session_data* sd, bool isServer) {
|
||||
|
||||
}
|
||||
|
||||
len = strnlen(sd->userid, NAME_LENGTH);
|
||||
size_t len = strnlen(sd->userid, NAME_LENGTH);
|
||||
|
||||
// Account creation with _M/_F
|
||||
if( login_config.new_account_flag ) {
|
||||
|
@ -3553,7 +3553,7 @@ void ItemGroupDatabase::loadingFinished() {
|
||||
/** Read item forbidden by mapflag (can't equip item)
|
||||
* Structure: <nameid>,<mode>
|
||||
*/
|
||||
static bool itemdb_read_noequip(char* str[], int columns, int current) {
|
||||
static bool itemdb_read_noequip( char* str[], size_t columns, size_t current ){
|
||||
t_itemid nameid;
|
||||
int flag;
|
||||
|
||||
|
@ -5736,8 +5736,7 @@ uint64 MobChatDatabase::parseBodyNode(const ryml::NodeRef& node) {
|
||||
/*==========================================
|
||||
* processes one mob_skill_db entry
|
||||
*------------------------------------------*/
|
||||
static bool mob_parse_row_mobskilldb(char** str, int columns, int current)
|
||||
{
|
||||
static bool mob_parse_row_mobskilldb( char** str, size_t columns, size_t current ){
|
||||
static const struct {
|
||||
char str[32];
|
||||
enum MobSkillState id;
|
||||
|
@ -5621,13 +5621,14 @@ int npc_parsesrcfile(const char* filepath)
|
||||
|
||||
// parse buffer
|
||||
for ( const char* p = skip_space(buffer); p && *p ; p = skip_space(p) ) {
|
||||
int pos[9];
|
||||
size_t pos[9];
|
||||
lines++;
|
||||
|
||||
// w1<TAB>w2<TAB>w3<TAB>w4
|
||||
int count = sv_parse(p, len+buffer-p, 0, '\t', pos, ARRAYLENGTH(pos), (e_svopt)(SV_TERMINATE_LF|SV_TERMINATE_CRLF));
|
||||
bool error;
|
||||
size_t count = sv_parse( p, len + buffer - p, 0, '\t', pos, ARRAYLENGTH( pos ), SV_TERMINATE_LF|SV_TERMINATE_CRLF, error );
|
||||
|
||||
if (count < 0) {
|
||||
if( error ){
|
||||
ShowError("npc_parsesrcfile: Parse error in file '%s', line '%d'. Stopping...\n", filepath, strline(buffer,p-buffer));
|
||||
break;
|
||||
}
|
||||
|
@ -14069,7 +14069,7 @@ void JobDatabase::loadingFinished() {
|
||||
/**
|
||||
* Read job_noenter_map.txt
|
||||
**/
|
||||
static bool pc_readdb_job_noenter_map(char *str[], int columns, int current) {
|
||||
static bool pc_readdb_job_noenter_map( char *str[], size_t columns, size_t current ){
|
||||
int class_ = -1;
|
||||
int64 class_tmp;
|
||||
|
||||
|
@ -24762,8 +24762,7 @@ uint64 MagicMushroomDatabase::parseBodyNode(const ryml::NodeRef& node) {
|
||||
/** Reads skill no cast db
|
||||
* Structure: SkillID,Flag
|
||||
*/
|
||||
static bool skill_parse_row_nocastdb(char* split[], int columns, int current)
|
||||
{
|
||||
static bool skill_parse_row_nocastdb( char* split[], size_t columns, size_t current ){
|
||||
std::shared_ptr<s_skill_db> skill = skill_db.find(atoi(split[0]));
|
||||
|
||||
if (!skill)
|
||||
@ -24777,8 +24776,7 @@ static bool skill_parse_row_nocastdb(char* split[], int columns, int current)
|
||||
/** Reads Produce db
|
||||
* Structure: ProduceItemID,ItemLV,RequireSkill,Requireskill_lv,MaterialID1,MaterialAmount1,...
|
||||
*/
|
||||
static bool skill_parse_row_producedb(char* split[], int columns, int current)
|
||||
{
|
||||
static bool skill_parse_row_producedb( char* split[], size_t columns, size_t current ){
|
||||
unsigned short x, y;
|
||||
unsigned short id = atoi(split[0]);
|
||||
t_itemid nameid = 0;
|
||||
@ -24967,8 +24965,7 @@ uint64 AbraDatabase::parseBodyNode(const ryml::NodeRef& node) {
|
||||
/** Reads change material db
|
||||
* Structure: ProductID,BaseRate,MakeAmount1,MakeAmountRate1...,MakeAmount5,MakeAmountRate5
|
||||
*/
|
||||
static bool skill_parse_row_changematerialdb(char* split[], int columns, int current)
|
||||
{
|
||||
static bool skill_parse_row_changematerialdb( char* split[], size_t columns, size_t current ){
|
||||
uint16 id = atoi(split[0]);
|
||||
t_itemid nameid = strtoul(split[1], nullptr, 10);
|
||||
short rate = atoi(split[2]);
|
||||
@ -25024,8 +25021,7 @@ static bool skill_parse_row_changematerialdb(char* split[], int columns, int cur
|
||||
* Reads skill damage adjustment
|
||||
* @author [Lilith]
|
||||
*/
|
||||
static bool skill_parse_row_skilldamage(char* split[], int columns, int current)
|
||||
{
|
||||
static bool skill_parse_row_skilldamage( char* split[], size_t columns, size_t current ){
|
||||
int64 caster_tmp;
|
||||
uint16 id;
|
||||
int caster, value;
|
||||
|
@ -15418,8 +15418,7 @@ void status_change_clear_onChangeMap(struct block_list *bl, status_change *sc)
|
||||
* @param current: Current row being read into SCDisabled array
|
||||
* @return True - Successfully stored, False - Invalid SC
|
||||
*/
|
||||
static bool status_readdb_status_disabled(char **str, int columns, int current)
|
||||
{
|
||||
static bool status_readdb_status_disabled( char **str, size_t columns, size_t current ){
|
||||
int64 type = SC_NONE;
|
||||
|
||||
if (ISDIGIT(str[0][0]))
|
||||
|
@ -577,7 +577,7 @@ bool Csv2YamlTool::initialize( int argc, char* argv[] ){
|
||||
|
||||
// Copied and adjusted from guild.cpp
|
||||
// <skill id>,<max lv>,<req id1>,<req lv1>,<req id2>,<req lv2>,<req id3>,<req lv3>,<req id4>,<req lv4>,<req id5>,<req lv5>
|
||||
static bool guild_read_guildskill_tree_db( char* split[], int columns, int current ){
|
||||
static bool guild_read_guildskill_tree_db( char* split[], size_t columns, size_t current ){
|
||||
uint16 skill_id = (uint16)atoi(split[0]);
|
||||
std::string* name = util::umap_find( aegis_skillnames, skill_id );
|
||||
|
||||
@ -802,8 +802,7 @@ static bool pet_read_db( const char* file ){
|
||||
}
|
||||
|
||||
// Copied and adjusted from skill.cpp
|
||||
static bool skill_parse_row_magicmushroomdb(char *split[], int column, int current)
|
||||
{
|
||||
static bool skill_parse_row_magicmushroomdb( char *split[], size_t column, size_t current ){
|
||||
uint16 skill_id = atoi(split[0]);
|
||||
std::string *skill_name = util::umap_find(aegis_skillnames, skill_id);
|
||||
|
||||
@ -820,8 +819,7 @@ static bool skill_parse_row_magicmushroomdb(char *split[], int column, int curre
|
||||
}
|
||||
|
||||
// Copied and adjusted from skill.cpp
|
||||
static bool skill_parse_row_abradb(char* split[], int columns, int current)
|
||||
{
|
||||
static bool skill_parse_row_abradb( char* split[], size_t columns, size_t current ){
|
||||
uint16 skill_id = atoi(split[0]);
|
||||
std::string *skill_name = util::umap_find(aegis_skillnames, skill_id);
|
||||
|
||||
@ -861,8 +859,7 @@ static bool skill_parse_row_abradb(char* split[], int columns, int current)
|
||||
}
|
||||
|
||||
// Copied and adjusted from skill.cpp
|
||||
static bool skill_parse_row_spellbookdb(char* split[], int columns, int current)
|
||||
{
|
||||
static bool skill_parse_row_spellbookdb( char* split[], size_t columns, size_t current ){
|
||||
uint16 skill_id = atoi(split[0]);
|
||||
std::string *skill_name = util::umap_find(aegis_skillnames, skill_id);
|
||||
|
||||
@ -889,7 +886,7 @@ static bool skill_parse_row_spellbookdb(char* split[], int columns, int current)
|
||||
}
|
||||
|
||||
// Copied and adjusted from mob.cpp
|
||||
static bool mob_readdb_mobavail(char* str[], int columns, int current) {
|
||||
static bool mob_readdb_mobavail( char* str[], size_t columns, size_t current ){
|
||||
uint16 mob_id = atoi(str[0]);
|
||||
std::string *mob_name = util::umap_find(aegis_mobnames, mob_id);
|
||||
|
||||
@ -1121,8 +1118,7 @@ static bool mob_readdb_mobavail(char* str[], int columns, int current) {
|
||||
|
||||
// skill_db.yml function
|
||||
//----------------------
|
||||
static bool skill_parse_row_requiredb(char* split[], int columns, int current)
|
||||
{
|
||||
static bool skill_parse_row_requiredb( char* split[], size_t columns, size_t current ){
|
||||
s_skill_require entry = {};
|
||||
|
||||
skill_split_atoi(split[1], entry.hp);
|
||||
@ -1236,8 +1232,7 @@ static bool skill_parse_row_requiredb(char* split[], int columns, int current)
|
||||
|
||||
// skill_db.yml function
|
||||
//----------------------
|
||||
static bool skill_parse_row_castdb(char* split[], int columns, int current)
|
||||
{
|
||||
static bool skill_parse_row_castdb( char* split[], size_t columns, size_t current ){
|
||||
s_skill_db entry = {};
|
||||
|
||||
skill_split_atoi(split[1], entry.cast);
|
||||
@ -1257,8 +1252,7 @@ static bool skill_parse_row_castdb(char* split[], int columns, int current)
|
||||
|
||||
// skill_db.yml function
|
||||
//----------------------
|
||||
static bool skill_parse_row_castnodexdb(char* split[], int columns, int current)
|
||||
{
|
||||
static bool skill_parse_row_castnodexdb( char* split[], size_t columns, size_t current ){
|
||||
s_skill_db entry = {};
|
||||
|
||||
entry.castnodex = atoi(split[1]);
|
||||
@ -1272,8 +1266,7 @@ static bool skill_parse_row_castnodexdb(char* split[], int columns, int current)
|
||||
|
||||
// skill_db.yml function
|
||||
//----------------------
|
||||
static bool skill_parse_row_unitdb(char* split[], int columns, int current)
|
||||
{
|
||||
static bool skill_parse_row_unitdb( char* split[], size_t columns, size_t current ){
|
||||
s_skill_unit_csv entry = {};
|
||||
|
||||
entry.unit_id = (uint16)strtol(split[1], NULL, 16);
|
||||
@ -1291,8 +1284,7 @@ static bool skill_parse_row_unitdb(char* split[], int columns, int current)
|
||||
|
||||
// skill_db.yml function
|
||||
//----------------------
|
||||
static bool skill_parse_row_copyabledb(char* split[], int column, int current)
|
||||
{
|
||||
static bool skill_parse_row_copyabledb( char* split[], size_t column, size_t current ){
|
||||
s_skill_copyable entry = {};
|
||||
int skill_id = -1;
|
||||
|
||||
@ -1321,8 +1313,7 @@ static bool skill_parse_row_copyabledb(char* split[], int column, int current)
|
||||
|
||||
// skill_db.yml function
|
||||
//----------------------
|
||||
static bool skill_parse_row_nonearnpcrangedb(char* split[], int column, int current)
|
||||
{
|
||||
static bool skill_parse_row_nonearnpcrangedb( char* split[], size_t column, size_t current ){
|
||||
s_skill_db entry = {};
|
||||
int skill_id = -1;
|
||||
|
||||
@ -1350,7 +1341,7 @@ static bool skill_parse_row_nonearnpcrangedb(char* split[], int column, int curr
|
||||
}
|
||||
|
||||
// Copied and adjusted from skill.cpp
|
||||
static bool skill_parse_row_skilldb(char* split[], int columns, int current) {
|
||||
static bool skill_parse_row_skilldb( char* split[], size_t columns, size_t current ){
|
||||
int arr[MAX_SKILL_LEVEL], arr_size, skill_id = atoi(split[0]);
|
||||
|
||||
body << YAML::BeginMap;
|
||||
@ -2323,7 +2314,7 @@ static bool skill_parse_row_skilldb(char* split[], int columns, int current) {
|
||||
}
|
||||
|
||||
// Copied and adjusted from quest.cpp
|
||||
static bool quest_read_db(char *split[], int columns, int current) {
|
||||
static bool quest_read_db( char *split[], size_t columns, size_t current ){
|
||||
int quest_id = atoi(split[0]);
|
||||
|
||||
if (quest_id < 0 || quest_id >= INT_MAX) {
|
||||
@ -2459,7 +2450,7 @@ static bool quest_read_db(char *split[], int columns, int current) {
|
||||
}
|
||||
|
||||
// Copied and adjusted from instance.cpp
|
||||
static bool instance_readdb_sub(char* str[], int columns, int current) {
|
||||
static bool instance_readdb_sub( char* str[], size_t columns, size_t current ){
|
||||
body << YAML::BeginMap;
|
||||
body << YAML::Key << "Id" << YAML::Value << atoi(str[0]);
|
||||
body << YAML::Key << "Name" << YAML::Value << str[1];
|
||||
@ -2498,21 +2489,21 @@ static bool instance_readdb_sub(char* str[], int columns, int current) {
|
||||
|
||||
// item_db.yml function
|
||||
//---------------------
|
||||
static bool itemdb_read_itemavail(char *str[], int columns, int current) {
|
||||
static bool itemdb_read_itemavail( char *str[], size_t columns, size_t current ){
|
||||
item_avail.insert({ strtoul(str[0], nullptr, 10), strtoul(str[1], nullptr, 10) });
|
||||
return true;
|
||||
}
|
||||
|
||||
// item_db.yml function
|
||||
//---------------------
|
||||
static bool itemdb_read_buyingstore(char* fields[], int columns, int current) {
|
||||
static bool itemdb_read_buyingstore( char* fields[], size_t columns, size_t current ){
|
||||
item_buyingstore.insert({ strtoul(fields[0], nullptr, 10), true });
|
||||
return true;
|
||||
}
|
||||
|
||||
// item_db.yml function
|
||||
//---------------------
|
||||
static bool itemdb_read_flag(char* fields[], int columns, int current) {
|
||||
static bool itemdb_read_flag( char* fields[], size_t columns, size_t current ){
|
||||
s_item_flag_csv2yaml item = { 0 };
|
||||
uint16 flag = abs(atoi(fields[1]));
|
||||
|
||||
@ -2547,7 +2538,7 @@ static bool itemdb_read_flag(char* fields[], int columns, int current) {
|
||||
|
||||
// item_db.yml function
|
||||
//---------------------
|
||||
static bool itemdb_read_itemdelay(char* str[], int columns, int current) {
|
||||
static bool itemdb_read_itemdelay( char* str[], size_t columns, size_t current ){
|
||||
s_item_delay_csv2yaml item = { 0 };
|
||||
|
||||
item.delay = atoi(str[1]);
|
||||
@ -2561,7 +2552,7 @@ static bool itemdb_read_itemdelay(char* str[], int columns, int current) {
|
||||
|
||||
// item_db.yml function
|
||||
//---------------------
|
||||
static bool itemdb_read_stack(char* fields[], int columns, int current) {
|
||||
static bool itemdb_read_stack( char* fields[], size_t columns, size_t current ){
|
||||
s_item_stack_csv2yaml item = { 0 };
|
||||
|
||||
item.amount = atoi(fields[1]);
|
||||
@ -2583,7 +2574,7 @@ static bool itemdb_read_stack(char* fields[], int columns, int current) {
|
||||
|
||||
// item_db.yml function
|
||||
//---------------------
|
||||
static bool itemdb_read_nouse(char* fields[], int columns, int current) {
|
||||
static bool itemdb_read_nouse( char* fields[], size_t columns, size_t current ){
|
||||
s_item_nouse_csv2yaml item = { 0 };
|
||||
|
||||
item.sitting = "true";
|
||||
@ -2595,7 +2586,7 @@ static bool itemdb_read_nouse(char* fields[], int columns, int current) {
|
||||
|
||||
// item_db.yml function
|
||||
//---------------------
|
||||
static bool itemdb_read_itemtrade(char* str[], int columns, int current) {
|
||||
static bool itemdb_read_itemtrade( char* str[], size_t columns, size_t current ){
|
||||
s_item_trade_csv2yaml item = { 0 };
|
||||
int flag = atoi(str[1]);
|
||||
|
||||
@ -3103,7 +3094,7 @@ static bool itemdb_read_randomopt(const char* file) {
|
||||
}
|
||||
|
||||
// Copied and adjusted from itemdb.cpp
|
||||
static bool itemdb_read_randomopt_group(char* str[], int columns, int current) {
|
||||
static bool itemdb_read_randomopt_group( char* str[], size_t columns, size_t current ){
|
||||
if ((columns - 2) % 3 != 0) {
|
||||
ShowError("itemdb_read_randomopt_group: Invalid column entries '%d'.\n", columns);
|
||||
return false;
|
||||
@ -3205,7 +3196,7 @@ static bool itemdb_randomopt_group_yaml(void) {
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool pc_readdb_levelpenalty( char* fields[], int columns, int current ){
|
||||
static bool pc_readdb_levelpenalty( char* fields[], size_t columns, size_t current ){
|
||||
// 1=experience, 2=item drop
|
||||
int type = atoi( fields[0] );
|
||||
|
||||
@ -3269,7 +3260,7 @@ bool pc_levelpenalty_yaml(){
|
||||
|
||||
// mob_db.yml function
|
||||
//--------------------
|
||||
static bool mob_readdb_race2(char *fields[], int columns, int current) {
|
||||
static bool mob_readdb_race2( char *fields[], size_t columns, size_t current ){
|
||||
int64 race;
|
||||
|
||||
if (ISDIGIT(fields[0][0]))
|
||||
@ -3300,7 +3291,7 @@ static bool mob_readdb_race2(char *fields[], int columns, int current) {
|
||||
|
||||
// mob_db.yml function
|
||||
//--------------------
|
||||
static bool mob_readdb_drop(char *str[], int columns, int current) {
|
||||
static bool mob_readdb_drop( char *str[], size_t columns, size_t current ){
|
||||
uint32 mob_id = strtoul(str[0], nullptr, 10);
|
||||
std::string *mob_name = util::umap_find(aegis_mobnames, static_cast<uint16>(mob_id));
|
||||
|
||||
@ -3347,7 +3338,7 @@ static bool mob_readdb_drop(char *str[], int columns, int current) {
|
||||
}
|
||||
|
||||
// Copied and adjusted from mob.cpp
|
||||
static bool mob_readdb_sub(char *fields[], int columns, int current) {
|
||||
static bool mob_readdb_sub( char *fields[], size_t columns, size_t current ){
|
||||
uint32 mob_id = strtoul(fields[0], nullptr, 10);
|
||||
|
||||
body << YAML::BeginMap;
|
||||
@ -3711,7 +3702,7 @@ static bool mob_readdb_sub(char *fields[], int columns, int current) {
|
||||
}
|
||||
|
||||
// Copied and adjusted from mob.cpp
|
||||
static bool mob_parse_row_chatdb(char* fields[], int columns, int current) {
|
||||
static bool mob_parse_row_chatdb( char* fields[], size_t columns, size_t current ){
|
||||
int msg_id = atoi(fields[0]);
|
||||
|
||||
if (msg_id <= 0){
|
||||
@ -3783,7 +3774,7 @@ static bool read_homunculus_expdb(const char* file) {
|
||||
}
|
||||
|
||||
// Copied and adjusted from mob.cpp
|
||||
static bool mob_readdb_group(char* str[], int columns, int current) {
|
||||
static bool mob_readdb_group( char* str[], size_t columns, size_t current ){
|
||||
if (strncasecmp(str[0], "MOBG_", 5) != 0) {
|
||||
ShowError("The group %s must start with 'MOBG_'.\n", str[0]);
|
||||
return false;
|
||||
@ -3859,8 +3850,7 @@ static bool mob_readdb_group_yaml(void) {
|
||||
}
|
||||
|
||||
// Copied and adjusted from skill.cpp
|
||||
static bool skill_parse_row_createarrowdb(char* split[], int columns, int current)
|
||||
{
|
||||
static bool skill_parse_row_createarrowdb( char* split[], size_t columns, size_t current ){
|
||||
t_itemid nameid = static_cast<t_itemid>(strtoul(split[0], nullptr, 10));
|
||||
|
||||
if (nameid == 0)
|
||||
@ -3944,7 +3934,7 @@ static bool pc_read_statsdb(const char* file) {
|
||||
}
|
||||
|
||||
// Copied and adjusted from guild.cpp
|
||||
static bool guild_read_castledb(char* str[], int columns, int current) {
|
||||
static bool guild_read_castledb( char* str[], size_t columns, size_t current ){
|
||||
body << YAML::BeginMap;
|
||||
body << YAML::Key << "Id" << YAML::Value << str[0];
|
||||
body << YAML::Key << "Map" << YAML::Value << str[1];
|
||||
@ -3955,7 +3945,7 @@ static bool guild_read_castledb(char* str[], int columns, int current) {
|
||||
}
|
||||
|
||||
// Copied and adjusted from int_guild.cpp
|
||||
static bool exp_guild_parse_row(char* split[], int column, int current) {
|
||||
static bool exp_guild_parse_row( char* split[], size_t column, size_t current ){
|
||||
t_exp exp = strtoull(split[0], nullptr, 10);
|
||||
|
||||
if (exp > MAX_GUILD_EXP) {
|
||||
@ -3972,7 +3962,7 @@ static bool exp_guild_parse_row(char* split[], int column, int current) {
|
||||
}
|
||||
|
||||
// Copied and adjusted from itemdb.cpp
|
||||
static bool itemdb_read_group(char* str[], int columns, int current) {
|
||||
static bool itemdb_read_group( char* str[], size_t columns, size_t current ){
|
||||
if (strncasecmp(str[0], "IG_", 3) != 0) {
|
||||
ShowError("The group %s must start with 'IG_'.\n", str[0]);
|
||||
return false;
|
||||
@ -4122,7 +4112,7 @@ static bool itemdb_read_group_yaml(void) {
|
||||
}
|
||||
|
||||
// Copied and adjusted from mob.cpp
|
||||
static bool mob_readdb_itemratio(char* str[], int columns, int current) {
|
||||
static bool mob_readdb_itemratio( char* str[], size_t columns, size_t current ){
|
||||
t_itemid nameid = strtoul(str[0], nullptr, 10);
|
||||
|
||||
std::string *item_name = util::umap_find(aegis_itemnames, nameid);
|
||||
@ -4222,7 +4212,7 @@ static bool status_readdb_attrfix(const char* file) {
|
||||
}
|
||||
|
||||
// Copied and adjusted from script.cpp
|
||||
static bool read_constdb(char* fields[], int columns, int current) {
|
||||
static bool read_constdb( char* fields[], size_t columns, size_t current ){
|
||||
char name[1024], val[1024];
|
||||
int type = 0;
|
||||
|
||||
@ -4252,7 +4242,7 @@ static bool read_constdb(char* fields[], int columns, int current) {
|
||||
|
||||
// job_db.yml function
|
||||
//----------------------
|
||||
static bool pc_readdb_job2(char* fields[], int columns, int current) {
|
||||
static bool pc_readdb_job2( char* fields[], size_t columns, size_t current ){
|
||||
std::vector<int> stats;
|
||||
|
||||
stats.resize(MAX_LEVEL);
|
||||
@ -4267,7 +4257,7 @@ static bool pc_readdb_job2(char* fields[], int columns, int current) {
|
||||
|
||||
// job_db.yml function
|
||||
//----------------------
|
||||
static bool pc_readdb_job_param(char* fields[], int columns, int current) {
|
||||
static bool pc_readdb_job_param( char* fields[], size_t columns, size_t current ){
|
||||
int job_id = atoi(fields[0]);
|
||||
s_job_param entry = {};
|
||||
|
||||
@ -4285,7 +4275,7 @@ static bool pc_readdb_job_param(char* fields[], int columns, int current) {
|
||||
|
||||
// job_basehpsp_db.yml function
|
||||
//----------------------
|
||||
static bool pc_readdb_job_exp_sub(char* fields[], int columns, int current) {
|
||||
static bool pc_readdb_job_exp_sub( char* fields[], size_t columns, size_t current ){
|
||||
int level = atoi(fields[0]), jobs[CLASS_COUNT], job_count = skill_split_atoi(fields[1], jobs, CLASS_COUNT), type = atoi(fields[2]);
|
||||
|
||||
for (int i = 0; i < job_count; i++) {
|
||||
@ -4299,7 +4289,7 @@ static bool pc_readdb_job_exp_sub(char* fields[], int columns, int current) {
|
||||
}
|
||||
|
||||
// Copied and adjusted from pc.cpp
|
||||
static bool pc_readdb_job_exp(char* fields[], int columns, int current) {
|
||||
static bool pc_readdb_job_exp( char* fields[], size_t columns, size_t current ){
|
||||
int level = atoi(fields[0]), jobs[CLASS_COUNT], job_count = skill_split_atoi(fields[1], jobs, CLASS_COUNT), type = atoi(fields[2]);
|
||||
|
||||
body << YAML::BeginMap;
|
||||
@ -4337,7 +4327,7 @@ static bool pc_readdb_job_exp(char* fields[], int columns, int current) {
|
||||
}
|
||||
|
||||
// Copied and adjusted from pc.cpp
|
||||
static bool pc_readdb_job_basehpsp(char* fields[], int columns, int current) {
|
||||
static bool pc_readdb_job_basehpsp( char* fields[], size_t columns, size_t current ){
|
||||
int type = atoi(fields[3]), jobs[CLASS_COUNT], job_count = skill_split_atoi(fields[2], jobs, CLASS_COUNT);
|
||||
|
||||
body << YAML::BeginMap;
|
||||
@ -4401,7 +4391,7 @@ static bool pc_readdb_job_basehpsp(char* fields[], int columns, int current) {
|
||||
}
|
||||
|
||||
// Copied and adjusted from pc.cpp
|
||||
static bool pc_readdb_job1(char* fields[], int columns, int current) {
|
||||
static bool pc_readdb_job1( char* fields[], size_t columns, size_t current ){
|
||||
int job_id = atoi(fields[0]);
|
||||
|
||||
if (job_id == JOB_WEDDING)
|
||||
@ -4499,7 +4489,7 @@ static bool pc_readdb_job1(char* fields[], int columns, int current) {
|
||||
|
||||
// elemental_db.yml function
|
||||
//---------------------------
|
||||
static bool read_elemental_skilldb(char* str[], int columns, int current) {
|
||||
static bool read_elemental_skilldb( char* str[], size_t columns, size_t current ){
|
||||
uint16 skill_id = atoi(str[1]);
|
||||
std::string *skill_name = util::umap_find(aegis_skillnames, skill_id);
|
||||
|
||||
@ -4533,7 +4523,7 @@ static bool read_elemental_skilldb(char* str[], int columns, int current) {
|
||||
}
|
||||
|
||||
// Copied and adjusted from elemental.cpp
|
||||
static bool read_elementaldb(char* str[], int columns, int current) {
|
||||
static bool read_elementaldb( char* str[], size_t columns, size_t current ){
|
||||
body << YAML::BeginMap;
|
||||
body << YAML::Key << "Id" << YAML::Value << str[0];
|
||||
body << YAML::Key << "AegisName" << YAML::Value << str[1];
|
||||
@ -4609,7 +4599,7 @@ static bool read_elementaldb(char* str[], int columns, int current) {
|
||||
|
||||
// mercenary_db.yml function
|
||||
//---------------------------
|
||||
static bool mercenary_read_skilldb(char* str[], int columns, int current) {
|
||||
static bool mercenary_read_skilldb( char* str[], size_t columns, size_t current ){
|
||||
uint16 skill_id = atoi(str[1]);
|
||||
std::string *skill_name = util::umap_find(aegis_skillnames, skill_id);
|
||||
|
||||
@ -4636,7 +4626,7 @@ static bool mercenary_read_skilldb(char* str[], int columns, int current) {
|
||||
}
|
||||
|
||||
// Copied and adjusted from mercenary.cpp
|
||||
static bool mercenary_readdb(char* str[], int columns, int current) {
|
||||
static bool mercenary_readdb( char* str[], size_t columns, size_t current ){
|
||||
body << YAML::BeginMap;
|
||||
body << YAML::Key << "Id" << YAML::Value << str[0];
|
||||
body << YAML::Key << "AegisName" << YAML::Value << str[1];
|
||||
@ -4716,7 +4706,7 @@ static bool mercenary_readdb(char* str[], int columns, int current) {
|
||||
}
|
||||
|
||||
// Copied and adjusted from pc.cpp
|
||||
static bool pc_readdb_skilltree(char* fields[], int columns, int current) {
|
||||
static bool pc_readdb_skilltree( char* fields[], size_t columns, size_t current ){
|
||||
uint16 baselv, joblv, offset;
|
||||
uint16 class_ = (uint16)atoi(fields[0]);
|
||||
uint16 skill_id = (uint16)atoi(fields[1]);
|
||||
@ -4947,7 +4937,7 @@ static bool itemdb_read_combos(const char* file) {
|
||||
}
|
||||
|
||||
// Copied and adjusted from cashshop.cpp
|
||||
static bool cashshop_parse_dbrow( char* fields[], int columns, int current ){
|
||||
static bool cashshop_parse_dbrow( char* fields[], size_t columns, size_t current ){
|
||||
uint16 tab = atoi( fields[0] );
|
||||
t_itemid nameid = strtoul( fields[1], nullptr, 10 );
|
||||
uint32 price = atoi( fields[2] );
|
||||
@ -4994,7 +4984,7 @@ static bool cashshop_parse_dbrow( char* fields[], int columns, int current ){
|
||||
|
||||
// homunculus_db.yml function
|
||||
//---------------------------
|
||||
static bool read_homunculus_skilldb(char* split[], int columns, int current) {
|
||||
static bool read_homunculus_skilldb( char* split[], size_t columns, size_t current ){
|
||||
s_homun_skill_tree_entry entry = {};
|
||||
|
||||
entry.id = atoi(split[1]);
|
||||
@ -5022,7 +5012,7 @@ static bool compareHomSkillId(const s_homun_skill_tree_entry &a, const s_homun_s
|
||||
}
|
||||
|
||||
// Copied and adjusted from homunculus.cpp
|
||||
static bool read_homunculusdb(char* str[], int columns, int current) {
|
||||
static bool read_homunculusdb( char* str[], size_t columns, size_t current ){
|
||||
bool has_evo = false;
|
||||
|
||||
body << YAML::BeginMap;
|
||||
|
@ -476,65 +476,65 @@ void init_random_option_constants() {
|
||||
#undef export_constant2
|
||||
}
|
||||
|
||||
static bool guild_read_guildskill_tree_db( char* split[], int columns, int current );
|
||||
static bool guild_read_guildskill_tree_db( char* split[], size_t columns, size_t current );
|
||||
static bool pet_read_db( const char* file );
|
||||
static bool skill_parse_row_magicmushroomdb(char *split[], int column, int current);
|
||||
static bool skill_parse_row_abradb(char* split[], int columns, int current);
|
||||
static bool skill_parse_row_spellbookdb(char* split[], int columns, int current);
|
||||
static bool mob_readdb_mobavail(char *str[], int columns, int current);
|
||||
static bool skill_parse_row_requiredb(char* split[], int columns, int current);
|
||||
static bool skill_parse_row_castdb(char* split[], int columns, int current);
|
||||
static bool skill_parse_row_castnodexdb(char* split[], int columns, int current);
|
||||
static bool skill_parse_row_unitdb(char* split[], int columns, int current);
|
||||
static bool skill_parse_row_copyabledb(char* split[], int columns, int current);
|
||||
static bool skill_parse_row_nonearnpcrangedb(char* split[], int columns, int current);
|
||||
static bool skill_parse_row_skilldb(char* split[], int columns, int current);
|
||||
static bool quest_read_db(char *split[], int columns, int current);
|
||||
static bool instance_readdb_sub(char* str[], int columns, int current);
|
||||
static bool itemdb_read_itemavail(char *str[], int columns, int current);
|
||||
static bool itemdb_read_buyingstore(char* fields[], int columns, int current);
|
||||
static bool itemdb_read_flag(char* fields[], int columns, int current);
|
||||
static bool itemdb_read_itemdelay(char* str[], int columns, int current);
|
||||
static bool itemdb_read_stack(char* fields[], int columns, int current);
|
||||
static bool itemdb_read_nouse(char* fields[], int columns, int current);
|
||||
static bool itemdb_read_itemtrade(char* fields[], int columns, int current);
|
||||
static bool skill_parse_row_magicmushroomdb( char* split[], size_t columns, size_t current );
|
||||
static bool skill_parse_row_abradb( char* split[], size_t columns, size_t current );
|
||||
static bool skill_parse_row_spellbookdb( char* split[], size_t columns, size_t current );
|
||||
static bool mob_readdb_mobavail( char* str[], size_t columns, size_t current );
|
||||
static bool skill_parse_row_requiredb( char* split[], size_t columns, size_t current );
|
||||
static bool skill_parse_row_castdb( char* split[], size_t columns, size_t current );
|
||||
static bool skill_parse_row_castnodexdb( char* split[], size_t columns, size_t current );
|
||||
static bool skill_parse_row_unitdb( char* split[], size_t columns, size_t current );
|
||||
static bool skill_parse_row_copyabledb( char* split[], size_t columns, size_t current );
|
||||
static bool skill_parse_row_nonearnpcrangedb( char* split[], size_t columns, size_t current );
|
||||
static bool skill_parse_row_skilldb( char* split[], size_t columns, size_t current );
|
||||
static bool quest_read_db( char* split[], size_t columns, size_t current );
|
||||
static bool instance_readdb_sub( char* str[], size_t columns, size_t current );
|
||||
static bool itemdb_read_itemavail( char* str[], size_t columns, size_t current );
|
||||
static bool itemdb_read_buyingstore( char* fields[], size_t columns, size_t current );
|
||||
static bool itemdb_read_flag( char* fields[], size_t columns, size_t current );
|
||||
static bool itemdb_read_itemdelay( char* str[], size_t columns, size_t current );
|
||||
static bool itemdb_read_stack( char* fields[], size_t columns, size_t current );
|
||||
static bool itemdb_read_nouse( char* fields[], size_t columns, size_t current );
|
||||
static bool itemdb_read_itemtrade( char* fields[], size_t columns, size_t current );
|
||||
static bool itemdb_read_db(const char *file);
|
||||
static bool itemdb_read_randomopt(const char* file);
|
||||
static bool itemdb_read_randomopt_group(char *str[], int columns, int current);
|
||||
static bool itemdb_read_randomopt_group( char* str[], size_t columns, size_t current );
|
||||
static bool itemdb_randomopt_group_yaml(void);
|
||||
static bool pc_readdb_levelpenalty(char* fields[], int columns, int current);
|
||||
static bool pc_readdb_levelpenalty( char* fields[], size_t columns, size_t current );
|
||||
static bool pc_levelpenalty_yaml();
|
||||
static bool mob_parse_row_chatdb(char* fields[], int columns, int current);
|
||||
static bool mob_parse_row_chatdb( char* fields[], size_t columns, size_t current );
|
||||
static bool read_homunculus_expdb(const char* file);
|
||||
static bool mob_readdb_group(char* str[], int columns, int current);
|
||||
static bool mob_readdb_group( char* str[], size_t columns, size_t current );
|
||||
static bool mob_readdb_group_yaml(void);
|
||||
static bool skill_parse_row_createarrowdb(char* fields[], int columns, int current);
|
||||
static bool skill_parse_row_createarrowdb( char* fields[], size_t columns, size_t current );
|
||||
static bool pc_read_statsdb(const char* file);
|
||||
static bool guild_read_castledb(char* str[], int columns, int current);
|
||||
static bool exp_guild_parse_row(char* split[], int column, int current);
|
||||
static bool itemdb_read_group(char* fields[], int columns, int current);
|
||||
static bool guild_read_castledb( char* str[], size_t columns, size_t current );
|
||||
static bool exp_guild_parse_row( char* split[], size_t columns, size_t current );
|
||||
static bool itemdb_read_group( char* fields[], size_t columns, size_t current );
|
||||
static bool itemdb_read_group_yaml(void);
|
||||
static bool mob_readdb_itemratio(char* fields[], int columns, int current);
|
||||
static bool mob_readdb_itemratio( char* fields[], size_t columns, size_t current );
|
||||
static bool status_readdb_attrfix(const char* file);
|
||||
static bool read_constdb(char* fields[], int columns, int current);
|
||||
static bool mob_readdb_race2(char *fields[], int columns, int current);
|
||||
static bool mob_readdb_drop(char *str[], int columns, int current);
|
||||
static bool mob_readdb_sub(char *fields[], int columns, int current);
|
||||
static bool pc_readdb_job2(char *fields[], int columns, int current);
|
||||
static bool pc_readdb_job_param(char *fields[], int columns, int current);
|
||||
static bool pc_readdb_job_exp(char *fields[], int columns, int current);
|
||||
static bool pc_readdb_job_exp_sub(char *fields[], int columns, int current);
|
||||
static bool pc_readdb_job_basehpsp(char *fields[], int columns, int current);
|
||||
static bool pc_readdb_job1(char *fields[], int columns, int current);
|
||||
static bool read_elemental_skilldb(char* str[], int columns, int current);
|
||||
static bool read_elementaldb(char* str[], int columns, int current);
|
||||
static bool mercenary_read_skilldb(char* str[], int columns, int current);
|
||||
static bool mercenary_readdb(char* str[], int columns, int current);
|
||||
static bool pc_readdb_skilltree(char* str[], int columns, int current);
|
||||
static bool read_constdb( char* fields[], size_t columns, size_t current );
|
||||
static bool mob_readdb_race2( char* fields[], size_t columns, size_t current );
|
||||
static bool mob_readdb_drop( char* str[], size_t columns, size_t current );
|
||||
static bool mob_readdb_sub( char* fields[], size_t columns, size_t current );
|
||||
static bool pc_readdb_job2( char* fields[], size_t columns, size_t current );
|
||||
static bool pc_readdb_job_param( char* fields[], size_t columns, size_t current );
|
||||
static bool pc_readdb_job_exp( char* fields[], size_t columns, size_t current );
|
||||
static bool pc_readdb_job_exp_sub( char* fields[], size_t columns, size_t current );
|
||||
static bool pc_readdb_job_basehpsp( char* fields[], size_t columns, size_t current );
|
||||
static bool pc_readdb_job1( char* fields[], size_t columns, size_t current );
|
||||
static bool read_elemental_skilldb( char* str[], size_t columns, size_t current );
|
||||
static bool read_elementaldb( char* str[], size_t columns, size_t current );
|
||||
static bool mercenary_read_skilldb( char* str[], size_t columns, size_t current );
|
||||
static bool mercenary_readdb( char* str[], size_t columns, size_t current );
|
||||
static bool pc_readdb_skilltree( char* str[], size_t columns, size_t current );
|
||||
static bool pc_readdb_skilltree_yaml(void);
|
||||
static bool itemdb_read_combos(const char* file);
|
||||
static bool cashshop_parse_dbrow( char* fields[], int columns, int current );
|
||||
static bool read_homunculus_skilldb(char* split[], int columns, int current);
|
||||
static bool read_homunculusdb(char* str[], int columns, int current);
|
||||
static bool cashshop_parse_dbrow( char* fields[], size_t columns, size_t current );
|
||||
static bool read_homunculus_skilldb( char* split[], size_t columns, size_t current );
|
||||
static bool read_homunculusdb( char* str[], size_t columns, size_t current );
|
||||
|
||||
#endif /* CSV2YAML_HPP */
|
||||
|
@ -593,7 +593,7 @@ void ItemDatabase::loadingFinished() {
|
||||
|
||||
ItemDatabase item_db;
|
||||
|
||||
static bool parse_mob_constants_txt(char *split[], int columns, int current) {
|
||||
static bool parse_mob_constants_txt( char *split[], size_t columns, size_t current ){
|
||||
uint16 mob_id = atoi(split[0]);
|
||||
char *name = trim(split[1]);
|
||||
|
||||
@ -602,7 +602,7 @@ static bool parse_mob_constants_txt(char *split[], int columns, int current) {
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool parse_skill_constants_txt(char *split[], int columns, int current) {
|
||||
static bool parse_skill_constants_txt( char *split[], size_t columns, size_t current ){
|
||||
uint16 skill_id = atoi(split[0]);
|
||||
char *name = trim(split[16]);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user