[passepartout] rename assert() to ASSERT() (fixes #464543)



commit 8db7c600b5938bf4ebc271888d35d3edc86afde1
Author: Sven Herzberg <herzi gnome-de org>
Date:   Thu Aug 9 15:22:21 2007 +0000

    rename assert() to ASSERT() (fixes #464543)
    
    2007-08-09  Sven Herzberg  <herzi gnome-de org>
    
    	* src/ps/pdfparser.cc: rename assert() to ASSERT() (fixes #464543)
    
    git-svn-id: http://svn.gnome.org/svn/passepartout/trunk 1530 910bfebc-b532-0410-a802-fb3981afa09c
---
 src/ps/pdfparser.cc |   42 +++++++++++++++++++++---------------------
 1 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/src/ps/pdfparser.cc b/src/ps/pdfparser.cc
index 39368da..443ebbf 100644
--- a/src/ps/pdfparser.cc
+++ b/src/ps/pdfparser.cc
@@ -2,7 +2,7 @@
 #include "util/stringutil.h"
 #include <stdexcept>
 
-#define assert(expr) if(!bool(expr)) throw std::runtime_error("PDF reading error in " __FILE__ " on line " + tostr(__LINE__));
+#define ASSERT(expr) if(!bool(expr)) throw std::runtime_error("PDF reading error in " __FILE__ " on line " + tostr(__LINE__));
 
 using namespace std;
 
@@ -14,25 +14,25 @@ PDFParser::PDFParser(const std::string& filename)
   // section.
   ParsePDF::findTrailer(source);
   std::string token;
-  assert(source >> token >> std::ws && token == "trailer");
+  ASSERT(source >> token >> std::ws && token == "trailer");
   trailer = ParsePDF::readDictionary(source);
   
-  assert(source >> token && token == "startxref");
+  ASSERT(source >> token && token == "startxref");
   int startxref;
-  assert(source >> startxref);
-  assert(source >> token && token == "%%EOF"); 
+  ASSERT(source >> startxref);
+  ASSERT(source >> token && token == "%%EOF");
   int numxref = int(trailer->get_entry("Size").dyn_cast<PDF::Real>()
 		    ->get_value());
   
   source.seekg(startxref);
   xrefs = new int[numxref];
   int idx, num;
-  assert(source >> token && token == "xref" && source >> idx >> num);
+  ASSERT(source >> token && token == "xref" && source >> idx >> num);
   for(int i = 0; i < num; ++i, ++idx) {
     int offset, generation;
     char status;
-    assert(source >> offset >> generation >> status);
-    if(status == 'n') assert(generation == 0);
+    ASSERT(source >> offset >> generation >> status);
+    if(status == 'n') ASSERT(generation == 0);
     xrefs[idx] = offset;
   }
 }
@@ -46,20 +46,20 @@ PDF::Object::Ptr PDFParser::getObject(PDF::Object::Ptr refobj) {
   if(!ref) return refobj;
   
   const int num = ref->get_num();
-  assert(xrefs[num] != 0);
+  ASSERT(xrefs[num] != 0);
   source.seekg(xrefs[num]);
   int i, j;
   std::string token;
-  assert(source >> i >> j >> token >> std::ws
+  ASSERT(source >> i >> j >> token >> std::ws
 	 && i == num && j == 0 && token == "obj");
   PDF::Object::Ptr result = ParsePDF::readObject(source);
-  assert(source >> token >> ws);
+  ASSERT(source >> token >> ws);
   if(token == "endobj")
     return result;
 
   if(token == "stream") {
     PDF::Dictionary::Ptr dict = result.dyn_cast<PDF::Dictionary>();
-    assert(dict /* a stream must be a dictionary */);
+    ASSERT(dict /* a stream must be a dictionary */);
     
     PDF::Stream::Ptr stream = PDF::Stream::create();
     // Copy the dictionary
@@ -95,7 +95,7 @@ PDF::Object::Ptr PDFParser::getObject(PDF::Object::Ptr refobj) {
 namespace {
 
   PDF::String::Ptr readString(istream& in) {
-    assert(in.get() == '(');
+    ASSERT(in.get() == '(');
     int parenlevel = 0;
     string result;
     while(1) switch(const char ch = in.get()) {
@@ -116,7 +116,7 @@ namespace {
   }
 
   PDF::String::Ptr readHexString(istream& in) {
-    assert(in.get() == '<');
+    ASSERT(in.get() == '<');
     char ch;
     bool even = true;
     std::string result;
@@ -154,7 +154,7 @@ namespace {
   }
   
   PDF::Name::Ptr readName(istream& in) {
-    assert(in.get() == '/');
+    ASSERT(in.get() == '/');
     const string irregular = "\t\n\f\r ()[]{}<>/%#";
     // Todo: null should also be irregular!
     string name;
@@ -182,7 +182,7 @@ namespace {
   }
   
   PDF::Array::Ptr readArray(istream& in) {
-    assert(in.get() == '[');
+    ASSERT(in.get() == '[');
     std::vector<PDF::Object::Ptr> result;
     while(1) {
       in >> ws;
@@ -197,7 +197,7 @@ namespace {
 	  return array;
 	}
       case 'R':
-	assert(in.get() == 'R');
+	ASSERT(in.get() == 'R');
 	{
 	  int gen = int(result.back().dyn_cast<PDF::Real>()->get_value());
 	  result.pop_back();
@@ -283,7 +283,7 @@ PDF::Object::Ptr ParsePDF::readObject(istream& in) {
   }
   case 't': case 'f': {
     string st;
-    assert(getstring(in, st));
+    ASSERT(getstring(in, st));
     if(st == "true") return PDF::Boolean::create(true);
     if(st == "false") return PDF::Boolean::create(false);
     throw std::runtime_error
@@ -299,7 +299,7 @@ PDF::Object::Ptr ParsePDF::readObject(istream& in) {
 }
 
 PDF::Dictionary::Ptr ParsePDF::readDictionary(istream& in) {
-  assert(in.get() == '<' && in.get() == '<');
+  ASSERT(in.get() == '<' && in.get() == '<');
   typedef std::vector<PDF::Object::Ptr> RVec;
   RVec result;
   
@@ -307,7 +307,7 @@ PDF::Dictionary::Ptr ParsePDF::readDictionary(istream& in) {
     in >> ws;
     switch(in.peek()) {
     case '>':
-      assert(in.get() == '>' && in.get() == '>');
+      ASSERT(in.get() == '>' && in.get() == '>');
       {
 	// End of the dictionary; return it
 	PDF::Dictionary::Ptr dict = PDF::Dictionary::create();
@@ -321,7 +321,7 @@ PDF::Dictionary::Ptr ParsePDF::readDictionary(istream& in) {
 	return dict;
       }
     case 'R':
-      assert(in.get() == 'R');
+      ASSERT(in.get() == 'R');
       {
 	int gen = int(result.back().dyn_cast<PDF::Real>()->get_value());
 	result.pop_back();



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