pingus-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Pingus-CVS] r3962 - trunk/fontgen


From: grumbel at BerliOS
Subject: [Pingus-CVS] r3962 - trunk/fontgen
Date: Wed, 25 Feb 2009 13:34:23 +0100

Author: grumbel
Date: 2009-02-25 13:34:16 +0100 (Wed, 25 Feb 2009)
New Revision: 3962

Modified:
   trunk/fontgen/bitmap.cpp
Log:
Throw an exception when image is enlarged in a truncate call

Modified: trunk/fontgen/bitmap.cpp
===================================================================
--- trunk/fontgen/bitmap.cpp    2009-02-24 10:10:51 UTC (rev 3961)
+++ trunk/fontgen/bitmap.cpp    2009-02-25 12:34:16 UTC (rev 3962)
@@ -23,6 +23,9 @@
 **  02111-1307, USA.
 */
 
+#include <stdexcept>
+#include <sstream>
+#include <assert.h>
 #include <stdio.h>
 #include <jpeglib.h>
 #include <iostream>
@@ -75,6 +78,7 @@
   out << "# txt2png" << std::endl;
   out << get_width() << " " << get_height() << std::endl;
   out << "255" << std::endl;
+
   for(int y = 0; y < get_height(); ++y)
     for(int x = 0; x < get_width(); ++x)
       {
@@ -174,6 +178,13 @@
 void
 Bitmap::truncate_height(int height_)
 {
+  if (height_ > height)
+    {
+      std::ostringstream str;
+      str << "image height to small, increase it to " << height_;
+      throw std::runtime_error(str.str());
+    }
+
   height = height_;
 }
 





reply via email to

[Prev in Thread] Current Thread [Next in Thread]