- OIC_LOG(INFO, TAG, "Deleting platform info.");
-
- OICFree(savedPlatformInfo.platformID);
- savedPlatformInfo.platformID = NULL;
-
- OICFree(savedPlatformInfo.manufacturerName);
- savedPlatformInfo.manufacturerName = NULL;
-
- OICFree(savedPlatformInfo.manufacturerUrl);
- savedPlatformInfo.manufacturerUrl = NULL;
-
- OICFree(savedPlatformInfo.modelNumber);
- savedPlatformInfo.modelNumber = NULL;
-
- OICFree(savedPlatformInfo.dateOfManufacture);
- savedPlatformInfo.dateOfManufacture = NULL;
-
- OICFree(savedPlatformInfo.platformVersion);
- savedPlatformInfo.platformVersion = NULL;
-
- OICFree(savedPlatformInfo.operatingSystemVersion);
- savedPlatformInfo.operatingSystemVersion = NULL;
-
- OICFree(savedPlatformInfo.hardwareVersion);
- savedPlatformInfo.hardwareVersion = NULL;
-
- OICFree(savedPlatformInfo.firmwareVersion);
- savedPlatformInfo.firmwareVersion = NULL;
-
- OICFree(savedPlatformInfo.supportUrl);
- savedPlatformInfo.supportUrl = NULL;
-
- OICFree(savedPlatformInfo.systemTime);
- savedPlatformInfo.systemTime = NULL;
-}
-
-static OCStackResult DeepCopyPlatFormInfo(OCPlatformInfo info)
-{
- savedPlatformInfo.platformID = OICStrdup(info.platformID);
- savedPlatformInfo.manufacturerName = OICStrdup(info.manufacturerName);
- savedPlatformInfo.manufacturerUrl = OICStrdup(info.manufacturerUrl);
- savedPlatformInfo.modelNumber = OICStrdup(info.modelNumber);
- savedPlatformInfo.dateOfManufacture = OICStrdup(info.dateOfManufacture);
- savedPlatformInfo.platformVersion = OICStrdup(info.platformVersion);
- savedPlatformInfo.operatingSystemVersion = OICStrdup(info.operatingSystemVersion);
- savedPlatformInfo.hardwareVersion = OICStrdup(info.hardwareVersion);
- savedPlatformInfo.firmwareVersion = OICStrdup(info.firmwareVersion);
- savedPlatformInfo.supportUrl = OICStrdup(info.supportUrl);
- savedPlatformInfo.systemTime = OICStrdup(info.systemTime);
-
- if ((!savedPlatformInfo.platformID && info.platformID)||
- (!savedPlatformInfo.manufacturerName && info.manufacturerName)||
- (!savedPlatformInfo.manufacturerUrl && info.manufacturerUrl)||
- (!savedPlatformInfo.modelNumber && info.modelNumber)||
- (!savedPlatformInfo.dateOfManufacture && info.dateOfManufacture)||
- (!savedPlatformInfo.platformVersion && info.platformVersion)||
- (!savedPlatformInfo.operatingSystemVersion && info.operatingSystemVersion)||
- (!savedPlatformInfo.hardwareVersion && info.hardwareVersion)||
- (!savedPlatformInfo.firmwareVersion && info.firmwareVersion)||
- (!savedPlatformInfo.supportUrl && info.supportUrl)||
- (!savedPlatformInfo.systemTime && info.systemTime))
- {
- DeletePlatformInfo();
- return OC_STACK_INVALID_PARAM;
+ OCResource *resource = NULL;
+ if (!info.platformID || !info.manufacturerName)
+ {
+ OIC_LOG(ERROR, TAG, "No value specified.");
+ goto exit;
+ }
+ if (0 == strlen(info.platformID) || 0 == strlen(info.manufacturerName))
+ {
+ OIC_LOG(ERROR, TAG, "The passed value cannot be empty");
+ goto exit;
+ }
+ if ((info.manufacturerName && strlen(info.manufacturerName) > MAX_PLATFORM_NAME_LENGTH) ||
+ (info.manufacturerUrl && strlen(info.manufacturerUrl) > MAX_PLATFORM_URL_LENGTH) ||
+ (info.modelNumber && strlen(info.modelNumber) > MAX_PLATFORM_NAME_LENGTH) ||
+ (info.platformVersion && strlen(info.platformVersion) > MAX_PLATFORM_NAME_LENGTH) ||
+ (info.operatingSystemVersion && strlen(info.operatingSystemVersion) > MAX_PLATFORM_NAME_LENGTH) ||
+ (info.hardwareVersion && strlen(info.hardwareVersion) > MAX_PLATFORM_NAME_LENGTH) ||
+ (info.firmwareVersion && strlen(info.firmwareVersion) > MAX_PLATFORM_NAME_LENGTH) ||
+ (info.supportUrl && strlen(info.supportUrl) > MAX_PLATFORM_URL_LENGTH))
+ {
+ OIC_LOG(ERROR, TAG, "The passed value is bigger than permitted.");
+ goto exit;