summaryrefslogtreecommitdiff
path: root/src/common/strlib.c
AgeCommit message (Collapse)AuthorFilesLines
2015-01-20Minor fixes and tweaks suggested by cppcheckHaru1-6/+5
- Variable scopes reduced - Parenthesized ambiguous expressions - Removed or added NULL checks where (un)necessary - Corrected format strings - Fixed typos potentially leading to bugs Signed-off-by: Haru <haru@dotalux.com>
2014-11-16Whitespace cleanup (no code changes)Haru1-7/+9
This includes, and is not limited to: mixed or wrong indentation, excess whitespace (horizontal and vertical), misalignment, trailing spaces. Signed-off-by: Haru <haru@dotalux.com>
2014-11-16Added missing strlib->jstrescapecpy initializationHaru1-0/+1
Signed-off-by: Haru <haru@dotalux.com>
2014-11-16Moved strlib_s, stringbuf_s and sv_s into strlib.cHaru1-0/+4
Signed-off-by: Haru <haru@dotalux.com>
2014-08-07Corrected several format-string errors through the codeHaru1-5/+5
- Functions that expect a printf-style format string are now marked as such, so that gcc/clang will emit a warning warn you if you mismatch format string and arguments. Signed-off-by: Haru <haru@dotalux.com>
2014-07-11Fixed reserved __identifier violationsHaru1-3/+3
- Complies with CERT DCL37-C - Fixes issue #293 (special thanks to elfring) Signed-off-by: Haru <haru@dotalux.com>
2014-05-30Fixed typos inside src/Shido1-16/+16
2014-05-13Removed trailing whitespace (sources)Haru1-6/+6
Signed-off-by: Haru <haru@dotalux.com>
2014-05-10Re-commit of "Fixed order of includes in all source files"Haru1-5/+8
This reverts commit 94657284973f4037596bae468ebfbee5c217e02b.
2014-05-10Revert "Fixed order of includes in all source files"panikon1-8/+5
This reverts commit b6b3f58795288701d0e162d43fa6f0a47af913b3. Fixes issue 8184 http://hercules.ws/board/tracker/issue-8184-cart-related/
2014-05-09Fixed order of includes in all source filesHaru1-5/+8
- Changed order according to the (upcoming) code style guidelines. - Fixes several issues caused by missing headers when their include order is changed or in plugins. Signed-off-by: Haru <haru@dotalux.com>
2014-01-23Minor fixes to the strlib interfaceHaru1-9/+25
- Fixed a typo in the strnlen() macro (was strnln) - Initialized strlib->strnlen and strlib->strtoull to NULL on platforms that don't require them. Please note that those two functions are supposed to never be called directly but only through the strnlen() and strtoull() macros, which take care of the platform abstraction. - Removed localized versions of yes/no from config_switch (if you really want to be able to use "oui", "ja", "si", "non", "nein", feel free to add them back yourself following the example in strlib.c) Signed-off-by: Haru <haru@dotalux.com>
2013-12-17Fixed several compiler warningsHaru1-9/+10
- Warnings detected thanks to Xcode's compiler settings (more strict by default) and clang, warnings mostly but not only related to data sizes on 64 bit systems, that were silenced until now by very lax compiler settings. - This also decreases by a great deal the amount of warnings produced by MSVC in x64 mode (for the adventurous ones who tried that) - Also fixed (or silenced in case of false positives) the potential issues pointed out by the (awesome) clang static analyzer. - Patch co-produced with Ind, I'm merging and committing in his place! Signed-off-by: Haru <haru@dotalux.com>
2013-09-25Renamed more forgotten variables during interface conversionsHaru1-27/+27
(related: b9c8f57) Most renames are trivial (just to avoid shadowing global variables, even if they currently did no harm), but there were some cases of partly renamed variables that caused some NULL checks to always pass and who knows what could have been happened when they were too subtle to make the application crash. Also corrected some potentially unsafe macro definitions Signed-off-by: Haru <haru@dotalux.com>
2013-05-15Fixed Bug #7246shennetsind1-1/+1
http://hercules.ws/board/tracker/issue-7246-compiling-in-vstudio/ Signed-off-by: shennetsind <ind@henn.et>
2013-05-15HPM Updateshennetsind1-188/+174
Made SQL and strlib functions HPM-friendly, special thanks to Yommy for bringing the issue up. Added partial map.c support, for the all-handy map[] array, beware that soon the whole map.c renewal design will be commit and when that happens your usage of map.c functions in plugins might require some updates. Signed-off-by: shennetsind <ind@henn.et>
2012-12-05- Undid r16968: SVN Replaced with source:/trunk/src/@16966 (tid:74924).brianluau1-848/+881
[16969:16991/trunk/src/] will be re-committed in the next 24 hours. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@16992 54d463be-8e91-2dee-dedb-b68131a5f0ec
2012-11-25Applied AStyle code formating as discussed on tid:74602.greenboxal21-881/+848
Removed /SAFESEH option from MSVC11 projects. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@16968 54d463be-8e91-2dee-dedb-b68131a5f0ec
2012-02-14Removed deprecated memory manager macros (follow-up to r14916).gepard19841-1/+1
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@15581 54d463be-8e91-2dee-dedb-b68131a5f0ec
2011-09-08* Fix C++ compilation issues.flaviojs1-2/+2
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14955 54d463be-8e91-2dee-dedb-b68131a5f0ec
2011-06-16* Merges from charmerge:flaviojs1-47/+89
- Added DBMap::exists. (r14090) - Added sv_parse_next, a stepped version of sv_parse (delim-separated parser). (r14100 r14104) - Added missing fd check to do_close. (r14145) - Normalized, refactored and restructured some code (in preparation for shutdown/reconnect code). (r14145 r14150) - Changed the char select request code to allow the char-server to reject it. (player in map-server trying to go to char select) (r14150) - Added shutdown support to the servers. (incomplete) (r14152) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14851 54d463be-8e91-2dee-dedb-b68131a5f0ec
2011-02-16* Updated configure/make scripts to resolve various issues.ai4rei1-2/+1
- Added detection whether or not -fPIC switch is required when compiling shared objects (plug-ins) to resolve compile issues on 64-bit platforms (topic:208746). - Native 'strnlen' implementations are now detected and disable the one in strlib (bugreport:1261). - Define 'DB_MANUAL_CAST_TO_UNION' is now set when necessary (bugreport:1261). git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14708 54d463be-8e91-2dee-dedb-b68131a5f0ec
2011-01-04* Added support for removal of trailing comments to sv_readdb (bugreport:4680).ai4rei1-3/+7
- Disabled monster BACSOJIN_T (1996) whose drop White Snake Hat (5411) is not enabled (was hidden by '//', which would cause errors now) (since r14412). git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14649 54d463be-8e91-2dee-dedb-b68131a5f0ec
2010-12-16* Reverted r14525 (introduction of SV_READDB_MAX_FIELDS) because it causes ↵ai4rei1-10/+8
confusion to certain group of users and depends on MAX_LEVEL since r14526. - Made sv_readdb be able to process any amount of columns instead. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14595 54d463be-8e91-2dee-dedb-b68131a5f0ec
2010-12-16* Fixed a mistake in sv_split, causing CR being recognized as EOL character, ↵ai4rei1-1/+1
even when only LF was specified (since r12459). git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14594 54d463be-8e91-2dee-dedb-b68131a5f0ec
2010-11-30* Made job_db1.txt, job_db2.txt, size_fix.txt and refine_db.txt reading use ↵ai4rei1-1/+1
sv_readdb. - NOTE: Any MAX_LEVEL (map.h) increase requires at least same increase of SV_READDB_MAX_FIELDS as well. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14526 54d463be-8e91-2dee-dedb-b68131a5f0ec
2010-11-30* Added SV_READDB_MAX_FIELDS define for configuration of the sv_readdb limit.ai4rei1-2/+2
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14525 54d463be-8e91-2dee-dedb-b68131a5f0ec
2010-11-19* Various VC6-related fixes and tweaks. [Ai4rei]ai4rei1-2/+7
- Fixed a typo in VC6 project files, that prevented login-server from compiling (bugreport:4061, since r12727). - Fixed usage of 'long long' in Sql_P_BindSqlDataType preventing SQL VC6 projects from compiling (bugreport:1741, since r10779). - Fixed usage of 'long long' in strtoull preventing VC6 projects from compiling (bugreport:4059, follow up to r14245). - Made strtoull default to base 10 and actually process base 8, to match the normal behavior of this function (bugreport:4059, follow up to r14245). - Fixed functions in db.c not being returned as pointer, causing warnings on VC6. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14466 54d463be-8e91-2dee-dedb-b68131a5f0ec
2010-02-15Added visual studio equivalent of libc's strtoull() - name redefine for ↵ultramage1-0/+39
newer VS versions, custom implementation for VS6 (I hope it works). This should fix the compilation error from r14242 (bugreport:4059). git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14245 54d463be-8e91-2dee-dedb-b68131a5f0ec
2009-04-20* Fixed safestrncpy trashing the memory before dst when n == 0. (since ↵FlavioJS1-6/+17
r10667, bugreport:2996) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@13681 54d463be-8e91-2dee-dedb-b68131a5f0ec
2009-03-13Corrected a potentially uninitialized variable in sv_parse (bugreport:2860).ultramage1-1/+2
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@13581 54d463be-8e91-2dee-dedb-b68131a5f0ec
2009-02-25* Wrong variable being used in StringBuf_Vprintf. (follow up to r13386, ↵FlavioJS1-1/+1
fixes bugreport:2798) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@13548 54d463be-8e91-2dee-dedb-b68131a5f0ec
2008-12-25* Extended sv_escape_c to escape '\a','\b','\t','\v','\f','\?' characters to ↵FlavioJS1-4/+15
their respective representations instead of octal. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@13414 54d463be-8e91-2dee-dedb-b68131a5f0ec
2008-11-24* Fixed a va_end using the wrong variable. (from r13383, fixes bugreport:2483)FlavioJS1-1/+1
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@13386 54d463be-8e91-2dee-dedb-b68131a5f0ec
2008-11-22* Hunted down improper uses of va_list variables.FlavioJS1-0/+3
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@13383 54d463be-8e91-2dee-dedb-b68131a5f0ec
2008-08-09Fixed login printing raw passwdenc passwords to console (bugreport:826).ultramage1-0/+22
Added strlib function bin2hex(). Cleaned up the md5calc interface a bit. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@13055 54d463be-8e91-2dee-dedb-b68131a5f0ec
2008-04-23* Fixed script strings not being handled properly (only skipped the \).FlavioJS1-5/+38
* Added skip_escaped_c to strlib.c/h. * Fixed sv_unescape_c not handling hex/octal escapes properly. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12639 54d463be-8e91-2dee-dedb-b68131a5f0ec
2008-04-22Fixed a "bug" in sv_readdb under windows and cygwin configured as ↵toms1-1/+1
"Unix/binary" for text files ('\r' is read and empty lines are not skipped) bugreport:1382 bugreport:1401 git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12634 54d463be-8e91-2dee-dedb-b68131a5f0ec
2008-04-17Modified sv_readdb to be able to process non-native line terminators ↵ultramage1-1/+1
(bugreport:1382) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12610 54d463be-8e91-2dee-dedb-b68131a5f0ec
2008-04-15 * Corrected some invalid syntax in skill_db.txt (wrong usage of commas)ultramage1-0/+80
* Renamed BA_FROSTJOKE to BA_FROSTJOKER (aegis server-side name) * Implemented a generic framework for parsing delimited db files (allows specifying min/max column ranges and max number of rows to read) * Corrected a typo in quest_update_objective() * Cleaned up pc.c a bit git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12599 54d463be-8e91-2dee-dedb-b68131a5f0ec
2008-04-02* Added SV_KEEP_TERMINATOR option to not split the line terminator.FlavioJS1-17/+21
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12461 54d463be-8e91-2dee-dedb-b68131a5f0ec
2008-04-02* Added sv_split to strlib.c/h (similar to sv_parse).FlavioJS1-7/+92
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12459 54d463be-8e91-2dee-dedb-b68131a5f0ec
2008-03-26Adjusted eAthena code to compile cleanly in C++ mode.ultramage1-1/+1
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12436 54d463be-8e91-2dee-dedb-b68131a5f0ec
2008-02-16Removed some useless svn:ignore properties.ultramage1-1/+1
Fixed a compilation problem. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12211 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-12-09* Added a generic 'delimiter-separated values' string parser to strlib.c/h.FlavioJS1-0/+337
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11878 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-11-27* Added safesnprintf to strlib.c/h (bugreport:372)FlavioJS1-0/+25
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11828 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-10-17* Reworked the parsing at npc.c.FlavioJS1-0/+20
- Fixes npc.c discarding the '}' at the end of file, when there is no newline. (uncovered as a side-effect of r11487) * Empty script functions always have code now (won't report as missing when you try to call them). * Changed userfunc_db to not limit the name to 50 characters. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11502 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-09-22* Added 'safestrnlen' to prevent null pointer crashesultramage1-0/+6
* Fixed global chat logging always crashing on a null pointer * Applied changes to clif_parse_globalmessage() from my WiP code - clearer processing of the individual packet components - proper code ordering, some more integrity checks - fixes to some poorly chosen ShowWarning() format strings - global chat logging no longer logs the entire string (w/ player name) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11271 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-09-20* Merged the tmpsql branch:FlavioJS1-2/+132
- Abstraction for the sql code (sql.c/h). - New configure script and makefiles. - Restored txt zeny logging code. (r10814) - Rewrote mapserver's sql code - itemdb, mobdb, mapreg, logs. (r10814) - Fixed a precedence issue (&& and ) in char_sql/char.c. (r10833) - Improved db reading code a bit for consistency. (r11077) - Added separate atcommand for mail deletion. (r11077) - Corrected a few messages that said "new" instead of "unread". (r11077) - Broadcast (*) messages now use "*" as the target's name (not ""). (r11077) - Moved StringBuf code from utils.c/h to strlib.c/h. (r11084 r11117) - Some misc login server cleanups (reformatting etc). (r11136) - Corrected/modified some header entries. (r11141 r11147 11148) - Adjusted VS project files. (r11147) - Adjusted the way the sql charserver does item saving. (r11192) - Corrected usage of reserved keyword 'friend' in mmo.h. (r11192) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11245 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-06-02* Displaying op names instead of numbers in script engine errors.FlavioJS1-4/+15
* Fixed a bug introduced in the last rework of the fame ranking. * Created safestrncpy that ensures the string is nul-terminated. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@10667 54d463be-8e91-2dee-dedb-b68131a5f0ec