summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-01-02 03:51:24 -0600
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-01-02 03:51:24 -0600
commit6ddacfff536fc6fcedff929b315fd43c494bb02c (patch)
tree0712be5e179ecebd789a7d7cc1c4aff5c40796f2
parent84aea07a73ee724007513c157912385518f3dd7a (diff)
downloadtdelibs-6ddacfff536fc6fcedff929b315fd43c494bb02c.tar.gz
tdelibs-6ddacfff536fc6fcedff929b315fd43c494bb02c.zip
Fix remaining elficon problems
-rw-r--r--kfile-plugins/elf/kfile_elf.cpp12
-rw-r--r--tdelfeditor/tdelfeditor.cpp8
2 files changed, 11 insertions, 9 deletions
diff --git a/kfile-plugins/elf/kfile_elf.cpp b/kfile-plugins/elf/kfile_elf.cpp
index dcc75081e..c657d245b 100644
--- a/kfile-plugins/elf/kfile_elf.cpp
+++ b/kfile-plugins/elf/kfile_elf.cpp
@@ -45,8 +45,8 @@ TQString elf_get_resource(libr_file *handle, char *section_name)
{
size_t buffer_size = 0;
char *buffer = NULL;
- TQString result = i18n("not set");
-
+ TQString result;
+
/* Get the resource from the ELF binary */
if(!libr_size(handle, section_name, &buffer_size))
{
@@ -54,14 +54,15 @@ TQString elf_get_resource(libr_file *handle, char *section_name)
return result;
}
/* Get the resource from the ELF file */
- buffer = (char *) malloc(buffer_size);
+ buffer = (char *) malloc(buffer_size+1);
+ buffer[buffer_size] = 0;
if(!libr_read(handle, section_name, buffer))
{
kdWarning() << "failed to obtain ELF resource: " << libr_errmsg() << endl;
goto fail;
}
result = buffer;
-
+
fail:
free(buffer);
@@ -147,9 +148,6 @@ bool KElfPlugin::readInfo( KFileMetaInfo& info, uint what)
break;
}
}
- if (iconListing.isEmpty()) {
- iconListing = i18n("not set");
- }
appendItem(group2, "EmbeddedIcon", iconListing);
diff --git a/tdelfeditor/tdelfeditor.cpp b/tdelfeditor/tdelfeditor.cpp
index 93b8cca4f..b6f52c199 100644
--- a/tdelfeditor/tdelfeditor.cpp
+++ b/tdelfeditor/tdelfeditor.cpp
@@ -493,6 +493,9 @@ int main_console(int argc, char **argv)
if (strlen(argv[PARAM_NOTES]) > 0) add_resource_string(handle, ".metadata_notes", argv[PARAM_NOTES]);
} break;
case MODE_SET_EMPTY_UUID:
+ section = ICON_SECTION;
+ clear_resource(handle, section);
+
if(!libr_icon_setuuid(handle, "00000000-0000-0000-0000-000000000000"))
{
errorf(_("Failed to set UUID: %s\n"), libr_errmsg());
@@ -514,7 +517,7 @@ int main_console(int argc, char **argv)
{
libr_icon *icon = NULL;
- icon = libr_icon_newicon_byfile(LIBR_SVG, 0, argv[PARAM_ICON_FILE]);
+ icon = libr_icon_newicon_byfile(LIBR_PNG, 0, argv[PARAM_ICON_FILE]);
if(icon == NULL)
{
errorf(_("failed to open icon file \"%s\": %s"), argv[PARAM_ICON_FILE], libr_errmsg());
@@ -551,7 +554,7 @@ int main_console(int argc, char **argv)
libr_icon *icon = NULL;
- icon = libr_icon_newicon_byfile(LIBR_PNG, 32, const_cast<char*>(systemIcon.ascii()));
+ icon = libr_icon_newicon_byfile(LIBR_PNG, 0, const_cast<char*>(systemIcon.ascii()));
if(icon == NULL)
{
errorf(_("failed to open icon file \"%s\": %s"), systemIcon.ascii(), libr_errmsg());
@@ -559,6 +562,7 @@ int main_console(int argc, char **argv)
}
TQFileInfo ifi(systemIcon);
TQString iconBaseName = ifi.baseName();
+ printf("using %s as icon name\n\r", iconBaseName.ascii());
if(!libr_icon_write(handle, icon, const_cast<char*>(iconBaseName.ascii()), LIBR_OVERWRITE))
{
libr_icon_close(icon);