Mercurial > pidgin.yaz
view pidgin/pixmaps/art-tools/render-pidgin-emotes.rb @ 30555:d60313011111
Fix a read-after-free from valgrind:
Invalid read of size 8
at 0x9BD2816: purple_upnp_cancel_port_mapping (upnp.c:931)
by 0x9BAEF41: purple_network_listen_cancel (network.c:585)
by 0x1A49D7FD: msn_dc_destroy (directconn.c:204)
Address 0x19c3c748 is 8 bytes inside a block of size 16 free'd
at 0x4C239BF: free (vg_replace_malloc.c:325)
by 0xBC1EB97: g_slist_delete_link (gslist.c:446)
by 0x9BD2815: purple_upnp_cancel_port_mapping (upnp.c:928)
by 0x9BAEF41: purple_network_listen_cancel (network.c:585)
by 0x1A49D7FD: msn_dc_destroy (directconn.c:204)
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Sat, 29 May 2010 22:52:14 +0000 |
parents | 209da0d52824 |
children |
line wrap: on
line source
#!/usr/bin/env ruby require "rexml/document" require "ftools" include REXML INKSCAPE = '/usr/bin/inkscape' SRC = "./svg" def renderit(file) svg = Document.new(File.new("#{SRC}/#{file}", 'r')) svg.root.each_element("//g[contains(@inkscape:label,'plate')]") do |icon| filename = icon.attributes["label"] filename = `echo -n #{filename} | sed -e 's/plate\-//g'` puts "#{file} #{filename}.png" icon.each_element("rect") do |box| if box.attributes['inkscape:label'] == '22x22' dir = "#{box.attributes['width']}x#{box.attributes['height']}/" cmd = "#{INKSCAPE} -i #{box.attributes['id']} -e #{dir}/#{filename}.png #{SRC}/#{file} > /dev/null 2>&1" File.makedirs(dir) unless File.exists?(dir) system(cmd) print "." elsif box.attributes['inkscape:label'] == '24x24' dir = "#{box.attributes['width']}x#{box.attributes['height']}/" cmd = "#{INKSCAPE} -i #{box.attributes['id']} -e #{dir}/#{filename}.png #{SRC}/#{file} > /dev/null 2>&1" File.makedirs(dir) unless File.exists?(dir) system(cmd) print "." end end puts '' end end if (ARGV[0].nil?) #render all SVGs puts "Rendering from SVGs in #{SRC}" Dir.foreach(SRC) do |file| renderit(file) if file.match(/svg$/) end puts "\nrendered all SVGs" else #only render the SVG passed file = "#{ARGV[0]}.svg" if (File.exists?("#{SRC}/#{file}")) renderit(file) puts "\nrendered #{file}" else puts "[E] No such file (#{file})" end end