Skip to content

Commit c10cdc6

Browse files
committed
Fix: IBM s390x
1 parent 3093521 commit c10cdc6

File tree

4 files changed

+22
-11
lines changed

4 files changed

+22
-11
lines changed

include/xlswriter.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,6 @@ void datetime_writer(lxw_datetime *datetime, zend_long row, zend_long columns, z
220220

221221
lxw_error workbook_file(xls_resource_write_t *self);
222222

223-
zend_string* str_pick_up(zend_string *left, char *right);
223+
zend_string* str_pick_up(zend_string *left, const char *right, size_t len);
224224

225225
#endif

kernel/common.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,16 @@ void xls_file_path(zend_string *file_name, zval *dir_path, zval *file_path)
3333
/* }}} */
3434

3535
/* {{{ */
36-
zend_string* str_pick_up(zend_string *left, char *right)
36+
zend_string* str_pick_up(zend_string *left, const char *right, size_t len)
3737
{
3838
zend_string *full = NULL;
3939

4040
size_t _left_length = ZSTR_LEN(left);
41-
size_t _extend_length = _left_length + strlen(right);
41+
size_t _extend_length = _left_length + len;
4242

4343
full = zend_string_extend(left, _extend_length, 0);
4444

45-
memcpy(ZSTR_VAL(full) + _left_length, right, strlen(right));
45+
memcpy(ZSTR_VAL(full) + _left_length, right, len);
4646

4747
ZSTR_VAL(full)[_extend_length] = '\0';
4848

kernel/excel.c

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -964,28 +964,38 @@ PHP_METHOD(vtiful_xls, stringFromColumnIndex)
964964
Z_PARAM_LONG(index)
965965
ZEND_PARSE_PARAMETERS_END();
966966

967+
char one[1];
968+
967969
if (index < 26) {
968970
current = index + 65;
969-
result = zend_string_init((char *)(&current), 1, 0);
970-
RETURN_STR(result);
971+
one[0] = current;
972+
973+
ZVAL_STRINGL(return_value, one, 1);
974+
return;
971975
}
972976

973977
if (index < 702) {
974978
current = index / 26 + 64;
975-
result = zend_string_init((char *)(&current), 1, 0);
979+
one[0] = current;
980+
result = zend_string_init(one, 1, 0);
976981

977982
current = index % 26 + 65;
978-
RETURN_STR(str_pick_up(result, (char *)(&current)));
983+
one[0] = current;
984+
ZVAL_STR(return_value, str_pick_up(result, one, 1));
985+
return;
979986
}
980987

981988
current = (index - 26) / 676 + 64;
982-
result = zend_string_init((char *)(&current), 1, 0);
989+
one[0] = current;
990+
result = zend_string_init(one, 1, 0);
983991

984992
current = ((index - 26) % 676) / 26 + 65;
985-
result = str_pick_up(result, (char *)(&current));
993+
one[0] = current;
994+
result = str_pick_up(result, one, 1);
986995

987996
current = index % 26 + 65;
988-
RETURN_STR(str_pick_up(result, (char *)(&current)));
997+
one[0] = current;
998+
ZVAL_STR(return_value, str_pick_up(result, one, 1));
989999
}
9901000
/* }}} */
9911001

kernel/format.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -459,6 +459,7 @@ VTIFUL_STARTUP_FUNCTION(format) {
459459
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "PATTERN_GRAY_125", LXW_PATTERN_GRAY_125)
460460
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "PATTERN_GRAY_0625", LXW_PATTERN_GRAY_0625)
461461

462+
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "BORDER_NONE", LXW_BORDER_NONE)
462463
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "BORDER_THIN", LXW_BORDER_THIN)
463464
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "BORDER_MEDIUM", LXW_BORDER_MEDIUM)
464465
REGISTER_CLASS_CONST_LONG(vtiful_format_ce, "BORDER_DASHED", LXW_BORDER_DASHED)

0 commit comments

Comments
 (0)