summaryrefslogtreecommitdiff
path: root/src/administration_writer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/administration_writer.cpp')
-rw-r--r--src/administration_writer.cpp26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/administration_writer.cpp b/src/administration_writer.cpp
index f3f090f..b6428f4 100644
--- a/src/administration_writer.cpp
+++ b/src/administration_writer.cpp
@@ -90,7 +90,7 @@ void administration_writer::destroy()
static char* copy_template(const char* template_str, int* buf_size)
{
- size_t template_size = strlen(template_str);
+ size_t template_size = strops::length(template_str);
size_t buf_length = template_size*5; // Ballpark file content size.
char* file_content = (char*)memops::alloc(buf_length);
memops::zero(file_content, buf_length);
@@ -294,7 +294,7 @@ static void _add_document_to_zip(invoice* inv)
{
document* doc = &inv->document;
- if (strlen(doc->copy_path) == 0 && strlen(doc->original_path) != 0)
+ if (strops::empty(doc->copy_path) && !strops::empty(doc->original_path))
{
char copy_path[MAX_LEN_PATH];
strops::format(copy_path, MAX_LEN_PATH, "documents/%s%s", inv->sequential_number, _get_file_extension(doc->original_path));
@@ -335,7 +335,7 @@ bool administration_writer::save_invoice_blocking(invoice inv)
int buf_length = 150000; // Ballpark file content size.
char* file_content = (char*)memops::alloc(buf_length);
memops::zero(file_content, buf_length);
- memops::copy(file_content, file_template::peppol_invoice_template, strlen(file_template::peppol_invoice_template));
+ memops::copy(file_content, file_template::peppol_invoice_template, strops::length(file_template::peppol_invoice_template));
struct tm *tm_info = 0;
char date_buffer[11]; // "YYYY-MM-DD" + null terminator
@@ -410,7 +410,7 @@ bool administration_writer::save_invoice_blocking(invoice inv)
tax_rate* tax_rate_buffer = (tax_rate*)memops::alloc(sizeof(tax_rate)*administration::billing_item_count(&inv));
u32 tax_rate_count = administration::invoice_get_tax_rates(&inv, tax_rate_buffer);
- u32 tax_subtotal_list_buffer_size = (u32)strlen(file_template::peppol_invoice_tax_subtotal_template) * 2 * tax_rate_count; // Ballpark list size.
+ u32 tax_subtotal_list_buffer_size = (u32)strops::length(file_template::peppol_invoice_tax_subtotal_template) * 2 * tax_rate_count; // Ballpark list size.
char* tax_subtotal_list_buffer = (char*)memops::alloc(tax_subtotal_list_buffer_size);
memops::zero(tax_subtotal_list_buffer, tax_subtotal_list_buffer_size);
u32 tax_subtotal_list_buffer_cursor = 0;
@@ -430,7 +430,7 @@ bool administration_writer::save_invoice_blocking(invoice inv)
strops::replace(tax_entry_file_content, tax_entry_buf_length, "{{TAX_CATEGORY}}", tax_rate_buffer[i].category_code);
strops::replace_float(tax_entry_file_content, tax_entry_buf_length, "{{TAX_PERCENT}}", tax_rate_buffer[i].rate, 2);
- u32 content_len = (u32)strlen(tax_entry_file_content);
+ u32 content_len = (u32)strops::length(tax_entry_file_content);
memops::copy(tax_subtotal_list_buffer+tax_subtotal_list_buffer_cursor, tax_entry_file_content, content_len);
tax_subtotal_list_buffer_cursor += content_len;
@@ -454,7 +454,7 @@ bool administration_writer::save_invoice_blocking(invoice inv)
billing_item* billing_item_buffer = (billing_item*)memops::alloc(sizeof(billing_item) * administration::billing_item_count(&inv));
u32 billing_item_count = administration::billing_item_get_all_for_invoice(&inv, billing_item_buffer);
- u32 billing_item_list_buffer_size = (u32)strlen(file_template::peppol_invoice_line_template) * 2 * billing_item_count; // Ballpark list size.
+ u32 billing_item_list_buffer_size = (u32)strops::length(file_template::peppol_invoice_line_template) * 2 * billing_item_count; // Ballpark list size.
char* billing_item_list_buffer = (char*)memops::alloc(billing_item_list_buffer_size);
memops::zero(billing_item_list_buffer, billing_item_list_buffer_size);
u32 billing_item_list_buffer_cursor = 0;
@@ -490,7 +490,7 @@ bool administration_writer::save_invoice_blocking(invoice inv)
strops::replace_float(billing_item_file_content, billing_item_buf_length, "{{DISCOUNT_TOTAL}}", bi.allowance, 2);
- u32 content_len = (u32)strlen(billing_item_file_content);
+ u32 content_len = (u32)strops::length(billing_item_file_content);
memops::copy(billing_item_list_buffer+billing_item_list_buffer_cursor, billing_item_file_content, content_len);
billing_item_list_buffer_cursor += content_len;
@@ -518,7 +518,7 @@ bool administration_writer::save_invoice_blocking(invoice inv)
char final_path[50];
strops::format(final_path, 50, "%s.xml", inv.id);
- int final_length = (int)strlen(file_content);
+ int final_length = (int)strops::length(file_content);
if (!xml_parse_document((uint8_t*)file_content, final_length)) result = 0;
else if (!write_to_zip(final_path, file_content, final_length)) result = 0;
@@ -577,7 +577,7 @@ bool administration_writer::save_project_blocking(project project)
char final_path[50];
strops::format(final_path, 50, "%s.xml", project.id);
- int final_length = (int)strlen(file_content);
+ int final_length = (int)strops::length(file_content);
if (!xml_parse_document((uint8_t*)file_content, final_length)) result = 0;
else if (!write_to_zip(final_path, file_content, final_length)) result = 0;
@@ -625,7 +625,7 @@ bool administration_writer::save_cost_center_blocking(cost_center cost)
char final_path[50];
strops::format(final_path, 50, "%s.xml", cost.id);
- int final_length = (int)strlen(file_content);
+ int final_length = (int)strops::length(file_content);
if (!xml_parse_document((uint8_t*)file_content, final_length)) result = 0;
else if (!write_to_zip(final_path, file_content, final_length)) result = 0;
@@ -682,7 +682,7 @@ bool administration_writer::save_tax_rate_blocking(tax_rate rate)
char final_path[50];
strops::format(final_path, 50, "T/%s.xml", rate.internal_code);
- int final_length = (int)strlen(file_content);
+ int final_length = (int)strops::length(file_content);
if (!xml_parse_document((uint8_t*)file_content, final_length)) result = 0;
else if (!write_to_zip(final_path, file_content, final_length)) result = 0;
@@ -745,7 +745,7 @@ bool administration_writer::save_contact_blocking(contact c)
char final_path[50];
strops::format(final_path, 50, "%s.xml", c.id);
- int final_length = (int)strlen(file_content);
+ int final_length = (int)strops::length(file_content);
if (!xml_parse_document((uint8_t*)file_content, final_length)) result = 0;
else if (!write_to_zip(final_path, file_content, final_length)) result = 0;
@@ -801,7 +801,7 @@ bool administration_writer::save_all_administration_info_blocking()
strops::replace(file_content, buf_length, "{{AI_SERVICE_MODEL}}", ai_service.model_name);
//// Write to Disk.
- int final_length = (int)strlen(file_content);
+ int final_length = (int)strops::length(file_content);
if (!xml_parse_document((uint8_t*)file_content, final_length)) result = 0;
else if (!write_to_zip(ADMIN_FILE_INFO, file_content, final_length)) result = 0;