[glade--]glade compilation problem

Matthew Britton <[email protected]>
Newsgroups gmane.comp.gnome.glademm
Message-ID <Pine.GSO.4.33.0208151236590.5431-100000@iupika>
I had minor problems compiling glademm 1.1.1b under gcc 3.0.3.

In the file writers/image.cc, there was the following code:

void Gtk_Image::EmbedImage(CxxFile &f,const std::string &pixbuf) const
{  f.Declaration("static const unsigned char ");
   f << Configuration.CName(pixbuf) << "_data[]";
   f.Assignment().StartBlock().EndLine();
   {  ifstream is((Configuration.pixmap_dir+"/"+pixbuf).c_str());
      while (is.good())
      {  unsigned char buf[16];
         is.read(buf,sizeof buf);
         size_t read=is.gcount();
         f << '\t';
         for (size_t x=0;x<read;++x) f << buf[x] << ',';
         f << '\n';
      }
   }
   f.EndBlock();
}

I had to add std:: to the ifstream constructor call.  Also, in the read
call I had to cast buf from an unsigned char * to a char *, and sizeof buf
from an unsigned int to an int.  Specifically,

void Gtk_Image::EmbedImage(CxxFile &f,const std::string &pixbuf) const
{  f.Declaration("static const unsigned char ");
   f << Configuration.CName(pixbuf) << "_data[]";
   f.Assignment().StartBlock().EndLine();
   {  std::ifstream is((Configuration.pixmap_dir+"/"+pixbuf).c_str());
      while (is.good())
      {  unsigned char buf[16];
         is.read((char*)buf,(int)sizeof buf);
         size_t read=is.gcount();
         f << '\t';
         for (size_t x=0;x<read;++x) f << buf[x] << ',';
         f << '\n';
      }
   }
   f.EndBlock();
}

The code compiled and ran after these changes.

Many thanks
Matt


-----------------------------------------------------------------------

Dr. Matthew Britton                    email:  [email protected]
Division of Geological and             phone:  +1 (626) 395-2415
     Planetary Sciences                fax:    +1 (626) 585-1917
California Institute of Technology     Office: 163 South Mudd
1200 E. California Blvd., M/S 150-21
Pasadena,  CA 91125
-----------------------------------------------------------------------
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.