本文整理汇总了C++中Q_strncasecmp函数的典型用法代码示例。如果您正苦于以下问题:C++ Q_strncasecmp函数的具体用法?C++ Q_strncasecmp怎么用?C++ Q_strncasecmp使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Q_strncasecmp函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Q1_TextureContents
//===========================================================================
// water, slime and lava brush textures names always start with a *
// followed by the type: "slime", "lava" or otherwise water
//
// Parameter: -
// Returns: -
// Changes Globals: -
//===========================================================================
int Q1_TextureContents(char *name)
{
if (!Q_strcasecmp(name, "clip"))
{
return CONTENTS_SOLID;
}
if (name[0] == '*')
{
if (!Q_strncasecmp(name + 1, "lava", 4))
{
return CONTENTS_LAVA;
}
else if (!Q_strncasecmp(name + 1, "slime", 5))
{
return CONTENTS_SLIME;
}
else
{
return CONTENTS_WATER;
}
} //end if
else if (!Q_strncasecmp(name, "sky", 3))
{
return CONTENTS_SOLID;
}
else
{
return CONTENTS_SOLID;
}
} //end of the function Q1_TextureContents
示例2: FindTexinfo
/*
===============
FindTexinfo
Returns a global texinfo number
===============
*/
int FindTexinfo (texinfo_t *t)
{
int i, j;
texinfo_t *tex;
// set the special flag
if (miptex[t->miptex][0] == '*' ||
!options.SolidMap && !Q_strncasecmp (miptex[t->miptex], "sky",3) )
t->flags |= TEX_SPECIAL;
tex = texinfo;
for (i=0 ; i<numtexinfo;i++, tex++)
{
if (t->miptex != tex->miptex)
continue;
if (t->flags != tex->flags)
continue;
for (j=0 ; j<8 ; j++)
if (t->vecs[0][j] != tex->vecs[0][j])
break;
if (j != 8)
continue;
return i;
}
// allocate a new texture
ExtendArray(texinfo, i);
texinfo[i] = *t;
numtexinfo++;
return i;
}
示例3: CL_HTTP_Header
/*
===============
CL_HTTP_Header
libcurl callback to update header info.
===============
*/
static size_t /*EXPORT*/ CL_HTTP_Header (void *ptr, size_t size, size_t nmemb, void *stream)
{
char headerBuff[1024];
size_t bytes;
size_t len;
bytes = size * nmemb;
if (bytes <= 16)
return bytes;
//memset (headerBuff, 0, sizeof(headerBuff));
//memcpy (headerBuff, ptr, min(bytes, sizeof(headerBuff)-1));
if (bytes < sizeof(headerBuff)-1)
len = bytes;
else
len = sizeof(headerBuff)-1;
Q_strncpyz (headerBuff, ptr, len);
if (!Q_strncasecmp (headerBuff, "Content-Length: ", 16))
{
dlhandle_t *dl;
dl = (dlhandle_t *)stream;
if (dl->file)
dl->fileSize = strtoul (headerBuff + 16, NULL, 10);
}
return bytes;
}
示例4: TextToChannel
//-----------------------------------------------------------------------------
// Purpose: Convert "chan_xxx" into integer value for channel
// Input : *name -
// Output : static int
//-----------------------------------------------------------------------------
int TextToChannel( const char *name )
{
if ( !name )
{
Assert( 0 );
// CHAN_AUTO
return CHAN_AUTO;
}
if ( Q_strncasecmp( name, "chan_", strlen( "chan_" ) ) )
{
return atoi( name );
}
int c = ARRAYSIZE( g_pChannelNames );
int i;
for ( i = 0; i < c; i++ )
{
if ( !Q_strcasecmp( name, g_pChannelNames[ i ].name ) )
{
return g_pChannelNames[ i ].channel;
}
}
// At this point, it starts with chan_ but is not recognized
// atoi would return 0, so just do chan auto
DevMsg( "CSoundEmitterSystem: Warning, unknown channel type in sounds.txt (%s)\n", name );
return CHAN_AUTO;
}
示例5: AddBuildPoint
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CBaseObject::AddAndParseBuildPoint( int iAttachmentNumber, KeyValues *pkvBuildPoint )
{
int iPoint = AddBuildPoint( iAttachmentNumber );
m_BuildPoints[iPoint].m_bPutInAttachmentSpace = (pkvBuildPoint->GetInt( "PutInAttachmentSpace", 0 ) != 0);
// Now see if we've got a set of valid objects specified
KeyValues *pkvValidObjects = pkvBuildPoint->FindKey( "valid_objects" );
if ( pkvValidObjects )
{
KeyValues *pkvObject = pkvValidObjects->GetFirstSubKey();
while ( pkvObject )
{
const char *pSpecifiedObject = pkvObject->GetName();
int iLenObjName = Q_strlen( pSpecifiedObject );
// Find the object index for the name
for ( int i = 0; i < OBJ_LAST; i++ )
{
if ( !Q_strncasecmp( GetObjectInfo( i )->m_pClassName, pSpecifiedObject, iLenObjName) )
{
AddValidObjectToBuildPoint( iPoint, i );
break;
}
}
pkvObject = pkvObject->GetNextKey();
}
}
}
示例6: header_func
// libcurl callback to update header info.
static size_t header_func (void *ptr, size_t size, size_t nmemb, void *stream) {
size_t len, bytes = size * nmemb;
dlhandle_t *dl = (dlhandle_t *)stream;
char buffer[64];
if (dl->size)
return bytes;
if (bytes <= 16)
return bytes;
if (bytes > sizeof(buffer)-1)
bytes = sizeof(buffer)-1;
memcpy (buffer, ptr, bytes);
buffer[bytes] = 0;
if (!Q_strncasecmp (buffer, "Content-Length: ", 16)) {
//allocate buffer based on what the server claims content-length is. +1 for nul
len = strtoul (buffer + 16, NULL, 10);
if (len >= MAX_DLSIZE) {
Com_DPrintf ("[HTTP] Oversize file while trying to download '%s'\n", dl->url);
return 0;
}
dl->size = len + 1;
dl->buffer = Z_Malloc (dl->size);
}
return bytes;
}
示例7: FindTexinfo
/*
===============
FindTexinfo
Returns a global texinfo number
===============
*/
int FindTexinfo( texinfo_t *t )
{
int i, j;
texinfo_t *tex;
// set the special flag
if( (miptex[t->miptex][0] == '*' && !waterlightmap) || !Q_strncasecmp (miptex[t->miptex], "sky", 3) )
t->flags |= TEX_SPECIAL;
tex = texinfo;
for( i = 0; i < numtexinfo; i++, tex++ ) {
if( t->miptex != tex->miptex )
continue;
if( t->flags != tex->flags )
continue;
for( j = 0; j < 8; j++ ) {
if( t->vecs[0][j] != tex->vecs[0][j] )
break;
}
if( j != 8 )
continue;
return i;
}
// allocate a new texture
if( numtexinfo == MAX_MAP_TEXINFO )
Error( "numtexinfo == MAX_MAP_TEXINFO" );
texinfo[i] = *t;
return numtexinfo++;
}
示例8: SetLightStyles
void SetLightStyles (void)
{
int stylenum;
char *t;
entity_t *e;
int i, j;
char value[10];
char lighttargets[MAX_SWITCHED_LIGHTS][64];
// any light that is controlled (has a targetname)
// must have a unique style number generated for it
stylenum = 0;
for (i=1 ; i<num_entities ; i++)
{
e = &entities[i];
t = ValueForKey (e, "classname");
if (Q_strncasecmp (t, "light", 5))
continue;
// This is not true for dynamic lights
if (!Q_strcasecmp (t, "light_dynamic"))
continue;
t = ValueForKey (e, "targetname");
if (!t[0])
continue;
// find this targetname
for (j=0 ; j<stylenum ; j++)
if (!strcmp (lighttargets[j], t))
break;
if (j == stylenum)
{
if (stylenum == MAX_SWITCHED_LIGHTS)
Error ("Too many switched lights (error at light %s), max = %d", t, MAX_SWITCHED_LIGHTS);
strcpy (lighttargets[j], t);
stylenum++;
}
sprintf (value, "%i", 32 + j);
char *pCurrentStyle = ValueForKey( e, "style" );
// the designer has set a default lightstyle as well as making the light switchable
if ( pCurrentStyle )
{
int oldStyle = atoi(pCurrentStyle);
if ( oldStyle != 0 )
{
// save off the default style so the game code can make a switchable copy of it
SetKeyValue( e, "defaultstyle", pCurrentStyle );
}
}
SetKeyValue (e, "style", value);
}
}
示例9: ListCommands
void ListCommands (char *prefix)
{
cmd_function_t *cmd;
int preLen = strlen(prefix);
for (cmd=cmd_functions ; cmd ; cmd=cmd->next)
{
if(!Q_strncasecmp(prefix,cmd->name,preLen))
Con_Printf ("%s\n", cmd->name);
}
}
示例10: Q_stristr
const char* Q_stristr (const char* str, const char* substr)
{
const size_t sublen = strlen(substr);
while (*str) {
if (!Q_strncasecmp(str, substr, sublen))
break;
str++;
}
if (!(*str))
str = nullptr;
return str;
}
示例11: SoundLevelFromString
void CSoundParametersInternal::SoundLevelFromString( const char *sz )
{
if ( !Q_strncasecmp( sz, "SNDLVL_", strlen( "SNDLVL_" ) ) )
{
soundlevel.start = TextToSoundLevel( sz );
soundlevel.range = 0;
}
else
{
soundlevel.FromInterval( ReadInterval( sz ) );
}
}
示例12: TextToSoundLevel
void CSoundEmitterSystemBase::CSoundParametersInternal::SoundLevelFromString( const char *sz )
{
if ( !Q_strncasecmp( sz, "SNDLVL_", strlen( "SNDLVL_" ) ) )
{
soundlevel.start = TextToSoundLevel( sz );
soundlevel.range = 0.0f;
}
else
{
soundlevel = ReadInterval( sz );
}
Q_strncpy( m_szSoundLevel, sz, sizeof( m_szSoundLevel ) );
}
示例13: FindMiptex
int FindMiptex (char *name)
{
int i;
for (i=0 ; i<nummiptex ; i++)
{
if (!Q_strncasecmp(name, miptex[i], sizeof(char16)))
return i;
}
ExtendArray(miptex, i);
CleanupName (name, miptex[i]);
nummiptex++;
return i;
}
示例14: Movie_Demo_Capture_f
void Movie_Demo_Capture_f(void) {
int argc;
double time;
char *error;
error = va("Usage: %s <start time | stop>\n", Cmd_Argv(0));
if ((argc = Cmd_Argc()) != 2 && argc != 3) {
Com_Printf(error);
return;
}
if (argc == 2) {
if (Q_strncasecmp("stop", Cmd_Argv(1), 4))
Com_Printf(error);
else if (Movie_IsCapturing())
Movie_Stop();
else
Com_Printf("%s : Not capturing\n", Cmd_Argv(0));
return;
}
if (Q_strncasecmp("start", Cmd_Argv(1), 5)) {
Com_Printf(error);
return;
} else if (Movie_IsCapturing()) {
Com_Printf("%s : Already capturing\n", Cmd_Argv(0));
return;
}
if (!cls.demoplayback || cls.timedemo) {
Com_Printf("%s : Must be playing a demo to capture\n", Cmd_Argv(0));
return;
}
if ((time = Q_atof(Cmd_Argv(2))) <= 0) {
Com_Printf("%s : Time argument must be positive\n", Cmd_Argv(0));
return;
}
Movie_Start(time);
}
示例15: Prompt_AddMatch
qboolean Prompt_AddMatch( genctx_t *ctx, const char *s ) {
int r;
if( ctx->count >= ctx->size ) {
return qfalse;
}
if( ctx->ignorecase ) {
r = Q_strncasecmp( ctx->partial, s, ctx->length );
} else {
r = strncmp( ctx->partial, s, ctx->length );
}
if( !r ) {
ctx->matches[ctx->count++] = Z_CopyString( s );
}
return qtrue;
}