if (CborNoError == cborEncoderResult)
{
OIC_LOG(DEBUG, TAG, "AclToCBORPayload Successed");
- *size = encoder.ptr - outPayload;
+ *size = cbor_encoder_get_buffer_size(&encoder, outPayload);
*payload = outPayload;
ret = OC_STACK_OK;
}
// reallocate and try again!
OICFree(outPayload);
// Since the allocated initial memory failed, double the memory.
- cborLen += encoder.ptr - encoder.end;
+ cborLen += cbor_encoder_get_buffer_size(&encoder, encoder.end);
cborEncoderResult = CborNoError;
ret = AclToCBORPayload(secAcl, payload, &cborLen);
*size = cborLen;
if (CborNoError == cborEncoderResult)
{
*cborPayload = outPayload;
- *cborSize = encoder.ptr - outPayload;
+ *cborSize = cbor_encoder_get_buffer_size(&encoder, outPayload);
ret = OC_STACK_OK;
}
OICFree(outPayload);
outPayload = NULL;
// Since the allocated initial memory failed, double the memory.
- cborLen += encoder.ptr - encoder.end;
+ cborLen += cbor_encoder_get_buffer_size(&encoder, encoder.end);
cborEncoderResult = CborNoError;
ret = AmaclToCBORPayload(amaclS, cborPayload, &cborLen);
if (OC_STACK_OK == ret)
{
OIC_LOG(DEBUG, TAG, "CredToCBORPayload Successed");
*cborPayload = outPayload;
- *cborSize = encoder.ptr - outPayload;
+ *cborSize = cbor_encoder_get_buffer_size(&encoder, outPayload);
ret = OC_STACK_OK;
}
OIC_LOG(DEBUG, TAG, "CredToCBORPayload OUT");
// reallocate and try again!
OICFree(outPayload);
// Since the allocated initial memory failed, double the memory.
- cborLen += encoder.ptr - encoder.end;
+ cborLen += cbor_encoder_get_buffer_size(&encoder, encoder.end);
cborEncoderResult = CborNoError;
ret = CredToCBORPayload(credS, cborPayload, &cborLen, secureFlag);
*cborSize = cborLen;
cborEncoderResult = cbor_encoder_close_container(&encoder, &crlMap);
VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed to add close Crl map");
- *size = encoder.ptr - outPayload;
+ *size = cbor_encoder_get_buffer_size(&encoder, outPayload);
*payload = outPayload;
ret = OC_STACK_OK;
// reallocate and try again!
OICFree(outPayload);
// Since the allocated initial memory failed, double the memory.
- cborLen += encoder.ptr - encoder.end;
+ cborLen += cbor_encoder_get_buffer_size(&encoder, encoder.end);
cborEncoderResult = CborNoError;
ret = CrlToCBORPayload(crl, payload, &cborLen, lastUpdate);
}
if (CborNoError == cborEncoderResult)
{
- *size = encoder.ptr - outPayload;
+ *size = cbor_encoder_get_buffer_size(&encoder, outPayload);
*payload = outPayload;
ret = OC_STACK_OK;
}
// reallocate and try again!
OICFree(outPayload);
// Since the allocated initial memory failed, double the memory.
- cborLen += encoder.ptr - encoder.end;
+ cborLen += cbor_encoder_get_buffer_size(&encoder, encoder.end);
OIC_LOG_V(DEBUG, TAG, "Doxm reallocation size : %zd.", cborLen);
cborEncoderResult = CborNoError;
ret = DoxmToCBORPayload(doxm, payload, &cborLen, rwOnly);
if (CborNoError == cborEncoderResult)
{
- *size = encoder.ptr - outPayload;
+ *size = cbor_encoder_get_buffer_size(&encoder, outPayload);
*payload = outPayload;
ret = OC_STACK_OK;
}
// reallocate and try again!
OICFree(outPayload);
// Since the allocated initial memory failed, double the memory.
- cborLen += encoder.ptr - encoder.end;
+ cborLen += cbor_encoder_get_buffer_size(&encoder, encoder.end);
cborEncoderResult = CborNoError;
ret = DpairingToCBORPayload(dpair, payload, &cborLen);
*size = cborLen;
cborEncoderResult = cbor_encoder_close_container(&encoder, &pconfMap);
VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed to close pconfMap");
- *size = encoder.ptr - outPayload;
+ *size = cbor_encoder_get_buffer_size(&encoder, outPayload);
*payload = outPayload;
ret = OC_STACK_OK;
exit:
// reallocate and try again!
OICFree(outPayload);
// Since the allocated initial memory failed, double the memory.
- cborLen += encoder.ptr - encoder.end;
+ cborLen += cbor_encoder_get_buffer_size(&encoder, encoder.end);
cborEncoderResult = CborNoError;
ret = PconfToCBORPayload(pconf, payload, &cborLen);
*size = cborLen;
cborEncoderResult |= cbor_encoder_close_container(&encoder, &secRsrc);
VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Closing Array.");
- outSize = encoder.ptr - outPayload;
+ outSize = cbor_encoder_get_buffer_size(&encoder, outPayload);
}
}
else if (psPayload && psSize)
cborEncoderResult |= cbor_encoder_close_container(&encoder, &secRsrc);
VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Closing Array.");
- outSize = encoder.ptr - outPayload;
+ outSize = cbor_encoder_get_buffer_size(&encoder, outPayload);
}
if (outPayload && outSize)
cborEncoderResult |= cbor_encoder_close_container(&encoder, &secRsrc);
VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Closing Array.");
- outSize = encoder.ptr - outPayload;
+ outSize = cbor_encoder_get_buffer_size(&encoder, outPayload);
}
if (outPayload && outSize)
cborEncoderResult |= cbor_encoder_close_container(&encoder, &secRsrc);
VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Closing Array.");
- resetPfCborLen = encoder.ptr - resetPfCbor;
+ resetPfCborLen = cbor_encoder_get_buffer_size(&encoder, resetPfCbor);
}
UpdateSecureResourceInPS(OIC_JSON_RESET_PF_NAME, resetPfCbor, resetPfCborLen);
if (CborNoError == cborEncoderResult)
{
- *size = encoder.ptr - outPayload;
+ *size = cbor_encoder_get_buffer_size(&encoder, outPayload);
*payload = outPayload;
ret = OC_STACK_OK;
}
// reallocate and try again!
OICFree(outPayload);
// Since the allocated initial memory failed, double the memory.
- cborLen += encoder.ptr - encoder.end;
+ cborLen += cbor_encoder_get_buffer_size(&encoder, encoder.end);
cborEncoderResult = CborNoError;
ret = PstatToCBORPayload(pstat, payload, &cborLen, writableOnly);
if (OC_STACK_OK == ret)
if (CborNoError == cborEncoderResult)
{
*cborPayload = outPayload;
- *cborSize = encoder.ptr - outPayload;
+ *cborSize = cbor_encoder_get_buffer_size(&encoder, outPayload);
ret = OC_STACK_OK;
}
OICFree(outPayload);
outPayload = NULL;
// Since the allocated initial memory failed, double the memory.
- cborLen += encoder.ptr - encoder.end;
+ cborLen += cbor_encoder_get_buffer_size(&encoder, encoder.end);
cborEncoderResult = CborNoError;
ret = SVCToCBORPayload(svc, cborPayload, &cborLen);
*cborSize = cborLen;
if (CborNoError == cborEncoderResult)
{
- *size = encoder.ptr - outPayload;
+ *size = cbor_encoder_get_buffer_size(&encoder, outPayload);
*payload = outPayload;
ret = OC_STACK_OK;
}
// reallocate and try again!
OICFree(outPayload);
// Since the allocated initial memory failed, double the memory.
- cborLen += encoder.ptr - encoder.end;
+ cborLen += cbor_encoder_get_buffer_size(&encoder, encoder.end);
OIC_LOG_V(DEBUG, TAG, "Ver reallocation size : %zd.", cborLen);
cborEncoderResult = CborNoError;
ret = VerToCBORPayload(ver, payload, &cborLen);
cborEncoderResult = cbor_encoder_close_container(&encoder, &map);
VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Closing Container.");
- size_t s = encoder.ptr - outPayload;
+ size_t s = cbor_encoder_get_buffer_size(&encoder, outPayload);
OIC_LOG_V(DEBUG, TAG, "Payload size %zu", s);
fp1 = fopen(cborFileName, "w");