if (engine_cfg != NULL) {
error = mv_engine_config_get_int_attribute(engine_cfg, "MV_BARCODE_GENERATE_ATTR_TEXT", &showText);
if (error != MEDIA_VISION_ERROR_NONE) {
- LOGW("mv_engine_config_get_int_attribute failed");
+ LOGE("mv_engine_config_get_int_attribute failed");
return error;
}
if (showText == BARCODE_GEN_TEXT_VISIBLE && type == MV_BARCODE_QR) {
- LOGW("QR code generation with visible text is not supported");
+ LOGE("QR code generation with visible text is not supported");
return MEDIA_VISION_ERROR_INVALID_OPERATION;
}
/* set color value */
error = mv_engine_config_get_string_attribute(engine_cfg, "MV_BARCODE_GENERATE_ATTR_COLOR_FRONT", &fgcolour);
if (error != MEDIA_VISION_ERROR_NONE) {
- if (fgcolour) {
- free(fgcolour);
- fgcolour = NULL;
- }
-
- LOGW("mv_engine_config_get_string_attribute failed");
+ LOGE("mv_engine_config_get_string_attribute failed");
return error;
}
error = mv_engine_config_get_string_attribute(engine_cfg, "MV_BARCODE_GENERATE_ATTR_COLOR_BACK", &bgcolour);
if (error != MEDIA_VISION_ERROR_NONE) {
- if (bgcolour) {
- free(bgcolour);
- bgcolour = NULL;
- }
-
- if (fgcolour) {
- free(fgcolour);
- fgcolour = NULL;
- }
-
- LOGW("mv_engine_config_get_string_attribute failed");
+ free(fgcolour);
+ LOGE("mv_engine_config_get_string_attribute failed");
return error;
}
convertEncodingMode(qr_enc_mode), convertECC(qr_ecc), qr_version,
showText, fgcolour, bgcolour);
- if (fgcolour != NULL) {
- free(fgcolour);
- fgcolour = NULL;
- }
-
- if (bgcolour != NULL) {
- free(bgcolour);
- bgcolour = NULL;
- }
+ free(fgcolour);
+ free(bgcolour);
if (error != BARCODE_ERROR_NONE) {
LOGE("Barcode generation to the buffer failed");
- if (NULL != imageBuffer) {
- LOGI("Delete temporal buffer");
- delete[] imageBuffer;
- }
return convertBarcodeError(error);
}
error = mv_source_fill_by_buffer_c(image, imageBuffer, imageBufferSize, imageWidth, imageHeight,
MEDIA_VISION_COLORSPACE_RGB888);
- if (error != MEDIA_VISION_ERROR_NONE) {
+ if (error != MEDIA_VISION_ERROR_NONE)
LOGE("Meidiavision source fill by generated buffer failed");
- }
- if (NULL != imageBuffer) {
- LOGI("Delete temporal buffer");
- delete[] imageBuffer;
- }
+ // Delete temporal buffer.
+ delete[] imageBuffer;
return error;
}
/* set visible text attribute */
error = mv_engine_config_get_int_attribute(engine_cfg, "MV_BARCODE_GENERATE_ATTR_TEXT", &showText);
if (error != MEDIA_VISION_ERROR_NONE) {
- LOGW("mv_engine_config_get_int_attribute failed");
+ LOGE("mv_engine_config_get_int_attribute failed");
return error;
}
if (showText == BARCODE_GEN_TEXT_VISIBLE && type == MV_BARCODE_QR) {
- LOGW("QR code generation with visible text is not supported");
+ LOGE("QR code generation with visible text is not supported");
return MEDIA_VISION_ERROR_INVALID_OPERATION;
}
/* set color value */
error = mv_engine_config_get_string_attribute(engine_cfg, "MV_BARCODE_GENERATE_ATTR_COLOR_FRONT", &fgcolour);
if (error != MEDIA_VISION_ERROR_NONE) {
- if (fgcolour) {
- free(fgcolour);
- fgcolour = NULL;
- }
-
- LOGW("mv_engine_config_get_string_attribute failed");
+ LOGE("mv_engine_config_get_string_attribute failed");
return error;
}
error = mv_engine_config_get_string_attribute(engine_cfg, "MV_BARCODE_GENERATE_ATTR_COLOR_BACK", &bgcolour);
if (error != MEDIA_VISION_ERROR_NONE) {
- if (bgcolour) {
- free(bgcolour);
- bgcolour = NULL;
- }
-
- if (fgcolour) {
- free(fgcolour);
- fgcolour = NULL;
- }
-
- LOGW("mv_engine_config_get_string_attribute failed");
+ free(fgcolour);
+ LOGE("mv_engine_config_get_string_attribute failed");
return error;
}
convertEncodingMode(qr_enc_mode), convertECC(qr_ecc), qr_version,
showText, fgcolour, bgcolour);
- if (fgcolour != NULL) {
- free(fgcolour);
- fgcolour = NULL;
- }
-
- if (bgcolour != NULL) {
- free(bgcolour);
- bgcolour = NULL;
- }
+ free(fgcolour);
+ free(bgcolour);
if (error != BARCODE_ERROR_NONE) {
LOGE("Barcode generation to the image file failed");