groff
[Top][All Lists]
Advanced

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

[Groff] small fix in font API use


From: Bruno Haible
Subject: [Groff] small fix in font API use
Date: Mon, 16 Jan 2006 13:40:25 +0100
User-agent: KMail/1.5

Hi,

Here is a fix for a small misunderstanding of the font class API.
font::name_to_index always returns a valid index. The first valid index that
it returns is 0.

The test in get_html_translation(font *, const string&), comparing the
return value with 0, is therefore bogus. Here is a proposed fix.


2006-01-15  Bruno Haible  <address@hidden>

        * src/devices/grohtml/post-html.cpp (get_html_translation): Remove
        failure test for font::name_to_index - it can never fail.

*** groff-20060113.orig/src/devices/grohtml/post-html.cpp       2005-12-30 
16:27:48.000000000 +0100
--- groff-20060113/src/devices/grohtml/post-html.cpp    2006-01-15 
23:34:18.000000000 +0100
***************
*** 1,5 ****
  // -*- C++ -*-
! /* Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005
   * Free Software Foundation, Inc.
   *
   *  Gaius Mulley (address@hidden) wrote post-html.cpp
--- 1,5 ----
  // -*- C++ -*-
! /* Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006
   * Free Software Foundation, Inc.
   *
   *  Gaius Mulley (address@hidden) wrote post-html.cpp
***************
*** 4305,4318 ****
      return NULL;
    else {
      idx = f->name_to_index((char *)(name + '\0').contents());
!     if (idx == 0) {
!       error("character `%s' not found", (name + '\0').contents());
        return NULL;
-     } else
-       if (f->contains(idx))
-       return (char *)f->get_special_device_encoding(idx);
-       else
-       return NULL;
    }
  }
  
--- 4305,4314 ----
      return NULL;
    else {
      idx = f->name_to_index((char *)(name + '\0').contents());
!     if (f->contains(idx))
!       return (char *)f->get_special_device_encoding(idx);
!     else
        return NULL;
    }
  }
  





reply via email to

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