ext/xlsxwriter/libxlsxwriter/src/utility.c in xlsxwriter-0.0.3 vs ext/xlsxwriter/libxlsxwriter/src/utility.c in xlsxwriter-0.0.4.pre.2
- old
+ new
@@ -26,10 +26,11 @@
"NULL function parameter ignored.",
"Function parameter validation error.",
"Worksheet name exceeds Excel's limit of 31 characters.",
"Worksheet name contains invalid Excel character: '[]:*?/\\'",
"Worksheet name is already in use.",
+ "Parameter exceeds Excel's limit of 32 characters.",
"Parameter exceeds Excel's limit of 128 characters.",
"Parameter exceeds Excel's limit of 255 characters.",
"String exceeds Excel's limit of 32,767 characters.",
"Error finding internal string index.",
"Worksheet row or column index out of range.",
@@ -241,11 +242,14 @@
/* Convert the row part of the A1 cell to a number. */
if (p)
row_num = atoi(p);
- return row_num - 1;
+ if (row_num)
+ return row_num - 1;
+ else
+ return 0;
}
/*
* Convert an Excel style A1 cell reference to a zero indexed column number.
*/
@@ -412,9 +416,22 @@
if (copy)
memcpy(copy, str, len);
return copy;
+}
+
+/* Simple function to strdup() a formula string without the leading "=". */
+char *
+lxw_strdup_formula(const char *formula)
+{
+ if (!formula)
+ return NULL;
+
+ if (formula[0] == '=')
+ return lxw_strdup(formula + 1);
+ else
+ return lxw_strdup(formula);
}
/* Simple strlen that counts UTF-8 characters. Assumes well formed UTF-8. */
size_t
lxw_utf8_strlen(const char *str)