• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdeio/tdeio
 

tdeio/tdeio

  • tdeio
  • tdeio
tdelficon.cpp
1#include "config.h"
2#include "tdelficon.h"
3
4#ifdef HAVE_ALLOCA_H
5#include <alloca.h>
6#endif
7#include <cstring>
8
9/*
10 * Obtain an existing icon resource list
11 */
12int get_iconlist(libr_file *file_handle, iconlist *icons)
13{
14 if(icons == NULL)
15 {
16 /* Need to be able to return SOMETHING */
17 return false;
18 }
19 /* Obtain the icon resource list */
20 icons->buffer = libr_malloc(file_handle, ICON_SECTION, &(icons->size));
21 if(icons->buffer == NULL)
22 return false;
23 return true;
24}
25
26/*
27 * Get the next entry in an icon resource list
28 */
29iconentry *get_nexticon(iconlist *icons, iconentry *last_entry)
30{
31 size_t i;
32
33 /* The icon list is needed both for the data buffer and for a call-specific iconentry instance */
34 if(icons == NULL)
35 return NULL;
36 /* If this is the first call (last_entry == NULL) then return the first entry */
37 if(last_entry == NULL)
38 icons->entry.offset = sizeof(uint32_t)+sizeof(UUID);
39 else
40 icons->entry.offset += icons->entry.entry_size;
41 /* Check to see if we've run out of entries */
42 if(icons->entry.offset >= icons->size)
43 return NULL;
44 i = icons->entry.offset;
45 memcpy(&(icons->entry.entry_size), &(icons->buffer[i]), sizeof(uint32_t));
46 i += sizeof(uint32_t);
47 icons->entry.type = (libr_icontype_t)icons->buffer[i];
48 i += sizeof(unsigned char);
49 switch(icons->entry.type)
50 {
51 case LIBR_SVG:
52 icons->entry.icon_size = 0;
53 icons->entry.name = &(icons->buffer[i]);
54 break;
55 case LIBR_PNG:
56 memcpy(&(icons->entry.icon_size), &(icons->buffer[i]), sizeof(uint32_t));
57 i += sizeof(uint32_t);
58 icons->entry.name = &(icons->buffer[i]);
59 break;
60 default:
61 /* Invalid entry type */
62 return NULL;
63 }
64 return &(icons->entry);
65}
66
67TQString elf_get_resource(libr_file *handle, char *section_name)
68{
69 size_t buffer_size = 0;
70 char *buffer = NULL;
71 TQString result;
72
73 /* Get the resource from the ELF binary */
74 if(!libr_size(handle, section_name, &buffer_size))
75 {
76// kdWarning() << "failed to obtain ELF resource size: " << libr_errmsg() << endl;
77 return result;
78 }
79 /* Get the resource from the ELF file */
80 buffer = (char *) malloc(buffer_size+1);
81 buffer[buffer_size] = 0;
82 if(!libr_read(handle, section_name, buffer))
83 {
84// kdWarning() << "failed to obtain ELF resource: " << libr_errmsg() << endl;
85 goto fail;
86 }
87 result = buffer;
88
89fail:
90 free(buffer);
91
92 return result;
93}

tdeio/tdeio

Skip menu "tdeio/tdeio"
  • Main Page
  • Modules
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

tdeio/tdeio

Skip menu "tdeio/tdeio"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdeio/tdeio by doxygen 1.9.4
This website is maintained by Timothy Pearson.