Commit 1da8a19a authored by MYLS's avatar MYLS

fixed two bugs that I caused.

parent 86238d27
...@@ -1176,13 +1176,13 @@ static void check_if_write_struct_is_delayed( CvFileStorage* fs, bool change_typ ...@@ -1176,13 +1176,13 @@ static void check_if_write_struct_is_delayed( CvFileStorage* fs, bool change_typ
std::string type_name; std::string type_name;
int struct_flags = fs->delayed_struct_flags; int struct_flags = fs->delayed_struct_flags;
if ( fs->delayed_struct_key != 0 && *fs->delayed_type_name != '\0' ) if ( fs->delayed_struct_key != 0 && *fs->delayed_struct_key != '\0' )
{ {
struct_key.assign(fs->delayed_struct_key); struct_key.assign(fs->delayed_struct_key);
} }
if ( fs->delayed_type_name != 0 && *fs->delayed_type_name != '\0' ) if ( fs->delayed_type_name != 0 && *fs->delayed_type_name != '\0' )
{ {
struct_key.assign(fs->delayed_type_name); type_name.assign(fs->delayed_type_name);
} }
/* reset */ /* reset */
...@@ -1949,6 +1949,9 @@ icvYMLStartWriteStruct( CvFileStorage* fs, const char* key, int struct_flags, ...@@ -1949,6 +1949,9 @@ icvYMLStartWriteStruct( CvFileStorage* fs, const char* key, int struct_flags,
char buf[CV_FS_MAX_LEN + 1024]; char buf[CV_FS_MAX_LEN + 1024];
const char* data = 0; const char* data = 0;
if ( type_name && *type_name == '\0' )
type_name = 0;
struct_flags = (struct_flags & (CV_NODE_TYPE_MASK|CV_NODE_FLOW)) | CV_NODE_EMPTY; struct_flags = (struct_flags & (CV_NODE_TYPE_MASK|CV_NODE_FLOW)) | CV_NODE_EMPTY;
if( !CV_NODE_IS_COLLECTION(struct_flags)) if( !CV_NODE_IS_COLLECTION(struct_flags))
CV_Error( CV_StsBadArg, CV_Error( CV_StsBadArg,
...@@ -2914,6 +2917,9 @@ icvXMLStartWriteStruct( CvFileStorage* fs, const char* key, int struct_flags, ...@@ -2914,6 +2917,9 @@ icvXMLStartWriteStruct( CvFileStorage* fs, const char* key, int struct_flags,
CV_Error( CV_StsBadArg, CV_Error( CV_StsBadArg,
"Some collection type: CV_NODE_SEQ or CV_NODE_MAP must be specified" ); "Some collection type: CV_NODE_SEQ or CV_NODE_MAP must be specified" );
if ( type_name && *type_name == '\0' )
type_name = 0;
if( type_name ) if( type_name )
{ {
attr[idx++] = "type_id"; attr[idx++] = "type_id";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment