summaryrefslogtreecommitdiff
path: root/src/common/strlib.c
AgeCommit message (Collapse)AuthorFilesLines
2015-12-15Added GPL-compliant header to all sources and build scriptsHaru1-4/+20
Signed-off-by: Haru <haru@dotalux.com>
2015-10-19rename malloc.c/h to memmgr.Andrei Karas1-1/+1
2015-09-25More aggressive whitespace cleanup. Follow up to 51329e6Haru1-5/+0
Signed-off-by: Haru <haru@dotalux.com>
2015-08-15HPM compatibility improvementsHaru1-0/+4
Improved compatibility, portability and standards conformance. - Since it is not possible to portably and reliably re-use the core's symbols in plugins, symbols are no longer exported unless explicitly required, in the UNIX builds. This mimics the Windows behavior and adds HPM compatibility to OSes such as FreeBSD. Credits to Andrei Karas for making this possible. - For convenience, it is no longer necessary to call GET_SYMBOL, since the plugin will automatically import all the available symbols when it's loaded, depending on the included headers. - Plugins are now supposed to include the "common/hercules.h" header before including anything else. Incluing common/HPMi.h, common/cbasetypes.h or conf/core.h is no longer necessary, as those are guaranteed to be automatically included by hercules.h. - HPM API version bumped to 1.1. Signed-off-by: Haru <haru@dotalux.com>
2015-08-15Cleaned up strlib interfaceHaru1-77/+39
- Replaced some macro calls with the proper interface syntax - Removed useless macros and workarounds - Removed no longer needed library function re-definitions API changes summary: - The macros remove_control_chars(), trim(), normalize_name(), stristr(), e_mail_check(), config_switch(), safestrncpy(), safestrnlen(), safesnprintf(), strline(), bin2hex() can now be safely used both inside and outside strlib.c - The macros strnlen() and strtok_r() can now be safely used both inside and outside strlib.c, on the systems where they are necessary. The systems that provide those natively, aren't affected by this change. - jstrescape() is now strlib->jstrescape() - jstrescapecpy() is now strlib->jstrescapecpy() - jmemescapecpy() is now strlib->jmemescapecpy() - a custom strtoull() implementation is no longer provided, since all supported systems and compilers provide a library implementation. Signed-off-by: Haru <haru@dotalux.com>
2015-06-19Removed ".." from include directivesHaru1-4/+4
- Include directives are now directory-independent. - This will allow building plugins from other directories in future. Signed-off-by: Haru <haru@dotalux.com>
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