void CIniFileProcessor::Terminate() { if (HasUnsavedChanges()) { CString cTemp; cTemp = _T("FDMS can retain the settings that have been changed in this session.\r\nDo you want to retain the modified settings and option values?"); if (AfxMessageBox(cTemp, MB_YESNO) == IDYES) { MakeModificationsPermanent(); } } FreeValues(); }
AwaError ResponseCommon_Free(ResponseCommon ** response) { AwaError result = AwaError_Unspecified; if ((response != NULL) && (*response != NULL)) { LogFree("ResponseCommon", *response); FreeSimpleMap(&((*response)->PathResults)); FreeSimpleMap(&((*response)->NulledValues)); FreeValues(&((*response)->Values)); Tree_Delete((*response)->ObjectsNode); Awa_MemSafeFree(*response); *response = NULL; result = AwaError_Success; } else { result = AwaError_OperationInvalid; } return result; }
AwaError ResponseCommon_BuildValues(ResponseCommon * response) { AwaError result = AwaError_Success; // success if no values are found if (response != NULL) { FreeValues(&response->Values); response->Values = Map_New(); if (response->Values != NULL) { // get the resource type for the path const OperationCommon * operation = ResponseCommon_GetOperation(response); if (operation != NULL) { const SessionCommon * sessionCommon = OperationCommon_GetSessionCommon(operation); if (sessionCommon != NULL) { TreeNode currentNode = response->ObjectsNode; while ((currentNode = ObjectsTree_GetNextLeafNode(currentNode)) != NULL) { char path[MAX_PATH_LENGTH] = { 0 }; ObjectsTree_GetPath(currentNode, path, sizeof(path)); if (Path_IsValidForResource(path)) { LogDebug("Build values path: %s", path); const AwaResourceDefinition * resourceDefinition = SessionCommon_GetResourceDefinitionFromPath(sessionCommon, path); if (resourceDefinition != NULL) { AwaResourceType resourceType = AwaResourceDefinition_GetType(resourceDefinition); if (resourceType != AwaResourceType_Invalid) { Value * value = Value_New(currentNode, resourceType); if (value != NULL) { if (!Map_Contains(response->Values, path)) { LogDebug("MAP item path: %s", path); Map_Put(response->Values, path, value); result = AwaError_Success; } else { result = LogErrorWithEnum(AwaError_Internal, "A value already exists for %s", path); } } else { // No value is fine - occurs in operations where we only expect path results in the response. } } else { result = LogErrorWithEnum(AwaError_DefinitionInvalid, "resourceDefinition for %s has invalid type", path); } } else { result = LogErrorWithEnum(AwaError_DefinitionInvalid, "resourceDefinition for %s is NULL", path); } } } } else { result = LogErrorWithEnum(AwaError_SessionInvalid, "session is NULL"); } } else { result = LogErrorWithEnum(AwaError_OperationInvalid, "operation is NULL"); } } else { result = LogErrorWithEnum(AwaError_OutOfMemory); } } else { result = LogErrorWithEnum(AwaError_ResponseInvalid, "response is NULL"); } return result; }