patch4.txt

Uploaded: 09 Jan, 2009
Previous uploads by this submitter: 0

Author: Ghasatta

Downloads: 52

Patch to add std::string OLC utilities to the Fire branch of RaM. This is bridge code necessary before the underlying data structures can have their 'char *' members converted to std::string members.

Summary of changes:
merc.h - added pString_std to descriptor_data structure to support editing std::string's via OLC.

olc.h / olc_utils.c -
* Modified functions to all check both the pString and pString_std pointers to decide if the currently edited string is a c-style string or std::string.
* Added utility functions for string_append(), string_linedel(), and string_lineadd() with std::string arguments.
* Broke up format_string() - all the logic is now in format_string_const(), which takes a 'const char *' arg and always allocates a new string for its return value. Changed format_string() to call format_string_const() and perform some manual memory management. Also added a version of format_string() that takes a std::string arg.
* Changed return type and arg types of numelineas() and getline() functions to be 'const char *' from 'char *'. A little safer this way and now these functions can be used with std::string's c_str() pointer.

comm.c - Initializer for descriptor_data::pString_std.