Freeciv21
Develop your civilization from humble roots to a global empire
support.cpp File Reference

This module contains replacements for functions which are not available on all platforms. More...

#include <fc_config.h>
#include <cmath>
#include <cstdarg>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <sys/stat.h>
#include <QFileInfo>
#include <QHostInfo>
#include <QString>
#include <QThread>
#include "fciconv.h"
#include "fcintl.h"
#include "log.h"
#include "support.h"
+ Include dependency graph for support.cpp:

Go to the source code of this file.

Macros

#define VSNP_BUF_SIZE   (64 * 1024)
 vsnprintf() replacement using a big malloc()ed internal buffer, originally by David Pfitzner dwp@m.nosp@m.so.a.nosp@m.nu.ed.nosp@m.u.au More...
 

Functions

char * real_fc_strdup (const char *str, const char *called_as, int line, const char *file)
 Function used by fc_strdup macro, strdup() replacement No need to check return value. More...
 
int fc_strcasecmp (const char *str0, const char *str1)
 Compare strings like strcmp(), but ignoring case. More...
 
int fc_strncasecmp (const char *str0, const char *str1, size_t n)
 Compare strings like strncmp(), but ignoring case. More...
 
void make_escapes (const char *str, char *buf, size_t buf_len)
 Copies a string and convert the following characters: More...
 
QString remove_escapes (const QString &str, bool full_escapes)
 Copies a string. More...
 
size_t effectivestrlenquote (const char *str)
 Count length of string without possible surrounding quotes. More...
 
int fc_strncasequotecmp (const char *str0, const char *str1, size_t n)
 Compare strings like strncasecmp() but ignoring surrounding quotes in either string. More...
 
int fc_strcoll (const char *str0, const char *str1)
 Wrapper function for strcoll(). More...
 
int fc_stricoll (const char *str0, const char *str1)
 Wrapper function for stricoll(). More...
 
FILE * fc_fopen (const char *filename, const char *opentype)
 Wrapper function for fopen() with filename conversion to local encoding on Windows. More...
 
int fc_remove (const char *filename)
 Wrapper function for remove() with filename conversion to local encoding on Windows. More...
 
int fc_stat (const char *filename, struct stat *buf)
 Wrapper function for stat() with filename conversion to local encoding on Windows. More...
 
fc_errno fc_get_errno ()
 Returns last error code. More...
 
const char * fc_strerror (fc_errno err)
 Return a string which describes a given error (errno-style.) The string is converted as necessary from the local_encoding to internal_encoding, for inclusion in translations. More...
 
void fc_usleep (unsigned long usec)
 Suspend execution for the specified number of microseconds. More...
 
bool fc_strrep (char *str, size_t len, const char *search, const char *replace)
 Replace 'search' by 'replace' within 'str'. More...
 
size_t fc_strlcpy (char *dest, const char *src, size_t n)
 fc_strlcpy() provides utf-8 version of (non-standard) function strlcpy() It is intended as more user-friendly version of strncpy(), in particular easier to use safely and correctly, and ensuring nul-terminated results while being able to detect truncation. More...
 
size_t fc_strlcat (char *dest, const char *src, size_t n)
 fc_strlcat() provides utf-8 version of (non-standard) function strlcat() It is intended as more user-friendly version of strncat(), in particular easier to use safely and correctly, and ensuring nul-terminated results while being able to detect truncation. More...
 
int fc_vsnprintf (char *str, size_t n, const char *format, va_list ap)
 
int fc_snprintf (char *str, size_t n, const char *format,...)
 See also fc_utf8_snprintf_trunc(), fc_utf8_snprintf_rep(). More...
 
int cat_snprintf (char *str, size_t n, const char *format,...)
 cat_snprintf is like a combination of fc_snprintf and fc_strlcat; it does snprintf to the end of an existing string. More...
 
int fc_gethostname (char *buf, size_t len)
 Call gethostname() if supported, else just returns -1. More...
 
int fc_break_lines (char *str, size_t desired_len)
 Replace the spaces by line breaks when the line lenght is over the desired one. More...
 
int fc_at_quick_exit (void(*func)())
 Set quick_exit() callback if possible. More...
 

Detailed Description

This module contains replacements for functions which are not available on all platforms.

Where the functions are available natively, these are (mostly) just wrappers.

Notice the function names here are prefixed by, eg, "fc". An alternative would be to use the "standard" function name, and provide the implementation only if required. However the method here has some advantages:

  • We can provide definite prototypes in support.h, rather than worrying about whether a system prototype exists, and if so where, and whether it is correct. (Note that whether or not configure finds a function and defines HAVE_FOO does not necessarily say whether or not there is a prototype for the function available.)
  • We don't have to include fc_config.h in support.h, but can instead restrict it to this .c file.
  • We can add some extra stuff to these functions if we want.

The main disadvantage is remembering to use these "fc" functions on systems which have the functions natively.

Definition in file support.cpp.

Macro Definition Documentation

◆ VSNP_BUF_SIZE

#define VSNP_BUF_SIZE   (64 * 1024)

vsnprintf() replacement using a big malloc()ed internal buffer, originally by David Pfitzner dwp@m.nosp@m.so.a.nosp@m.nu.ed.nosp@m.u.au

Parameter n specifies the maximum number of characters to produce. This includes the trailing null, so n should be the actual number of characters allocated (or sizeof for char array). If truncation occurs, the result will still be null-terminated. (I'm not sure whether all native vsnprintf() functions null-terminate on truncation; this does so even if calls native function.)

Return value: if there is no truncation, returns the number of characters printed, not including the trailing null. If truncation does occur, returns the number of characters which would have been produced without truncation. (Linux man page says returns -1 on truncation, but glibc seems to do as above nevertheless; check_native_vsnprintf() above tests this.)

[glibc is correct. Viz.

PRINTF(3) Linux Programmer's Manual PRINTF(3)

(Thus until glibc 2.0.6. Since glibc 2.1 these functions follow the C99 standard and return the number of characters (excluding the trailing '\0') which would have been written to the final string if enough space had been available.)]

The method is simply to malloc (first time called) a big internal buffer, longer than any result is likely to be (for non-malicious usage), then vsprintf to that buffer, and copy the appropriate number of characters to the destination. Thus, this is not 100% safe. But somewhat safe, and at least safer than using raw snprintf! :-) (And of course if you have the native version it is safe.)

Before rushing to provide a 100% safe replacement version, consider the following advantages of this method:

  • It is very simple, so not likely to have many bugs (other than arguably the core design bug regarding absolute safety), nor need maintenance.
  • It uses native vsprintf() (which is required), thus exactly duplicates the native format-string parsing/conversions.
  • It is very portable. Eg, it does not require mprotect(), nor does it do any of its own parsing of the format string, nor use any tricks to go through the va_list twice.

See also fc_utf8_vsnprintf_trunc(), fc_utf8_vsnprintf_rep().

Definition at line 511 of file support.cpp.

Function Documentation

◆ cat_snprintf()

int cat_snprintf ( char *  str,
size_t  n,
const char *  format,
  ... 
)

cat_snprintf is like a combination of fc_snprintf and fc_strlcat; it does snprintf to the end of an existing string.

Like fc_strlcat, n is the total length available for str, including existing contents and trailing nul. If there is no extra room available in str, does not change the string.

Also like fc_strlcat, returns the final length that str would have had without truncation, or -1 if the end of the buffer is reached. I.e., if return is >= n, truncation occurred.

See also cat_utf8_snprintf(), cat_utf8_snprintf_rep().

Definition at line 564 of file support.cpp.

Referenced by append_city_buycost_string(), boot_help_texts(), conn_description(), cr_entry_attack(), cr_entry_defense(), delegate_command(), dem_line_item(), fcdb_command(), format_time_duration(), get_city_mapview_production(), get_infrastructure_text(), helptext_advance(), helptext_building(), helptext_extra(), helptext_extra_for_terrain_str(), helptext_goods(), helptext_government(), helptext_nation(), helptext_road_bonus_str(), helptext_specialist(), helptext_terrain(), helptext_unit(), helptext_unit_upkeep_str(), historian_generic(), init_city_report_game_data(), insert_allows_single(), insert_generated_text(), insert_veteran_help(), mapimg_client_define(), mapimg_command(), mapimg_def2str(), mapimg_generate_name(), mapimg_show(), player_color_ftstr(), report_achievements(), report_demographics(), report_top_five_cities(), report_wonders_of_the_world(), req_text_insert(), secfile_insert_bitwise_enum_full(), secfile_insert_enum_data_full(), sg_save_map_startpos(), show_connections(), show_help_command_list(), show_help_option_list(), show_players(), show_settings_one(), specialists_abbreviation_string(), specialists_string(), tile_get_info_text(), universal_name_translation(), and utype_values_string().

◆ effectivestrlenquote()

size_t effectivestrlenquote ( const char *  str)

Count length of string without possible surrounding quotes.

Definition at line 189 of file support.cpp.

Referenced by conn_by_user_prefix(), and player_by_name_prefix().

◆ fc_at_quick_exit()

int fc_at_quick_exit ( void(*)()  func)

Set quick_exit() callback if possible.

Definition at line 657 of file support.cpp.

Referenced by client_main().

◆ fc_break_lines()

int fc_break_lines ( char *  str,
size_t  desired_len 
)

Replace the spaces by line breaks when the line lenght is over the desired one.

'str' is modified. Returns number of lines in modified s.

Definition at line 597 of file support.cpp.

Referenced by show_help_command(), show_help_intro(), show_help_option(), show_nationsets(), show_ruleset_info(), and show_settings_one().

◆ fc_fopen()

FILE* fc_fopen ( const char *  filename,
const char *  opentype 
)

Wrapper function for fopen() with filename conversion to local encoding on Windows.

Definition at line 255 of file support.cpp.

Referenced by log_civ_score_now(), lua_command(), manual_command(), rank_users(), read_init_script_real(), save_script_lua(), script_server_load_file(), and write_init_script().

◆ fc_get_errno()

fc_errno fc_get_errno ( )

Returns last error code.

Definition at line 311 of file support.cpp.

Referenced by main().

◆ fc_gethostname()

int fc_gethostname ( char *  buf,
size_t  len 
)

Call gethostname() if supported, else just returns -1.

Definition at line 586 of file support.cpp.

Referenced by establish_new_connection(), send_lanserver_response(), and send_to_metaserver().

◆ fc_remove()

int fc_remove ( const char *  filename)

Wrapper function for remove() with filename conversion to local encoding on Windows.

Definition at line 274 of file support.cpp.

Referenced by handle_single_want_hack_reply().

◆ fc_snprintf()

int fc_snprintf ( char *  str,
size_t  n,
const char *  format,
  ... 
)

See also fc_utf8_snprintf_trunc(), fc_utf8_snprintf_rep().

Definition at line 537 of file support.cpp.

Referenced by requirers_dlg::add(), effect_edit::add_effect_to_list(), ai_init(), aifill(), auth_user(), boot_help_texts(), city_dialog::buy(), trade_generator::calculate(), calendar_text(), city_improvement_name_translation(), city_link(), city_name_suggestion(), city_production_cost_str(), city_tile_link(), citylog_map_data(), citylog_map_line(), cityrep_buy(), requirers_dlg::clear(), client_diplomacy_clause_string(), client_main(), col_diplstate(), col_idle(), command_named(), compat_load_020600(), compat_load_030000(), conn_description(), conn_pattern_from_string(), conn_pattern_to_string(), cr_entry_angry(), cr_entry_build_cost(), cr_entry_build_cost_gold(), cr_entry_build_cost_turns(), cr_entry_build_slots(), cr_entry_building(), cr_entry_content(), cr_entry_continent(), cr_entry_corruption(), cr_entry_culture(), cr_entry_foodplus(), cr_entry_gold(), cr_entry_growturns(), cr_entry_happy(), cr_entry_history(), cr_entry_hstate_concise(), cr_entry_luxury(), cr_entry_output(), cr_entry_performance(), cr_entry_plague_risk(), cr_entry_pollution(), cr_entry_present(), cr_entry_prodplus(), cr_entry_resources(), cr_entry_science(), cr_entry_size(), cr_entry_specialist(), cr_entry_supported(), cr_entry_trade_routes(), cr_entry_tradeplus(), cr_entry_unhappy(), cr_entry_waste(), cr_entry_workers(), create_ruleset_file(), dai_city_log(), dai_player_load_relations(), dai_player_save_relations(), dai_unit_log(), deprecate_signal(), describe_vote(), disband_all_units(), edit_buffer_copy(), edit_buffer_get_status_string(), effect_edit::edit_reqs(), effect_save(), effect_to_enabler(), entry_path(), establish_new_connection(), event_cache_save(), events_init(), explain_why_no_action_enabled(), fc_strerror(), fc_vsnprintcf(), fix_enabler_item::fix_enabler_item(), form_chat_name(), format_change_terrain_string(), freeciv_name_version(), generate_save_name(), get_challenge_filename(), get_challenge_fullname(), get_city_dialog_airlift_text(), get_city_dialog_airlift_value(), get_city_dialog_production(), get_city_mapview_name_and_growth(), get_city_mapview_trade_routes(), get_full_nation(), get_full_username(), get_help_item_spec(), get_tile_output_text(), get_unique_guest_name(), get_units_upgrade_info(), handle_login_request(), handle_tile_info(), helptext_advance(), helptext_extra(), helptext_extra_for_terrain_str(), helptext_unit(), helptext_unit_upkeep_str(), historian_generic(), huts_help(), illegal_action_msg(), img_filename(), img_new(), init_city_report_game_data(), init_move_fragments(), is_allowed_city_name(), is_allowed_to_take(), is_good_password(), is_tech_needed(), load_install_info_list(), load_install_info_lists(), load_muuk_as_action_auto(), load_ruleset_governments(), load_ruleset_veteran(), lookup_req_list(), makeup_connection_name(), manual_command(), mapimg_checkplayers(), mapimg_client_define(), mapimg_colortest(), mapimg_generate_name(), mapimg_help(), meta_read_response(), name_and_sort_items(), parse_metaserver_data(), phasemode_help(), really_handle_city_buy(), req_edit::refresh(), tab_enabler::refresh(), report_achievements(), report_demographics(), req_vec_change_translation(), req_vec_fix_problem::req_vec_fix_problem(), research_advance_name_translation(), research_advance_rule_name(), research_pretty_name(), rgbcolor_from_hex(), rgbcolor_to_hex(), ruler_title_for_player(), save_buildings_ruleset(), save_cities_ruleset(), save_game_auto(), save_game_ruleset(), save_governments_ruleset(), save_muuk_action_auto(), save_nation(), save_nations_ruleset(), save_ruleset(), save_styles_ruleset(), save_techs_ruleset(), save_terrain_ruleset(), save_units_ruleset(), scan_score_log(), secfile_insert_include(), secfile_insert_long_comment(), secfile_log(), secfile_save(), sell_all_improvements(), send_client_wants_hack(), send_lanserver_response(), send_pending_events(), send_to_metaserver(), server_player_name_is_allowed(), server_player_set_name_full(), set_ruleset(), set_rulesetdir(), help_widget::set_topic_terrain(), settable_options_load(), setting_bitwise_to_str(), setting_bool_to_str(), setting_enum_to_str(), setting_int_to_str(), setting_str_to_str(), settings_ruleset(), setup_langname(), sg_load_player_cities(), sg_load_player_main(), sg_load_player_units(), sg_load_player_vision(), sg_load_savefile(), sg_save_map_owner(), sg_save_map_worked(), sg_save_player_cities(), sg_save_player_main(), sg_save_player_units(), sg_save_player_vision(), sg_save_ruledata(), sg_save_treaties(), map_view::shortcut_pressed(), show_help_command(), show_new_turn_info(), show_players(), start_command(), team_slot_create_default_name(), technology_load(), technology_save(), text_tag_init_from_sequence(), text_tag_initv(), text_tag_replace_text(), text_tag_start_sequence(), text_tag_stop_sequence(), textcalfrag(), textyear(), tile_link(), tileset_help(), unit_achieved_rank_string(), unit_link(), unit_tile_link(), unit_tired_attack_string(), unit_veteran_level_string(), universal_rule_name(), city_dialog::update_nation_table(), page_network::update_server_list(), city_dialog::update_units(), pregamevote::update_vote(), pageGame::updateSidebarTooltips(), user_username(), utype_values_string(), utype_values_translation(), valid_ruleset_filename(), value_units(), and year_suffix().

◆ fc_stat()

int fc_stat ( const char *  filename,
struct stat *  buf 
)

Wrapper function for stat() with filename conversion to local encoding on Windows.

Definition at line 293 of file support.cpp.

Referenced by load_install_info_lists(), and script_server_load_file().

◆ fc_strcasecmp()

int fc_strcasecmp ( const char *  str0,
const char *  str1 
)

Compare strings like strcmp(), but ignoring case.

Definition at line 89 of file support.cpp.

Referenced by achievement_by_rule_name(), action_by_rule_name(), advance_by_rule_name(), ai_level_help(), ai_type_by_name(), api_edit_trait_mod_set(), api_edit_unit_kill(), api_effects_city_bonus(), api_effects_player_bonus(), api_effects_world_bonus(), api_find_role_unit_type(), api_methods_nation_trait_default(), api_methods_nation_trait_max(), api_methods_nation_trait_min(), api_methods_player_has_flag(), api_methods_player_trait(), api_methods_player_trait_base(), api_methods_player_trait_current_mod(), api_methods_unit_type_has_flag(), api_methods_unit_type_has_role(), api_utilities_str2dir(), boot_help_texts(), cancelvote_command(), check_leader_names(), check_sprite_type(), city_list_find_name(), city_style_by_rule_name(), cmdlevel_command(), command_named(), compar_event_message_texts(), compat_load_020400(), compat_load_020500(), compat_load_020600(), conn_by_user(), conn_pattern_from_string(), delegate_command(), desired_settable_option_send(), diplrel_by_rule_name(), download_modpack(), download_modpack_list(), effect_edit::effect_type_menu(), event_cache_load(), extra_type_by_rule_name(), fc_cmp(), fc_stricoll(), goods_by_rule_name(), government_by_rule_name(), handle_login_request(), improvement_by_rule_name(), freeciv::layer_abstract_activities::initialize_extra(), is_default_city_name(), is_on_allowed_list(), load_action_range_max(), load_city_name_list(), load_install_info_list(), load_ruleset_buildings(), load_ruleset_effects(), load_ruleset_game(), load_ruleset_nations(), load_ruleset_techs(), load_ruleset_terrain(), load_ruleset_units(), load_tech_names(), load_terrain_names(), load_unit_names(), lookup_cbonus_list(), lookup_req_list(), mapimg_define(), metaconnection_command(), multiplier_by_rule_name(), nation_by_rule_name(), nation_group_by_rule_name(), nation_leader_by_name(), nation_set_by_rule_name(), output_type_by_identifier(), player_by_name(), player_by_user(), player_by_user_delegated(), playercolor_command(), req_edit::req_range_menu(), req_edit::req_type_menu(), rscompat_names(), rscompat_old_effect_3_1(), rscompat_req_name_3_1(), save_game_ruleset(), secfile_lookup_enum_data(), server_player_name_is_allowed(), set_ai_level_named(), setting_ruleset_one(), settings_game_load(), settings_list_cmp(), sg_load_game(), sg_load_player_cities(), sg_load_player_city(), sg_load_player_main(), sg_load_player_unit(), sg_load_player_vision_city(), sg_load_savefile(), sg_load_treaties(), specialist_by_rule_name(), style_by_rule_name(), team_slot_by_rule_name(), tech_class_by_rule_name(), technology_load(), terrain_by_rule_name(), tileset_read_toplevel(), tileset_setup_extra(), unit_class_by_rule_name(), unit_type_by_rule_name(), and universal_by_number().

◆ fc_strcoll()

int fc_strcoll ( const char *  str0,
const char *  str1 
)

Wrapper function for strcoll().

Definition at line 227 of file support.cpp.

◆ fc_strerror()

const char* fc_strerror ( fc_errno  err)

Return a string which describes a given error (errno-style.) The string is converted as necessary from the local_encoding to internal_encoding, for inclusion in translations.

May be subsequently converted back to local_encoding for display.

Note that this is not the reentrant form.

Definition at line 328 of file support.cpp.

Referenced by main().

◆ fc_stricoll()

int fc_stricoll ( const char *  str0,
const char *  str1 
)

Wrapper function for stricoll().

Definition at line 235 of file support.cpp.

Referenced by cmp_name().

◆ fc_strlcat()

size_t fc_strlcat ( char *  dest,
const char *  src,
size_t  n 
)

fc_strlcat() provides utf-8 version of (non-standard) function strlcat() It is intended as more user-friendly version of strncat(), in particular easier to use safely and correctly, and ensuring nul-terminated results while being able to detect truncation.

Definition at line 448 of file support.cpp.

Referenced by boot_help_texts(), get_effect_req_text(), handle_page_msg_part(), handle_ruleset_description_part(), helptext_building(), helptext_goods(), helptext_government(), helptext_specialist(), historian_generic(), load_ruleset_nations(), load_ruleset_units(), req_text_insert(), req_text_insert_nl(), setting_bitwise_to_str(), tile_info_pollution(), tileset_help(), and universal_name_translation().

◆ fc_strlcpy()

size_t fc_strlcpy ( char *  dest,
const char *  src,
size_t  n 
)

fc_strlcpy() provides utf-8 version of (non-standard) function strlcpy() It is intended as more user-friendly version of strncpy(), in particular easier to use safely and correctly, and ensuring nul-terminated results while being able to detect truncation.

n is the full size of the destination buffer, including space for trailing nul, and including the pre-existing string for fc_strlcat(). Thus can eg use sizeof(buffer), or exact size malloc-ed.

Result is always nul-terminated, whether or not truncation occurs, and the return value is the qstrlen the destination would have had without truncation. I.e., a return value >= input n indicates truncation occurred.

Not sure about the asserts below, but they are easier than trying to ensure correct behaviour on strange inputs. In particular note that n == 0 is prohibited (e.g., since there must at least be room for a nul); could consider other options.

Definition at line 412 of file support.cpp.

Referenced by capitalized_string(), client_option_str_set(), cmafec_preset_add(), conn_pattern_from_string(), edit_buffer_get_status_string(), fc_gethostname(), fc_strlcat(), find_option(), fit_nationset_to_players(), get_city_dialog_production(), get_city_mapview_name_and_growth(), get_full_nation(), get_full_username(), get_unique_guest_name(), handle_chat_msg_req(), handle_ruleset_nation(), handle_ruleset_summary(), helptext_advance(), helptext_unit(), is_allowed_to_take(), load_ruleset_game(), loud_strlcpy(), mapimg_def2str(), mapimg_define(), name_and_sort_items(), package_short_unit(), package_unit(), plrdata_slot_replace(), research_pretty_name(), scan_score_log(), secfile_lookup_bitwise_enum_default_full(), secfile_lookup_bitwise_enum_full(), secfile_lookup_enum_data(), secfile_lookup_enum_default_data(), send_ruleset_choices(), server_player_name_is_allowed(), server_player_set_name_full(), settable_options_load(), setting_bitwise_to_str(), setting_bitwise_validate_base(), setting_bool_to_str(), setting_enum_to_str(), setting_game_set(), setting_set_to_default(), setting_str_set(), setting_str_to_str(), settings_game_load(), sg_save_map_startpos(), page_network::slot_connect(), mr_menu::slot_set_citybar(), tileset_read_toplevel(), try_to_connect(), and user_username().

◆ fc_strncasecmp()

int fc_strncasecmp ( const char *  str0,
const char *  str1,
size_t  n 
)

◆ fc_strncasequotecmp()

int fc_strncasequotecmp ( const char *  str0,
const char *  str1,
size_t  n 
)

Compare strings like strncasecmp() but ignoring surrounding quotes in either string.

Definition at line 209 of file support.cpp.

Referenced by conn_by_user_prefix(), and player_by_name_prefix().

◆ fc_strrep()

bool fc_strrep ( char *  str,
size_t  len,
const char *  search,
const char *  replace 
)

Replace 'search' by 'replace' within 'str'.

sizeof(str) should be large enough for the modified value of 'str'. Returns TRUE if the replacement was successful.

Definition at line 356 of file support.cpp.

◆ fc_usleep()

void fc_usleep ( unsigned long  usec)

Suspend execution for the specified number of microseconds.

Definition at line 349 of file support.cpp.

Referenced by client_start_server(), move_unit_map_canvas(), and put_nuke_mushroom_pixmaps().

◆ fc_vsnprintf()

int fc_vsnprintf ( char *  str,
size_t  n,
const char *  format,
va_list  ap 
)

Definition at line 512 of file support.cpp.

Referenced by cat_snprintf(), con_write(), create_event(), fc_snprintf(), global_worklist_load(), global_worklist_save(), luaconsole_vprintf(), luascript_log_vargs(), mapimg_log(), output_window_vprintf(), package_event_full(), req_vec_problem_new(), rgbcolor_load(), rgbcolor_save(), script_client_output(), script_fcdb_cmd_reply(), script_server_cmd_reply(), secfile_entry_delete(), secfile_entry_lookup(), secfile_insert_bitwise_enum_full(), secfile_insert_bitwise_enum_vec_full(), secfile_insert_bool_full(), secfile_insert_bool_vec_full(), secfile_insert_enum_data_full(), secfile_insert_enum_vec_data_full(), secfile_insert_filereference(), secfile_insert_float_full(), secfile_insert_int_full(), secfile_insert_int_vec_full(), secfile_insert_plain_enum_full(), secfile_insert_plain_enum_vec_full(), secfile_insert_str_full(), secfile_insert_str_vec_full(), secfile_log(), secfile_lookup_bitwise_enum_default_full(), secfile_lookup_bitwise_enum_full(), secfile_lookup_bitwise_enum_vec_full(), secfile_lookup_bool(), secfile_lookup_bool_default(), secfile_lookup_enum_data(), secfile_lookup_enum_default_data(), secfile_lookup_int(), secfile_lookup_int_def_min_max(), secfile_lookup_int_default(), secfile_lookup_int_default_min_max(), secfile_lookup_int_vec(), secfile_lookup_plain_enum_default_full(), secfile_lookup_plain_enum_full(), secfile_lookup_plain_enum_vec_full(), secfile_lookup_str(), secfile_lookup_str_default(), secfile_lookup_str_vec(), secfile_section_lookup(), vcmd_reply_prefix(), worklist_load(), and worklist_save().

◆ make_escapes()

void make_escapes ( const char *  str,
char *  buf,
size_t  buf_len 
)

Copies a string and convert the following characters:

Definition at line 114 of file support.cpp.

Referenced by entry_to_file().

◆ real_fc_strdup()

char* real_fc_strdup ( const char *  str,
const char *  called_as,
int  line,
const char *  file 
)

Function used by fc_strdup macro, strdup() replacement No need to check return value.

Definition at line 75 of file support.cpp.

◆ remove_escapes()

QString remove_escapes ( const QString &  str,
bool  full_escapes 
)

Copies a string.

Backslash followed by a genuine newline always removes the newline. If full_escapes is TRUE:

  • \\n -> newline translation.
  • Other \\c sequences (any character c) are just passed through with the \\ removed (eg, includes \\, "). See also make_escapes().

Definition at line 149 of file support.cpp.

Referenced by entry_from_token().