; FilePath = (FILEPATH_DEVICE_PATH*)NextDevicePathNode (&FilePath->Header)\r
){\r
//\r
- // all the rest should be file path nodes\r
+ // If any node is not a file path node, then the conversion can not be completed\r
//\r
if ((DevicePathType(&FilePath->Header) != MEDIA_DEVICE_PATH) ||\r
(DevicePathSubType(&FilePath->Header) != MEDIA_FILEPATH_DP)) {\r
FreePool(PathForReturn);\r
- PathForReturn = NULL;\r
- ASSERT(FALSE);\r
- } else {\r
- //\r
- // append the path part onto the filepath.\r
- //\r
- ASSERT((PathForReturn == NULL && PathSize == 0) || (PathForReturn != NULL));\r
-\r
- AlignedNode = AllocateCopyPool (DevicePathNodeLength(FilePath), FilePath);\r
- ASSERT (AlignedNode != NULL);\r
-\r
- // File Path Device Path Nodes 'can optionally add a "\" separator to\r
- // the beginning and/or the end of the Path Name string.'\r
- // (UEFI Spec 2.4 section 9.3.6.4).\r
- // If necessary, add a "\", but otherwise don't\r
- // (This is specified in the above section, and also implied by the\r
- // UEFI Shell spec section 3.7)\r
- if ((PathSize != 0) &&\r
- (PathForReturn != NULL) &&\r
- (PathForReturn[PathSize - 1] != L'\\') &&\r
- (AlignedNode->PathName[0] != L'\\')) {\r
- PathForReturn = StrnCatGrow (&PathForReturn, &PathSize, L"\\", 1);\r
- }\r
+ return NULL;\r
+ }\r
\r
- PathForReturn = StrnCatGrow(&PathForReturn, &PathSize, AlignedNode->PathName, 0);\r
- FreePool(AlignedNode);\r
+ //\r
+ // append the path part onto the filepath.\r
+ //\r
+ ASSERT((PathForReturn == NULL && PathSize == 0) || (PathForReturn != NULL));\r
+\r
+ AlignedNode = AllocateCopyPool (DevicePathNodeLength(FilePath), FilePath);\r
+ ASSERT (AlignedNode != NULL);\r
+\r
+ // File Path Device Path Nodes 'can optionally add a "\" separator to\r
+ // the beginning and/or the end of the Path Name string.'\r
+ // (UEFI Spec 2.4 section 9.3.6.4).\r
+ // If necessary, add a "\", but otherwise don't\r
+ // (This is specified in the above section, and also implied by the\r
+ // UEFI Shell spec section 3.7)\r
+ if ((PathSize != 0) &&\r
+ (PathForReturn != NULL) &&\r
+ (PathForReturn[PathSize - 1] != L'\\') &&\r
+ (AlignedNode->PathName[0] != L'\\')) {\r
+ PathForReturn = StrnCatGrow (&PathForReturn, &PathSize, L"\\", 1);\r
}\r
+\r
+ PathForReturn = StrnCatGrow(&PathForReturn, &PathSize, AlignedNode->PathName, 0);\r
+ FreePool(AlignedNode);\r
} // for loop of remaining nodes\r
}\r
if (PathForReturn != NULL) {\r