|
|
|
@ -450,18 +450,31 @@ CONST_STRPTR SectionCanonicalName(SECTIONPTR abstractSection) |
|
|
|
|
{ |
|
|
|
|
ULONG primaryLength = 0; |
|
|
|
|
ULONG secondaryLength = 0; |
|
|
|
|
ULONG totalLength = 0; |
|
|
|
|
if(section->primary != NULL) |
|
|
|
|
{ |
|
|
|
|
primaryLength = strlen(section->primary); |
|
|
|
|
} |
|
|
|
|
if(section->secondary != NULL) |
|
|
|
|
if(section->secondary != NULL && strlen(section->secondary)>0) |
|
|
|
|
{ |
|
|
|
|
secondaryLength = strlen(section->secondary); |
|
|
|
|
} |
|
|
|
|
result = AllocVec(primaryLength+1+secondaryLength+1, MEMF_CLEAR); |
|
|
|
|
totalLength += primaryLength; |
|
|
|
|
if( secondaryLength > 0 ) |
|
|
|
|
{ |
|
|
|
|
totalLength += 1; // '.'
|
|
|
|
|
totalLength += secondaryLength; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
result = AllocVec(totalLength+1, MEMF_CLEAR); |
|
|
|
|
|
|
|
|
|
CopyMem(section->primary, result, primaryLength); |
|
|
|
|
result[primaryLength] = '.'; |
|
|
|
|
CopyMem(section->secondary, result+primaryLength+1, secondaryLength);
|
|
|
|
|
if( secondaryLength > 0 ) |
|
|
|
|
{ |
|
|
|
|
result[primaryLength] = '.'; |
|
|
|
|
CopyMem(section->secondary, result+primaryLength+1, secondaryLength);
|
|
|
|
|
} |
|
|
|
|
result[totalLength] = '\0'; |
|
|
|
|
} |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
@ -544,7 +557,7 @@ CONST_STRPTR VariableSerialize(VARIABLEPTR abstractVariable) |
|
|
|
|
struct Variable* variable = (struct Variable*)abstractVariable; |
|
|
|
|
if( variable != NULL && variable->normalizedKey != NULL && variable->value.stringValue != NULL ) |
|
|
|
|
{ |
|
|
|
|
ULONG size = strlen(variable->normalizedKey) + 3 + strlen(variable->value.stringValue) + 1; |
|
|
|
|
ULONG size = 1 + strlen(variable->normalizedKey) + 3 + strlen(variable->value.stringValue) + 1 + 1; |
|
|
|
|
result = AllocVec(size, MEMF_CLEAR); |
|
|
|
|
sprintf(result, "\t%s = %s\n", variable->normalizedKey, variable->value.stringValue); |
|
|
|
|
} |
|
|
|
|