cinera: s/StringLength()/sizeof()-1 on string lits
This commit is contained in:
parent
63ab9d5bc2
commit
af1bff4218
|
@ -23,7 +23,7 @@ typedef struct
|
||||||
version CINERA_APP_VERSION = {
|
version CINERA_APP_VERSION = {
|
||||||
.Major = 0,
|
.Major = 0,
|
||||||
.Minor = 8,
|
.Minor = 8,
|
||||||
.Patch = 15
|
.Patch = 16
|
||||||
};
|
};
|
||||||
|
|
||||||
#include <stdarg.h> // NOTE(matt): varargs
|
#include <stdarg.h> // NOTE(matt): varargs
|
||||||
|
@ -7550,7 +7550,7 @@ GenerateTopicColours(neighbourhood *N, string Topic)
|
||||||
bool Exists = FALSE;
|
bool Exists = FALSE;
|
||||||
while(Topics.Buffer.Ptr - Topics.Buffer.Location < Topics.Buffer.Size)
|
while(Topics.Buffer.Ptr - Topics.Buffer.Location < Topics.Buffer.Size)
|
||||||
{
|
{
|
||||||
Topics.Buffer.Ptr += StringLength(".category.");
|
Topics.Buffer.Ptr += sizeof(".category.")-1;
|
||||||
if(!StringsDifferT(SanitisedTopic, Topics.Buffer.Ptr, ' '))
|
if(!StringsDifferT(SanitisedTopic, Topics.Buffer.Ptr, ' '))
|
||||||
{
|
{
|
||||||
Exists = TRUE;
|
Exists = TRUE;
|
||||||
|
@ -8012,7 +8012,7 @@ DepartComment(buffer *Template)
|
||||||
{
|
{
|
||||||
if(!StringsDifferT("-->", Template->Ptr, 0))
|
if(!StringsDifferT("-->", Template->Ptr, 0))
|
||||||
{
|
{
|
||||||
Template->Ptr += StringLength("-->");
|
Template->Ptr += sizeof("-->")-1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
++Template->Ptr;
|
++Template->Ptr;
|
||||||
|
@ -8386,7 +8386,7 @@ NextTagSearch:
|
||||||
if(*Template->File.Buffer.Ptr == '!' && (Template->File.Buffer.Ptr > Template->File.Buffer.Location && !StringsDifferT("<!--", &Template->File.Buffer.Ptr[-1], 0)))
|
if(*Template->File.Buffer.Ptr == '!' && (Template->File.Buffer.Ptr > Template->File.Buffer.Location && !StringsDifferT("<!--", &Template->File.Buffer.Ptr[-1], 0)))
|
||||||
{
|
{
|
||||||
char *CommentStart = &Template->File.Buffer.Ptr[-1];
|
char *CommentStart = &Template->File.Buffer.Ptr[-1];
|
||||||
Template->File.Buffer.Ptr += StringLength("!--");
|
Template->File.Buffer.Ptr += sizeof("!--")-1;
|
||||||
while(Template->File.Buffer.Ptr - Template->File.Buffer.Location < Template->File.Buffer.Size && StringsDifferT("-->", Template->File.Buffer.Ptr, 0))
|
while(Template->File.Buffer.Ptr - Template->File.Buffer.Location < Template->File.Buffer.Size && StringsDifferT("-->", Template->File.Buffer.Ptr, 0))
|
||||||
{
|
{
|
||||||
for(template_tag_code TagIndex = 0; TagIndex < TEMPLATE_TAG_COUNT; ++TagIndex)
|
for(template_tag_code TagIndex = 0; TagIndex < TEMPLATE_TAG_COUNT; ++TagIndex)
|
||||||
|
@ -10228,7 +10228,7 @@ HMMLToBuffers(buffers *CollationBuffers, template *BespokeTemplate, string BaseF
|
||||||
// TODO(matt): A "MakeString0OnStack()" sort of function?
|
// TODO(matt): A "MakeString0OnStack()" sort of function?
|
||||||
// NOTE(matt): Stack-string
|
// NOTE(matt): Stack-string
|
||||||
int NullTerminationBytes = 1;
|
int NullTerminationBytes = 1;
|
||||||
char Filepath[CurrentProject->HMMLDir.Length + StringLength("/") + BaseFilename.Length + ExtensionStrings[EXT_HMML].Length + NullTerminationBytes];
|
char Filepath[CurrentProject->HMMLDir.Length + sizeof("/")-1 + BaseFilename.Length + ExtensionStrings[EXT_HMML].Length + NullTerminationBytes];
|
||||||
char *P = Filepath;
|
char *P = Filepath;
|
||||||
P += CopyStringToBarePtr(P, CurrentProject->HMMLDir);
|
P += CopyStringToBarePtr(P, CurrentProject->HMMLDir);
|
||||||
P += CopyStringToBarePtr(P, Wrap0("/"));
|
P += CopyStringToBarePtr(P, Wrap0("/"));
|
||||||
|
@ -10772,7 +10772,7 @@ HMMLToBuffers(buffers *CollationBuffers, template *BespokeTemplate, string BaseF
|
||||||
NullTopic ? "title=\"Timestamps that don't fit into the above topic(s) may be filtered using this pseudo-topic\" " : "",
|
NullTopic ? "title=\"Timestamps that don't fit into the above topic(s) may be filtered using this pseudo-topic\" " : "",
|
||||||
SanitisedMarker,
|
SanitisedMarker,
|
||||||
SanitisedMarker,
|
SanitisedMarker,
|
||||||
NullTopic ? (int)StringLength("(null topic)") : (int)This->Marker.Length,
|
NullTopic ? (int)sizeof("(null topic)-1") : (int)This->Marker.Length,
|
||||||
NullTopic ? "(null topic)" : This->Marker.Base);
|
NullTopic ? "(null topic)" : This->Marker.Base);
|
||||||
}
|
}
|
||||||
CopyStringToBuffer(&MenuBuffers.FilterTopics,
|
CopyStringToBuffer(&MenuBuffers.FilterTopics,
|
||||||
|
@ -11868,7 +11868,7 @@ AccumulateDBEntryInsertionOffset(db_header_project *Header, int EntryIndex)
|
||||||
Result += Entry->Size;
|
Result += Entry->Size;
|
||||||
--Entry;
|
--Entry;
|
||||||
}
|
}
|
||||||
Result += StringLength("---\n");
|
Result += sizeof("---\n")-1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -12196,7 +12196,7 @@ InsertIntoDB(neighbourhood *N, buffers *CollationBuffers, template *BespokeTempl
|
||||||
db_entry *Result = 0;
|
db_entry *Result = 0;
|
||||||
ResetNeighbourhood(N);
|
ResetNeighbourhood(N);
|
||||||
edit_type_id EditType = EDIT_APPEND;
|
edit_type_id EditType = EDIT_APPEND;
|
||||||
int EntryInsertionStart = StringLength("---\n");
|
int EntryInsertionStart = sizeof("---\n")-1;
|
||||||
int EntryInsertionEnd = 0;
|
int EntryInsertionEnd = 0;
|
||||||
|
|
||||||
if(N->Project->EntryCount > 0)
|
if(N->Project->EntryCount > 0)
|
||||||
|
@ -15200,7 +15200,7 @@ InitProjectInDBRecursively(project_generations *G, project *P)
|
||||||
while((BaseDirFiles = readdir(BaseDirHandle)) && !RemovedOldMetadataFile)
|
while((BaseDirFiles = readdir(BaseDirHandle)) && !RemovedOldMetadataFile)
|
||||||
{
|
{
|
||||||
char *Ptr = BaseDirFiles->d_name;
|
char *Ptr = BaseDirFiles->d_name;
|
||||||
Ptr += (StringLength(BaseDirFiles->d_name) - StringLength(".metadata"));
|
Ptr += (StringLength(BaseDirFiles->d_name) - sizeof(".metadata")-1);
|
||||||
if(!(StringsDiffer0(Ptr, ".metadata")))
|
if(!(StringsDiffer0(Ptr, ".metadata")))
|
||||||
{
|
{
|
||||||
char *MetadataPath = MakeString0("lss", &P->BaseDir, "/", BaseDirFiles->d_name);
|
char *MetadataPath = MakeString0("lss", &P->BaseDir, "/", BaseDirFiles->d_name);
|
||||||
|
@ -15214,7 +15214,7 @@ InitProjectInDBRecursively(project_generations *G, project *P)
|
||||||
{
|
{
|
||||||
// NOTE(matt): Stack-string
|
// NOTE(matt): Stack-string
|
||||||
int NullTerminationBytes = 1;
|
int NullTerminationBytes = 1;
|
||||||
char IndexPath[P->BaseDir.Length + StringLength("/") + Filename.Length + NullTerminationBytes];
|
char IndexPath[P->BaseDir.Length + sizeof("/")-1 + Filename.Length + NullTerminationBytes];
|
||||||
char *Ptr = IndexPath;
|
char *Ptr = IndexPath;
|
||||||
Ptr += CopyStringToBarePtr(Ptr, P->BaseDir);
|
Ptr += CopyStringToBarePtr(Ptr, P->BaseDir);
|
||||||
Ptr += CopyStringToBarePtr(Ptr, Wrap0("/"));
|
Ptr += CopyStringToBarePtr(Ptr, Wrap0("/"));
|
||||||
|
|
|
@ -4350,8 +4350,8 @@ PrintLineage(string Lineage, bool AppendNewline)
|
||||||
uint8_t
|
uint8_t
|
||||||
GetColumnsRequiredForMedium(medium *M, typography *T)
|
GetColumnsRequiredForMedium(medium *M, typography *T)
|
||||||
{
|
{
|
||||||
uint8_t Result = M->ID.Length + StringLength(T->Delimiter) + M->Name.Length + StringLength(" (") + M->Icon.Length + StringLength(")");
|
uint8_t Result = M->ID.Length + StringLength(T->Delimiter) + M->Name.Length + sizeof(" (")-1 + M->Icon.Length + sizeof(")")-1;
|
||||||
if(M->Hidden) { Result += StringLength(" [hidden]"); }
|
if(M->Hidden) { Result += sizeof(" [hidden]")-1; }
|
||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue