*fixed a string manipulation bug
This commit is contained in:
parent
b531e9b8f4
commit
013dbdb172
3
HISTORY
3
HISTORY
@ -1,3 +1,6 @@
|
||||
Jul. 20 2015
|
||||
Fixed a string manipulation bug
|
||||
|
||||
Jul. 12 2015
|
||||
Added array manipulation functions
|
||||
|
||||
|
Binary file not shown.
@ -78,7 +78,7 @@ extern "C" {
|
||||
/** Macros */
|
||||
#define _VER_MAJOR 1
|
||||
#define _VER_MINOR 1
|
||||
#define _VER_REVISION 57
|
||||
#define _VER_REVISION 58
|
||||
#define _MB_VERSION ((_VER_MAJOR * 0x01000000) + (_VER_MINOR * 0x00010000) + (_VER_REVISION))
|
||||
|
||||
/* Uncomment this line to treat warnings as error */
|
||||
@ -1747,10 +1747,11 @@ int _calc_expression(mb_interpreter_t* s, _ls_node_t** l, _object_t** val) {
|
||||
} else {
|
||||
(*val)->type = c->type;
|
||||
if(_is_string(c)) {
|
||||
size_t _sl = strlen(_extract_string(c));
|
||||
char* _str = _extract_string(c);
|
||||
size_t _sl = strlen(_str);
|
||||
(*val)->data.string = (char*)mb_malloc(_sl + 1);
|
||||
(*val)->data.string[_sl] = '\0';
|
||||
memcpy((*val)->data.string, c->data.string, _sl + 1);
|
||||
memcpy((*val)->data.string, _str, _sl + 1);
|
||||
} else if(c->type == _DT_ARRAY) {
|
||||
(*val)->data = c->data;
|
||||
c->type = _DT_NIL;
|
||||
@ -2722,6 +2723,9 @@ char* _extract_string(_object_t* obj) {
|
||||
else if(obj->type == _DT_VAR && obj->data.variable->data->type == _DT_STRING)
|
||||
result = obj->data.variable->data->data.string;
|
||||
|
||||
if(!result)
|
||||
result = MB_NULL_STRING;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
Binary file not shown.
Binary file not shown.
@ -36,8 +36,8 @@
|
||||
IDI_ICON_MAIN ICON "icon.ico"
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 1,1,57,0
|
||||
PRODUCTVERSION 1,1,57,0
|
||||
FILEVERSION 1,1,58,0
|
||||
PRODUCTVERSION 1,1,58,0
|
||||
FILEFLAGSMASK 0x17L
|
||||
# ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
@ -55,13 +55,13 @@
|
||||
VALUE "Comments", "MY-BASIC"
|
||||
VALUE "CompanyName", "W. Renxin"
|
||||
VALUE "FileDescription", "MY-BASIC interpreter"
|
||||
VALUE "FileVersion", "1, 1, 57, 0"
|
||||
VALUE "FileVersion", "1, 1, 58, 0"
|
||||
VALUE "InternalName", "my_basic"
|
||||
VALUE "LegalCopyright", "Copyright (C) 2011 - 2015 W. Renxin"
|
||||
VALUE "LegalTrademarks", "MY-BASIC"
|
||||
VALUE "OriginalFilename", "my_basic.exe"
|
||||
VALUE "ProductName", "MY-BASIC"
|
||||
VALUE "ProductVersion", "1, 1, 57, 0"
|
||||
VALUE "ProductVersion", "1, 1, 58, 0"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
|
Loading…
x
Reference in New Issue
Block a user