int ScanImageFileA( char *dirpath, char ***filelist ) { int total_file, len; LCUI_Dir dir; LCUI_DirEntry *entry; char **bak_filelist = NULL, **tmp_ptr = NULL; char *format_ptr, *filename; if( LCUI_OpenDirA( dirpath, &dir ) != 0 ) { return -1; } for( total_file=0; ; ) { entry = LCUI_ReadDirA( &dir ); if( entry == NULL ) { break; } if( !LCUI_FileIsArchive(entry) ) { filename = LCUI_GetFileNameA( entry ); continue; } filename = LCUI_GetFileNameA( entry ); format_ptr = GetFileFormatA( filename ); if( format_ptr == NULL ) { continue; } if( LCUI_strcasecmpA(format_ptr, "png") != 0 && LCUI_strcasecmpA(format_ptr, "bmp") != 0 && LCUI_strcasecmpA(format_ptr, "jpg") != 0 && LCUI_strcasecmpA(format_ptr, "jpeg") != 0 ) { continue; } bak_filelist = (char**)realloc( tmp_ptr, sizeof(char*)*(total_file+1) ); if( bak_filelist == NULL ) { goto error_processing; } tmp_ptr = bak_filelist; len = strlen( filename ); bak_filelist[total_file] = (char*)malloc( (len+1)*sizeof(char) ); if( bak_filelist[total_file] == NULL ) { goto error_processing; } strncpy( bak_filelist[total_file], filename, len ); bak_filelist[total_file][len] = 0; ++total_file; } *filelist = bak_filelist; LCUI_CloseDir( &dir ); return total_file; error_processing: while(total_file--) { free( tmp_ptr[total_file] ); } free( tmp_ptr ); *filelist = NULL; LCUI_CloseDir( &dir ); return -1; }
/** 处理样式结束标签 */ LCUI_API const wchar_t* StyleTag_ProcessEndingTag( LCUI_Queue *tags, const wchar_t *str ) { const wchar_t *p; char tag_name[256]; /* 获取标签名 */ p = StyleTag_GetEndingTag( str, tag_name ); if( !p ) { return NULL; } if( LCUI_strcasecmpA(tag_name, "color") == 0 ) { /* 消除该标签添加的字体样式 */ StyleTag_Delete ( tags, TAG_ID_COLOR ); } else if( LCUI_strcasecmpA(tag_name, "size") == 0 ) { /* 消除该标签添加的字体样式 */ StyleTag_Delete ( tags, TAG_ID_SIZE ); } else { return NULL; } return p; }