fix [#25778] Memoryblock Data from SCR: end corrupt

+ other minor changes.
This commit is contained in:
Campbell Barton 2011-01-25 01:51:28 +00:00
parent 8e83dd0933
commit 27cb6218a3
4 changed files with 10 additions and 4 deletions

View File

@ -5279,7 +5279,11 @@ static void direct_link_screen(FileData *fd, bScreen *sc)
for(cl= sconsole->history.first; cl; cl= cl_next) {
cl_next= cl->next;
cl->line= newdataadr(fd, cl->line);
if (cl->line == NULL) {
if (cl->line) {
/* the allocted length is not written, so reset here */
cl->len_alloc= cl->len + 1;
}
else {
BLI_remlink(&sconsole->history, cl);
MEM_freeN(cl);
}

View File

@ -2139,6 +2139,7 @@ static void write_screens(WriteData *wd, ListBase *scrbase)
ConsoleLine *cl;
for (cl=con->history.first; cl; cl=cl->next) {
/* 'len_alloc' is invalid on write, set from 'len' on read */
writestruct(wd, DATA, "ConsoleLine", 1, cl);
writedata(wd, DATA, cl->len+1, cl->line);
}

View File

@ -1071,7 +1071,6 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb
case PROP_STRING:
{
const char *param;
Py_ssize_t param_size= 0;
#ifdef USE_STRING_COERCE
PyObject *value_coerce= NULL;
int subtype= RNA_property_subtype(prop);
@ -1080,10 +1079,10 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb
param= PyC_UnicodeAsByte(value, &value_coerce);
}
else {
param= _PyUnicode_AsStringAndSize(value, &param_size);
param= _PyUnicode_AsString(value);
}
#else // USE_STRING_COERCE
param= _PyUnicode_AsStringAndSize(value, &param_size);
param= _PyUnicode_AsStringSize(value);
#endif // USE_STRING_COERCE
if (param==NULL) {

View File

@ -48,6 +48,8 @@ def file_list_py(path):
def is_pep8(path):
print(path)
if open(path, 'rb').read(3) == b'\xef\xbb\xbf':
print("\nfile contains BOM, remove first 3 bytes: %r\n" % path)
f = open(path, 'r', encoding="utf8")
for i in range(PEP8_SEEK_COMMENT):
line = f.readline()