Skip to content

Commit

Permalink
Fixed loop logic.
Browse files Browse the repository at this point in the history
Continue iterating when encountering invalid nodes.
  • Loading branch information
RedGreenBlue09 committed Feb 3, 2024
1 parent ec85f37 commit f83ed2c
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 17 deletions.
1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ add_executable(DriverDefPaths
${DriverDefPaths_SOURCE_FILES}
)
target_include_directories(DriverDefPaths PRIVATE
${EXPAT_INCLUDE_DIRS}
${DriverDefPaths_SOURCE_DIR}/Include
)
target_link_libraries(DriverDefPaths PUBLIC expat)
Expand Down
9 changes: 3 additions & 6 deletions Source/Main.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,21 +107,18 @@ int main(int argc, char** argv) {
xml_attribute* pPathAttribute = XmlNodeFindAttribute(pDriverPackageFileNode, "Path");
xml_attribute* pNameAttribute = XmlNodeFindAttribute(pDriverPackageFileNode, "Name");
if (!pPathAttribute || !pNameAttribute)
break;
continue;

char* sDriverPath = pPathAttribute->sContent;
char* sDriverName = pNameAttribute->sContent;
if (!sDriverPath || !sDriverName)
break;
continue;

// Remove "$(mspackageroot)".
// "$(mspackageroot)" is always at the start of the path
// because that's the only place it makes sense.
size_t MprLength = strlen_literal("$(mspackageroot)");
if (
(strlen(sDriverPath) >= MprLength) &&
(strncmp(sDriverPath, "$(mspackageroot)", MprLength) == 0)
)
if (strncmp(sDriverPath, "$(mspackageroot)", MprLength) == 0)
sDriverPath += MprLength;

// Remove trailing backslash.
Expand Down
10 changes: 0 additions & 10 deletions Source/XmlNode.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,6 @@ void XmlNodeFree(xml_node* pNode) {
free(pNode);
}

/*
void XmlNodeSetContent(xml_node* pNode, const char* sContent) {
assert(pNode != NULL);
size_t ContentSize = (strlen(sContent) + 1) * sizeof(*sContent);
pNode->sContent = realloc_guarded(pNode->sContent, ContentSize);
memcpy(pNode->sContent, sContent, ContentSize);
}
*/

void XmlNodeAddChildren(xml_node* pParentNode, xml_node* pChildrenNode) {
assert(pParentNode != NULL);
assert(pChildrenNode != NULL);
Expand Down

0 comments on commit f83ed2c

Please sign in to comment.