author | Chunyu Song <chunyu.song@amlogic.com> | 2014-12-01 11:08:49 (GMT) |
---|---|---|
committer | Chunyu Song <chunyu.song@amlogic.com> | 2014-12-04 12:32:40 (GMT) |
commit | 07906d83d278e7464b1d6f4aadd3bf39b533df04 (patch) | |
tree | 53d1c932de8169a8e6dd7e406a0c40147ab31923 | |
parent | e94b7ad695cde004329a257af2b3f39bf0e2a22d (diff) | |
download | tools-07906d83d278e7464b1d6f4aadd3bf39b533df04.zip tools-07906d83d278e7464b1d6f4aadd3bf39b533df04.tar.gz tools-07906d83d278e7464b1d6f4aadd3bf39b533df04.tar.bz2 |
filter out .bmp file
Change-Id: I42200e1b56c3328c93d21d341880fda652e7405c
-rwxr-xr-x | logo_img_packer/res_pack.cpp | 33 |
1 files changed, 30 insertions, 3 deletions
diff --git a/logo_img_packer/res_pack.cpp b/logo_img_packer/res_pack.cpp index 953e3ff..282bc4b 100755 --- a/logo_img_packer/res_pack.cpp +++ b/logo_img_packer/res_pack.cpp @@ -52,6 +52,27 @@ static const char* get_filename(const char *fpath) #endif
}
+// added to filter out .bmp files
+static char* get_last_itemname(const char* itemName)
+{
+ char buf[256]={0};
+ char* last_itemname = (char*)malloc(256);
+
+ strcpy(last_itemname, itemName);
+ const char* bmp_tag = ".bmp";
+ const char* suffix_of_file;
+ suffix_of_file = strstr(itemName, bmp_tag);
+ int len = 0;
+
+ if (suffix_of_file && strcmp(suffix_of_file, bmp_tag) == 0)
+ {
+ len = suffix_of_file-itemName;
+ strncpy(buf, itemName, len);
+ buf[len] = '\0';
+ strcpy(last_itemname, buf);
+ }
+ return last_itemname;
+}
int get_file_path_from_argv(const char** const argv, __hdle *hDir, char* fileName)
{
@@ -494,9 +515,15 @@ static int _img_pack(const char** const path_src, const char* const packedImg, pItemHeadInfo->index = itemIndex;
imageSz += itemBodyOccupySz;
pItemHeadInfo->nums = totalItemNum;
- memcpy(pItemHeadInfo->name, itemName, strlen(itemName));
- debugP("pack item [%s]\n", itemName);
- ++pItemHeadInfo;//prepare for next item
+
+ char* last_itemname = get_last_itemname(itemName);
+
+ memcpy(pItemHeadInfo->name, last_itemname, strlen(last_itemname));
+ debugP("pack item [%s]\n", last_itemname);
+ ++pItemHeadInfo;//prepare for next item
+ if (last_itemname != itemName) {
+ free(last_itemname);
+ }
fd_src = fopen(filePath, "rb");
if(!fd_src){
|