UFO: Alien Invasion
Loading...
Searching...
No Matches
shared.cpp File Reference

Shared functions. More...

#include "shared.h"
#include "../common/filesys.h"
#include "../ports/system.h"
#include "utf8.h"
Include dependency graph for shared.cpp:

Go to the source code of this file.

Macros

#define VA_BUFSIZE   4096

Functions

const char * Com_SkipPath (const char *pathname)
 Returns just the filename from a given path.
char * Com_Chop (char *s)
 Removed trailing whitespaces.
char * Com_Trim (char *s)
 Removed leading and trailing whitespaces.
char * Com_ConvertToASCII7 (char *s)
 Remove high character values and only keep ascii. This can be used to print utf-8 characters to the console. It will replace every high character value with a simple dot.
static int Com_FilterAfterStar (const char *pattern, const char *text)
 Like Com_Filter, but match PATTERN against any final segment of TEXT.
int Com_Filter (const char *pattern, const char *text)
 Match the pattern PATTERN against the string TEXT;.
void Com_ReplaceFilename (const char *inputPath, const char *expectedFileName, char *outputPath, size_t size)
 Replaces the filename from one path with another one.
void Com_StripExtension (const char *in, char *out, const size_t size)
 Removes the file extension from a filename.
const char * Com_GetExtension (const char *path)
void Com_DefaultExtension (char *path, size_t len, const char *extension)
 Sets a default extension if there is none.
void Com_FilePath (const char *in, char *out, size_t size)
 Returns the path up to, but not including the last /.
unsigned int Com_HashKey (const char *name, int hashsize)
 returns hash key for a string
void Com_MakeTimestamp (char *ts, const size_t tslen)
 Creates a timestamp with date and time at the specified location.
int Q_FloatSort (const void *float1, const void *float2)
 Compare two floats.
int Q_StringSort (const void *string1, const void *string2)
 Compare two strings.
const char * va (const char *format,...)
 does a varargs printf into a temp buffer, so I don't need to have varargs versions of all text functions.
char * Q_strlwr (char *str)
 Converts a string to lowercase.
void Q_strncpyz (char *dest, const char *src, size_t destsize)
 Safe strncpy that ensures a trailing zero.
void Q_strcat (char *dest, size_t destsize, const char *format,...)
 Safely (without overflowing the destination buffer) concatenates two strings.
bool Com_sprintf (char *dest, size_t size, const char *fmt,...)
 copies formatted string with buffer-size checking
int Q_vsnprintf (char *str, size_t size, const char *format, va_list ap)
 Safe (null terminating) vsnprintf implementation.
const char * Q_stristr (const char *str, const char *substr)
 Checks in case insensitive manner whether str contains substr.
char const * Q_strstart (char const *str, char const *start)
 Matches the start of a string.
bool Q_strreplace (const char *source, const char *pattern, const char *replace, char *dest, size_t destsize)
 Replaces the first occurence of the given pattern in the source string with the given replace string.
bool Com_IsValidName (const char *input)
 Checks whether the given input string is allowed to be used as a user-given name string for aircraft, soldiers, bases and so on.
void UFO_assert (bool condition, const char *fmt,...)

Detailed Description

Shared functions.

Definition in file shared.cpp.

Macro Definition Documentation

◆ VA_BUFSIZE

#define VA_BUFSIZE   4096

Definition at line 405 of file shared.cpp.

Referenced by va().

Function Documentation

◆ Com_Chop()

char * Com_Chop ( char * s)

Removed trailing whitespaces.

Parameters
sThe string that is modified
Returns
The start of the input string

Definition at line 48 of file shared.cpp.

Referenced by Cmd_TokenizeString(), and Com_Trim().

◆ Com_ConvertToASCII7()

char * Com_ConvertToASCII7 ( char * s)

Remove high character values and only keep ascii. This can be used to print utf-8 characters to the console. It will replace every high character value with a simple dot.

Definition at line 82 of file shared.cpp.

References length.

Referenced by TEST_F().

◆ Com_DefaultExtension()

void Com_DefaultExtension ( char * path,
size_t len,
const char * extension )

Sets a default extension if there is none.

Definition at line 297 of file shared.cpp.

References Com_sprintf(), len, MAX_OSPATH, and Q_strncpyz().

Referenced by Com_WriteConfig_f(), Key_WriteBindings_f(), main(), R_LoadModelAsync(), R_ModLoadAliasMD2Model(), R_ModLoadMDX(), and RT_WriteCSVFiles().

◆ Com_FilePath()

void Com_FilePath ( const char * in,
char * out,
size_t size )

Returns the path up to, but not including the last /.

Definition at line 319 of file shared.cpp.

References Q_strncpyz().

Referenced by ExportLightmaps(), FS_BuildFileList(), Sys_FindFirst(), and TEST_F().

◆ Com_Filter()

int Com_Filter ( const char * pattern,
const char * text )

Match the pattern PATTERN against the string TEXT;.

Returns
1 if it matches, 0 otherwise.
Note
A match means the entire string TEXT is used up in matching.
In the pattern string, *' matches any sequence of characters, ?' matches any character, [SET] matches any character in the specified set, [!SET] matches any character not in the specified set.
A set is composed of characters or ranges; a range looks like character hyphen character (as in 0-9 or A-Z). [0-9a-zA-Z_] is the set of characters allowed in C identifiers. Any other character in the pattern must be matched exactly.
To suppress the special syntactic significance of any of []*?!-\', and match the character exactly, precede it with a \'.

Definition at line 145 of file shared.cpp.

References Com_FilterAfterStar().

Referenced by Com_FilterAfterStar(), Sys_FindFirst(), Sys_FindNext(), and Sys_ListFilteredFiles().

◆ Com_FilterAfterStar()

int Com_FilterAfterStar ( const char * pattern,
const char * text )
static

Like Com_Filter, but match PATTERN against any final segment of TEXT.

Definition at line 106 of file shared.cpp.

References Com_Filter().

Referenced by Com_Filter().

◆ Com_GetExtension()

const char * Com_GetExtension ( const char * path)
Parameters
pathThe path resp. filename to extract the extension from
Returns
nullptr if the given path name does not contain an extension

Definition at line 282 of file shared.cpp.

Referenced by CL_CheckAndQueueDownload(), CL_FinishHTTPDownload(), CL_QueueHTTPDownload(), CL_StartHTTPDownload(), FS_LoadPackFile(), MD2Check(), MD2SkinFix(), R_FindModel(), R_LoadModelAsync(), R_ModelExists(), and SV_LoadModelAABB().

◆ Com_HashKey()

◆ Com_IsValidName()

bool Com_IsValidName ( const char * input)

Checks whether the given input string is allowed to be used as a user-given name string for aircraft, soldiers, bases and so on.

Parameters
[in]inputThe input string to check
Returns
true if the string is valid and can be used as a name, false otherwise

Definition at line 612 of file shared.cpp.

References Q_streq, and Q_strvalid.

Referenced by AIR_ChangeAircraftName_f(), B_BuildBase_f(), B_ChangeBaseName_f(), and E_ChangeName_f().

◆ Com_MakeTimestamp()

void Com_MakeTimestamp ( char * ts,
const size_t tslen )

Creates a timestamp with date and time at the specified location.

Parameters
tsptr to the resulting string
tslenlength of target buffer

Definition at line 352 of file shared.cpp.

References Com_sprintf().

Referenced by CL_LogEvent(), Com_vPrintf(), SAV_GameSave(), and va().

◆ Com_ReplaceFilename()

void Com_ReplaceFilename ( const char * inputPath,
const char * expectedFileName,
char * outputPath,
size_t size )

Replaces the filename from one path with another one.

Parameters
[in]inputPathThe full path to a filename
[in]expectedFileNameThe filename to insert into the given full path
[out]outputPathThe target buffer
[in]sizeThe size of the target buffer

Definition at line 239 of file shared.cpp.

References Q_strncpyz().

Referenced by R_AliasModelGetSkin().

◆ Com_SkipPath()

const char * Com_SkipPath ( const char * pathname)

◆ Com_sprintf()

bool Com_sprintf ( char * dest,
size_t size,
const char * fmt,
... )

copies formatted string with buffer-size checking

Parameters
[out]destDestination buffer
[in]sizeSize of the destination buffer
[in]fmtStringformat (like printf)
Returns
false if overflowed - true otherwise

Definition at line 494 of file shared.cpp.

References dest, i, len, Q_vsnprintf(), UTF8_char_len(), and UTF8_CONTINUATION_BYTE.

Referenced by actorL_tostring(), AII_UpdateOneInstallationDelay(), AIL_InitActor(), AIM_AircraftEquipMenuUpdate(), AIR_AircraftFillList_f(), AIR_AircraftSelect(), AIR_Move(), AIR_NewAircraft(), AIR_Refuel(), B_BuildBase_f(), B_SellOrAddItems(), B_SetBaseTitle_f(), B_UpdateBuildingConstructions(), BDEF_AddSlotToSlotList(), CalcTextureReflectivity(), CHAR_UpdateStats(), CheckBSPFile(), CHRSH_CharGetBody(), CHRSH_CharGetHead(), CL_ActorAppear(), CL_ActorDie(), CL_ActorRevitalised(), CL_ActorWound(), CL_AddBrushModel(), CL_CanMultiplayerStart(), CL_CheckAndQueueDownload(), CL_ConnectionlessPacket(), CL_DisplayHomebasePopup(), CL_DisplayPopupInterceptMission(), CL_DisplayPopupInterceptUFO(), CL_DownloadUMPMap(), CL_EventAddMail(), CL_FinishHTTPDownload(), CL_Init(), CL_LanguageTest(), CL_PrecacheCharacterModels(), CL_QueueHTTPDownload(), CL_StartHTTPDownload(), CL_UfoModuleLoader(), CM_AddMapTile(), CM_LoadMap(), Com_DefaultExtension(), Com_GetAircraftIdStr(), Com_GetCrashedAircraftIdStr(), Com_LoadLibrary(), Com_MakeTimestamp(), Com_sprintf(), Com_ValueToStr(), CompareAttributes(), Con_DrawConsole(), CP_BaseAttackMissionDestroyBase(), CP_BaseAttackPrepareBattle(), CP_CreateBattleParameters(), CP_MissionEndActions(), CP_MissionGetMessage(), CP_SecondConvert(), CP_SetAlienEquipmentByInterest(), CP_SetMissionName(), uiText2Node::drawText(), uiTextNode::drawText(), E_CreateEmployee(), EntityForModel(), ExportLightmap(), FS_AddGameDirectory(), FS_BuildFileList(), FS_GetHomeDirectory(), FS_GetMaps(), FS_InitFilesystem(), FS_OpenFile(), FS_RenameFile(), G_Players_f(), G_PrintActorStats(), G_PrintStats(), G_Say_f(), GAME_CP_CampaignDescription_f(), GAME_GetAbsoluteSavePath(), GAME_GetRelativeSavePath(), GAME_GetTeamFileName(), GAME_MP_EndRoundAnnounce(), GAME_MP_ParseServerInfoMessage(), GAME_MP_SetTeamNum(), GAME_SK_ChangeEquip_f(), GAME_SK_Results(), GAME_TeamGetFreeFilename(), GenerateMaterialFile(), GEO_Draw(), GEO_GetAircraftText(), GEO_GetMissionText(), GEO_GetUFOText(), HOS_EntryWoundData(), HTTP_ResolvURL(), HUD_DisplayFiremodeEntry(), HUD_MapDebugCursor(), HUD_PopupFiremodeReservation(), HUD_UpdateActorFireMode(), HUD_UpdateActorLoad_f(), HUD_UpdateActorMove(), Info_SetValueForKey(), INS_BuildInstallation_f(), INS_DestroyInstallation(), INS_DestroyInstallation_f(), INS_UpdateInstallationData(), INV_ItemDescription(), INV_UpdateActorLoad_f(), Irc_GetExternalIP(), Irc_Logic_AddChannelName(), LE_GetAnim(), Master_HeartbeatThread(), MD2SkinFix(), MS_LoadXML(), MS_TimestampedText(), NAT_HandleBudget(), NAT_SetHappiness(), NET_StreamPeerToName(), ParseBrush(), ParseUMP(), pos3L_tostring(), PR_AircraftInfo(), PR_CheckFrame(), PR_DisassemblyInfo(), PR_FinishDisassembly(), PR_FinishProduction(), PR_ItemProductionInfo(), PR_ProductionIncrease_f(), PR_QueueNext(), R_FindModel(), R_LoadMaterials(), R_LoadObjSkin(), R_ModAddMapTile(), R_ModBeginLoading(), R_ModLoadLevelOfDetailData(), R_ModLoadTexinfo(), R_PreprocessShaderR(), R_ScreenShot(), R_SetupSubmodels(), RS_CheckRequirements(), RS_MarkCollected(), RS_MarkOneResearchable(), RS_ResearchFinish(), RS_ResearchRun(), S_CompleteSounds(), SAV_GameSave(), SCR_TouchPics(), SetModelNumbers(), SV_CheckMap(), SV_DoMapAssemble(), SV_LoadModelAABB(), SV_NextMapcycle(), SV_ParseMapTile(), SV_ParseMapTileSet(), SV_ParseUMP(), SV_PrintAssemblyStats(), SVC_Info(), SVC_Status(), SVCmd_WriteIP_f(), Sys_FindFirst(), Sys_FindNext(), Sys_ListFilteredFiles(), Sys_OpenURL(), TEST_F(), Touch_NextMapTrigger(), TR_EmptyTransferCargo(), TR_FillAliens(), TR_FillEmployees(), TR_TransferEnd(), TR_TransferStart_f(), UI_AutoGenerateSprite(), UI_BuildRadarImageList(), UI_GetItemTooltip(), UI_InitRadar(), UI_Tooltip(), UP_AircraftDescription(), UP_BuildingDescription(), UP_OpenMail_f(), UP_SetMailHeader(), UP_UGVDescription(), UR_DialogStartSell_f(), UR_DialogStartStore_f(), UR_ProcessActive(), US_DestroyStoredUFO_f(), US_TransferUFO(), WEB_Auth(), WEB_CGameGetURL(), WEB_GetToFile(), and WEB_GetURL().

◆ Com_StripExtension()

void Com_StripExtension ( const char * in,
char * out,
const size_t size )

◆ Com_Trim()

char * Com_Trim ( char * s)

Removed leading and trailing whitespaces.

Parameters
sThe string that is modified
Returns
The first none whitespace character of the given input string

Definition at line 65 of file shared.cpp.

References Com_Chop().

Referenced by GAME_MP_AddChatMessage(), and R_LoadObjModel_().

◆ Q_FloatSort()

int Q_FloatSort ( const void * float1,
const void * float2 )

Compare two floats.

Parameters
[in]float1The first float
[in]float2The second float
Returns
An integer less than, equal to, or greater than zero if float1 is found, respectively, to be less than, to match, or be greater than float2
Note
sort function pointer for qsort

Definition at line 372 of file shared.cpp.

Referenced by AIR_GetAircraftWeaponRanges(), and va().

◆ Q_strcat()

void Q_strcat ( char * dest,
size_t destsize,
const char * format,
... )

Safely (without overflowing the destination buffer) concatenates two strings.

Parameters
[in]destthe destination string.
[in]destsizethe total size of the destination buffer.
[in]formatthe format or simple source string.
Returns
pointer destination string. never goes past bounds or leaves without a terminating 0

Definition at line 475 of file shared.cpp.

References dest, format(), Q_vsnprintf(), and Sys_Error().

Referenced by AIM_AircraftEquipMenuUpdate(), AIR_AircraftSelect(), B_AddMap(), Cbuf_AddLateCommands(), CL_ConvertSoundFromEvent(), CL_LanguageTest(), Cmd_Alias_f(), CMod_LoadEntityString(), Com_ConsoleCompleteCommand(), Com_GetCharacterValues(), Com_MD5Buffer(), Com_MD5File(), Com_SHA1Buffer(), Com_SHA1File(), Com_SHA2ToHex(), Com_vPrintf(), uiBaseInventoryNode::drawTooltip(), uiContainerNode::drawTooltip(), uiStringNode::drawTooltip(), FS_AddHomeAsGameDirectory(), FS_GetModList(), G_Players_f(), GAME_MP_ParseServerInfoMessage(), GAME_MP_PingServerCallback(), GAME_TeamDelete_f(), GAME_TeamSlotComments_f(), GEO_DrawMarkers(), GEO_GetAircraftText(), GEO_GetUFOText(), HUD_ActorWoundData_f(), HUD_UpdateActorLoad_f(), INV_ItemDescription(), INV_UpdateActorLoad_f(), Irc_AppendToBuffer(), PR_AircraftInfo(), PR_DisassemblyInfo(), PR_ItemProductionInfo(), PrecalcNormalsAndTangents(), R_DumpOpenGlState(), Rimp_Init(), SAV_GameDelete_f(), SAV_GameLoad(), SAV_GameSave(), SAV_ListSaveGames_f(), SAV_LoadHeader(), STATS_Update_f(), SV_BuildMapStrings(), SVC_RemoteCommand(), Sys_GetHomeDirectory(), TEST_F(), UI_GetItemTooltip(), UI_GetPath(), UI_MaterialEditorStagesToName(), UI_SetKeyBindingEx(), UnparseEntities(), UP_AircraftDescription(), UP_AircraftItemDescription(), UP_BuildingDescription(), WEB_CGameDownloadFromUser(), and WEB_UploadCGame_f().

◆ Q_StringSort()

int Q_StringSort ( const void * string1,
const void * string2 )

Compare two strings.

Parameters
[in]string1The first string
[in]string2The second string
Returns
An integer less than, equal to, or greater than zero if string1 is found, respectively, to be less than, to match, or be greater than string2
Note
sort function pointer for qsort

Definition at line 385 of file shared.cpp.

Referenced by Com_MapDefSort(), FS_AddGameDirectory(), FS_ListFiles(), FS_LoadPackFile(), FS_MapDefSort(), Irc_Client_Names_f(), LIST_AddStringSorted(), TEST_F(), and va().

◆ Q_stristr()

const char * Q_stristr ( const char * str,
const char * substr )

Checks in case insensitive manner whether str contains substr.

Parameters
[in]strThe source string
[in]substrThe string to search in the source string
Returns
The start pointer where substr begins, or null if substr is no part of str

Definition at line 563 of file shared.cpp.

References Q_strncasecmp.

Referenced by format(), and R_SearchForVendor().

◆ Q_strlwr()

char * Q_strlwr ( char * str)

Converts a string to lowercase.

Parameters
[in,out]strThe string that is converted to lowercase

Definition at line 438 of file shared.cpp.

Referenced by format(), FS_ListFiles(), FS_LoadPackFile(), and WEB_Auth().

◆ Q_strncpyz()

void Q_strncpyz ( char * dest,
const char * src,
size_t destsize )

Safe strncpy that ensures a trailing zero.

Parameters
destDestination pointer
srcSource pointer
destsizeSize of destination buffer (this should be a sizeof size due to portability)

Definition at line 457 of file shared.cpp.

References dest, Sys_Error(), and UTF8_strncpyz().

Referenced by _Mem_CreatePool(), AIL_InitActor(), AIM_AircraftEquipMenuUpdate(), AIR_ChangeAircraftName_f(), AIR_LoadAircraftXML(), AIR_NewAircraft(), AIR_ParseAircraft(), B_LoadXML(), B_SetBaseTitle_f(), B_SetName(), BDEF_BaseDefenceMenuUpdate_f(), BDEF_RemoveBattery_f(), Check_SetNodraw(), CheckMixedFaceContents(), CheckTexturesBasedOnFlags(), CIN_ROQ_OpenCinematic(), CIN_RunCinematic(), CL_AddMapParticle(), CL_CheckOrDownloadFile(), CL_DownloadUMPMap(), CL_HTTP_Progress(), CL_Init(), CL_LanguageInit(), CL_LanguageTest(), CL_ParseClientinfo(), CL_ParseMapParticle(), CL_ParseParticle(), CL_ParsePtlCmds(), CL_ParseSequence(), CL_ParticleGetArt(), CL_ParticleSpawnTimed(), CL_QueueHTTPDownload(), CL_SetHTTPServer(), CM_AddMapTile(), CM_LoadMap(), Cmd_Alias_f(), Cmd_GenericCompleteFunction(), Cmd_GetCommandDesc(), Cmd_TokenizeString(), CMod_LoadEntityString(), CMod_LoadSurfaces(), Com_ConsoleCompleteCommand(), Com_DefaultExtension(), Com_FilePath(), Com_GetCharacterModel(), Com_GetCharacterValues(), Com_MacroExpandString(), Com_ParseActorNames(), Com_ParseBodyPart(), Com_ParseCharacterTemplate(), Com_ParseDamageTypes(), Com_ParseEquipment(), Com_ParseGameTypes(), Com_ParseInventory(), Com_ParseTeam(), Com_ParseTerrainDefinition(), Com_ParseValue(), Com_RegisterConstInt(), Com_ReplaceFilename(), Com_SetValue(), Com_ValueToStr(), Com_WriteConfig_f(), COMP_ParseComponents(), Con_LoadConsoleHistory(), CP_CheckTriggerEvent(), CP_CreateCivilianTeam(), CP_ParseAlienTeam(), CP_ParseCampaign(), CP_TEAM_FillEmployeeList_f(), uiModelNode::draw(), uiTextNode::drawText(), E_ChangeName_f(), E_CreateEmployee(), E_GetCounts_f(), ED_ParseEdict(), FindMiptex(), FS_AddGameDirectory(), FS_BuildFileList(), FS_CreateOpenPipeFile(), FS_CreatePath(), FS_GetCwd(), FS_GetFileData(), FS_GetMaps(), FS_ListFiles(), FS_LoadPackFile(), FS_NextScriptHeader(), FS_OpenFile(), G_ClientUserinfoChanged(), G_SpawnEntities(), GAME_LoadCharacter(), GAME_MP_AddChatMessage(), GAME_MP_Connect_f(), GAME_MP_ParseServerInfoMessage(), GAME_MP_ProcessPingReply(), GAME_MP_QueryMasterServerThread(), GAME_ParseModes(), GAME_SaveTeam(), GAME_SetServerInfo(), GAME_TeamSlotComments_f(), GetUMPName(), HTTP_Encode(), HTTP_ExtractComponents(), HTTP_GetURLInternal(), HTTP_Header(), HUD_ActorWoundData_f(), HUD_DisplayActions_f(), HUD_DisplayFiremodes_f(), HUD_UpdateActorFireMode(), Info_SetValueForKey(), INS_Build(), INS_ChangeInstallationName_f(), INS_LoadXML(), Irc_AppendToBuffer(), Irc_Client_CmdKick(), Irc_Client_CmdPrivmsg(), Irc_Client_CmdRplNamreply(), Irc_Client_CmdRplWhoisaccount(), Irc_Client_CmdRplWhoisidle(), Irc_Client_CmdRplWhoisserver(), Irc_Client_CmdRplWhoisuser(), Irc_Client_CmdRplWhoreply(), Irc_Client_CmdRplWhowasuser(), Irc_Client_Names_f(), Irc_Client_Topic_f(), Irc_ParseName(), Irc_Proto_Join(), Irc_Proto_ProcessServerMsg(), Key_Console(), Key_WriteBindings_f(), LM_AddModel(), LoadModel(), M_Start(), main(), MIS_LoadXML(), MS_AddNewMessage(), MS_LoadXML(), NAT_DrawCharts_f(), NAT_ListStats_f(), NET_AddrinfoToString(), NET_SockaddrToStrings(), NET_StreamPeerToName(), uiTextEntryNode::onFocusGained(), ParseBrush(), ParseFromMemory(), ParseUMP(), R_FindModel(), R_FontFindTruncFit(), R_FontGenerateTexture(), R_FontMakeChunks(), R_FontSetTruncationMarker(), R_InitExtensions(), R_LoadActorSkinsFromModel(), R_LoadAnimImages(), R_LoadImageData(), R_LoadModel(), R_LoadObjSkin(), R_LoadProgram(), R_LoadShader(), R_ModBeginLoading(), R_ModLoadAliasMD2MeshIndexed(), R_ModLoadAliasMD2MeshUnindexed(), R_ModLoadAliasMD3Model(), R_ModLoadAnims(), R_PrintInfo(), R_ProgramVariable(), S_MumbleUpdate(), SAV_GameSave(), SAV_GameSave_f(), SEQ_ExecuteModel(), SEQ_ExecuteObj2D(), BodyData::setId(), MapInfo::setName(), SP_misc_model(), STAT_GetExpenses_f(), STRHUNK_Add(), SV_CompleteMapCommand(), SV_Map(), SV_Map_f(), SV_NextMapcycle(), SV_ParseAssembly(), SV_ParseMapcycle(), SV_ParseMapTile(), SV_ParseMapTileSet(), SV_ParseUMP(), SV_SetConfigString(), SV_UserinfoChanged(), SVC_BucketForAddress(), SVC_DirectConnect(), Sys_ConsoleInput(), Sys_FindFirst(), Sys_GetCurrentUser(), TEST_F(), TEST_F(), TEST_F(), Test_Parameters(), TEST_RegisterProperty(), TexinfoForBrushTexture(), Touch_NextMapTrigger(), TR_Add_f(), U2M_Parameter(), UFO_CampaignCheckEvents(), UI_AddLineChartLine(), UI_AllocNodeWithoutNew(), UI_AllocStaticSprite(), UI_AllocStaticString(), UI_AutoGenerateSprite(), UI_BuildRadarImageList(), UI_CloneNode(), UI_DisplayNotice(), UI_DrawModelNode(), UI_InitOption(), UI_ListMaps_f(), UI_Option_SetLabel(), UI_Option_SetValue(), UI_ParseAndLoadLuaScript(), UI_ParseProperty(), UI_ReadNodePath(), UI_TextEntryNodeEdit(), UI_TextNodeGenerateLineSplit(), UM_Parameter(), UnparseEntities(), UP_SetMailHeader(), US_LoadXML(), US_StoreUFO(), WEB_Auth(), and WEB_CGameGetURL().

◆ Q_strreplace()

bool Q_strreplace ( const char * source,
const char * pattern,
const char * replace,
char * dest,
size_t destsize )

Replaces the first occurence of the given pattern in the source string with the given replace string.

Parameters
sourceThe source string
patternThe pattern that should be replaced
replaceThe replacement string
destThe target buffer
destsizeThe size of the target buffer
Note
If this function returns false, the target string might be in an undefined stage. E.g. don't rely on it being 0-terminated.
Returns
false if the pattern wasn't found or the target buffer is to small to store the resulting string, if the replacement was successful.

Definition at line 596 of file shared.cpp.

References dest, and len.

Referenced by format(), main(), R_CheckExtension(), R_GetProcAddressExt(), TEST_F(), and WEB_CGameGetURL().

◆ Q_strstart()

◆ Q_vsnprintf()

◆ UFO_assert()

void UFO_assert ( bool condition,
const char * fmt,
... )

Definition at line 627 of file shared.cpp.

References Q_vsnprintf(), and Sys_Error().

Referenced by RT_CheckCell().

◆ va()

const char * va ( const char * format,
... )

does a varargs printf into a temp buffer, so I don't need to have varargs versions of all text functions.

Definition at line 410 of file shared.cpp.

References format(), index, Q_vsnprintf(), and VA_BUFSIZE.

Referenced by AIM_DrawAircraftSlots(), AIM_UpdateAircraftItemList(), AIR_AircraftStatusToName(), AIR_CampaignRun(), AIR_GeoSelectAircraft_f(), AIR_SendAircraftPursuingUFO(), AIRFIGHT_ExecuteActions(), B_AssembleMap(), B_BuildingDestroy_f(), B_Destroy_AntimaterStorage_f(), B_FillBuildingInfo_f(), B_FillMap_f(), B_SellOrAddItems(), BS_FillMarket_f(), CIN_OpenCinematic(), CL_ActorDie(), CL_ActorRevitalised(), CL_ActorSelect(), CL_ActorStateChange(), CL_BattlescapeRadarGenerate_f(), CL_CameraAppear(), CL_CharacterSkillAndScoreCvars(), CL_DisplayPopupInterceptUFO(), CL_DownloadMap(), CL_DownloadUMPMap(), CL_EventAddMail(), CL_InitSkin_f(), CL_ParticleLoadArt(), CL_QueryMasterServer(), CL_TeamDefInitMenu(), CL_VideoInitMenu(), Com_Error(), Com_GetAircraftIdNum(), Com_GetConstIntFromNamespace(), Com_GetCrashedAircraftIdNum(), Com_GetRandomMapAssemblyNameForCraft(), Com_ParseAircraftNames(), Com_ParseTeam(), Com_Quit(), CP_BaseAttackStartMission(), Cvar_Switch_f(), uiRadarNode::draw(), uiVideoNode::drawOverWindow(), FS_AddHomeAsGameDirectory(), FS_CreateOpenPipeFile(), FS_GetModList(), FS_WriteFile(), G_Init(), G_MissionGetTeamString(), GAME_MP_BookmarkAdd_f(), GAME_MP_CompleteNetworkAddress(), GAME_MP_ParseTeamInfoMessage(), GAME_MP_Results(), GAME_MP_ServerListInit(), GAME_TeamSlotComments_f(), GenerateFootstepList(), GEO_Init(), HUD_ActorWoundData_f(), HUD_ToggleCrouchReservation_f(), HUD_UpdateActorStats(), IN_JoystickInitMenu(), Info_SetValueForKeyAsInteger(), INS_FillTypes_f(), INS_FillUFOYardData_f(), Irc_Client_CmdPrivmsg(), Irc_Client_Invite_f(), Key_WriteBindings(), LET_StartIdle(), M_Start(), Master_Shutdown(), MD2SkinEdit(), MD2SkinNum(), MIS_GetName(), MIS_InitResultScreen(), MSO_InitList(), PR_RequirementsInfo(), PR_UpdateProductionList(), Qcommon_Init(), R_Draw3DGlobe(), R_DrawFlatGeoscape(), R_FindImage(), R_FindPics(), R_GenerateGrass(), R_InitializeShader(), R_InitImages(), R_LoadActorSkinsFromModel(), R_LoadAnimImages(), R_LoadMaterials(), R_LoadObjSkin(), R_LoadProgram(), R_ParseStage(), S_LoadSampleChunk(), S_MumbleUpdate(), SAV_GameLoad(), SCR_DrawDownloading(), SCR_UpdateScreen(), SV_Map(), SV_SetConfigString(), SV_SetMaster_f(), SV_StartGame_f(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TR_CargoList(), TR_InitBaseList(), TR_List_f(), UFO_AnalyseTestWindow(), UFO_CampaignCheckEvents(), UFO_ExecuteTestWindow(), UFO_GetName(), UFO_SearchAircraftTarget(), UI_AllocStaticStringCondition(), UI_BaseInventoryNodeDraw2(), UI_BaseInventoryNodeDrawItems(), UI_DrawFree(), UI_EditorNodeExtract_f(), UI_GenInjectedString(), UI_GetStringFromExpression(), UI_GetStringFromNodeProperty(), UI_InitRadar(), UI_LoadImage(), UI_LoadWrappedImage(), UI_ParseValueExpression(), UI_PlaySound(), UI_PopupButton(), UI_Tooltip(), UP_GenerateArticlesSummary(), UP_GenerateSummary(), VectorRotate(), VID_Init(), and WEB_CGameUpload().