Changeset e19eb97 for fmtext.c


Ignore:
Timestamp:
Aug 15, 2009, 7:08:18 PM (12 years ago)
Author:
Anders Kaseorg <andersk@mit.edu>
Branches:
master, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
1077891a
Parents:
fa4562c
git-author:
Anders Kaseorg <andersk@mit.edu> (08/04/09 02:37:51)
git-committer:
Anders Kaseorg <andersk@mit.edu> (08/15/09 19:08:18)
Message:
Add const qualifiers for char * and void *.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
File:
1 edited

Legend:

Unmodified
Added
Removed
  • fmtext.c

    r65b2173 re19eb97  
    4343 * 'color'
    4444 */
    45 void owl_fmtext_append_attr(owl_fmtext *f, char *text, char attr, short fgcolor, short bgcolor)
     45void owl_fmtext_append_attr(owl_fmtext *f, const char *text, char attr, short fgcolor, short bgcolor)
    4646{
    4747  char attrbuff[6];
     
    8383
    8484/* Append normal, uncolored text 'text' to 'f' */
    85 void owl_fmtext_append_normal(owl_fmtext *f, char *text)
     85void owl_fmtext_append_normal(owl_fmtext *f, const char *text)
    8686{
    8787  owl_fmtext_append_attr(f, text, OWL_FMTEXT_ATTR_NONE, OWL_COLOR_DEFAULT, OWL_COLOR_DEFAULT);
     
    8989
    9090/* Append normal, uncolored text specified by format string to 'f' */
    91 void owl_fmtext_appendf_normal(owl_fmtext *f, char *fmt, ...)
     91void owl_fmtext_appendf_normal(owl_fmtext *f, const char *fmt, ...)
    9292{
    9393  va_list ap;
     
    103103
    104104/* Append normal text 'text' to 'f' with color 'color' */
    105 void owl_fmtext_append_normal_color(owl_fmtext *f, char *text, int fgcolor, int bgcolor)
     105void owl_fmtext_append_normal_color(owl_fmtext *f, const char *text, int fgcolor, int bgcolor)
    106106{
    107107  owl_fmtext_append_attr(f, text, OWL_FMTEXT_ATTR_NONE, fgcolor, bgcolor);
     
    109109
    110110/* Append bold text 'text' to 'f' */
    111 void owl_fmtext_append_bold(owl_fmtext *f, char *text)
     111void owl_fmtext_append_bold(owl_fmtext *f, const char *text)
    112112{
    113113  owl_fmtext_append_attr(f, text, OWL_FMTEXT_ATTR_BOLD, OWL_COLOR_DEFAULT, OWL_COLOR_DEFAULT);
     
    115115
    116116/* Append reverse video text 'text' to 'f' */
    117 void owl_fmtext_append_reverse(owl_fmtext *f, char *text)
     117void owl_fmtext_append_reverse(owl_fmtext *f, const char *text)
    118118{
    119119  owl_fmtext_append_attr(f, text, OWL_FMTEXT_ATTR_REVERSE, OWL_COLOR_DEFAULT, OWL_COLOR_DEFAULT);
     
    121121
    122122/* Append reversed and bold, uncolored text 'text' to 'f' */
    123 void owl_fmtext_append_reversebold(owl_fmtext *f, char *text)
     123void owl_fmtext_append_reversebold(owl_fmtext *f, const char *text)
    124124{
    125125  owl_fmtext_append_attr(f, text, OWL_FMTEXT_ATTR_REVERSE | OWL_FMTEXT_ATTR_BOLD, OWL_COLOR_DEFAULT, OWL_COLOR_DEFAULT);
     
    172172void _owl_fmtext_scan_attributes(owl_fmtext *f, int start, char *attr, short *fgcolor, short *bgcolor) /*noproto*/
    173173{
    174   char *p;
     174  const char *p;
    175175  p = strchr(f->textbuff, OWL_FMTEXT_UC_STARTBYTE_UTF8);
    176176  while (p && p < f->textbuff + start) {
     
    382382int owl_fmtext_truncate_lines(owl_fmtext *in, int aline, int lines, owl_fmtext *out)
    383383{
    384   char *ptr1, *ptr2;
     384  const char *ptr1, *ptr2;
    385385  int i, offset;
    386386 
     
    426426void owl_fmtext_truncate_cols(owl_fmtext *in, int acol, int bcol, owl_fmtext *out)
    427427{
    428   char *ptr_s, *ptr_e, *ptr_c, *last;
     428  const char *ptr_s, *ptr_e, *ptr_c, *last;
    429429  int col, st, padding, chwidth;
    430430
     
    517517}
    518518
    519 char *owl_fmtext_get_text(owl_fmtext *f)
     519const char *owl_fmtext_get_text(owl_fmtext *f)
    520520{
    521521  return(f->textbuff);
     
    565565 * formatting syntax to set appropriate attributes.
    566566 */
    567 void owl_fmtext_append_ztext(owl_fmtext *f, char *text)
     567void owl_fmtext_append_ztext(owl_fmtext *f, const char *text)
    568568{
    569569  int stacksize, curattrs, curcolor;
    570   char *ptr, *txtptr, *tmpptr;
     570  const char *ptr, *txtptr, *tmpptr;
    571571  char *buff;
    572572  int attrstack[32], chrstack[32], colorstack[32];
     
    770770 * If format_fn is specified, passes it the list element value
    771771 * and it will return a string which this needs to free. */
    772 void owl_fmtext_append_list(owl_fmtext *f, owl_list *l, char *join_with, char *(format_fn)(char *))
     772void owl_fmtext_append_list(owl_fmtext *f, owl_list *l, const char *join_with, char *(format_fn)(const char *))
    773773{
    774774  int i, size;
    775   char *elem;
     775  const char *elem;
    776776  char *text;
    777777
Note: See TracChangeset for help on using the changeset viewer.