/[pspp]/pspp/src/pfm-read.c
ViewVC logotype

Diff of /pspp/src/pfm-read.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.27 by blp, Sun Aug 7 04:39:28 2005 UTC revision 1.28 by blp, Tue Oct 25 04:28:17 2005 UTC
# Line 59  struct pfm_reader Line 59  struct pfm_reader
59      struct file_handle *fh;     /* File handle. */      struct file_handle *fh;     /* File handle. */
60      FILE *file;                 /* File stream. */      FILE *file;                 /* File stream. */
61      char cc;                    /* Current character. */      char cc;                    /* Current character. */
62      unsigned char *trans;       /* 256-byte character set translation table. */      char *trans;                /* 256-byte character set translation table. */
   
63      int var_cnt;                /* Number of variables. */      int var_cnt;                /* Number of variables. */
64      int weight_index;           /* 0-based index of weight variable, or -1. */      int weight_index;           /* 0-based index of weight variable, or -1. */
65      int *widths;                /* Variable widths, 0 for numeric. */      int *widths;                /* Variable widths, 0 for numeric. */
# Line 342  read_string (struct pfm_reader *r, char Line 341  read_string (struct pfm_reader *r, char
341    
342  /* Reads a string and returns a copy of it allocated from R's  /* Reads a string and returns a copy of it allocated from R's
343     pool. */     pool. */
344  static unsigned char *  static char *
345  read_pool_string (struct pfm_reader *r)  read_pool_string (struct pfm_reader *r)
346  {  {
347    char string[256];    char string[256];
# Line 356  read_header (struct pfm_reader *r) Line 355  read_header (struct pfm_reader *r)
355  {  {
356    /* portable_to_local[PORTABLE] translates the given portable    /* portable_to_local[PORTABLE] translates the given portable
357       character into the local character set. */       character into the local character set. */
358    static const unsigned char portable_to_local[256] =    static const char portable_to_local[256] =
359      {      {
360        "                                                                "        "                                                                "
361        "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz ."        "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz ."
# Line 364  read_header (struct pfm_reader *r) Line 363  read_header (struct pfm_reader *r)
363        "                                                                "        "                                                                "
364      };      };
365    
366    unsigned char *trans;    char *trans;
367    int i;    int i;
368    
369    /* Read and ignore vanity splash strings. */    /* Read and ignore vanity splash strings. */
# Line 411  read_header (struct pfm_reader *r) Line 410  read_header (struct pfm_reader *r)
410  static void  static void
411  read_version_data (struct pfm_reader *r, struct pfm_read_info *info)  read_version_data (struct pfm_reader *r, struct pfm_read_info *info)
412  {  {
413      static char empty_string[] = "";
414    char *date, *time, *product, *author, *subproduct;    char *date, *time, *product, *author, *subproduct;
415    int i;    int i;
416    
# Line 419  read_version_data (struct pfm_reader *r, Line 419  read_version_data (struct pfm_reader *r,
419      error (r, "Unrecognized version code `%c'.", r->cc);      error (r, "Unrecognized version code `%c'.", r->cc);
420    date = read_pool_string (r);    date = read_pool_string (r);
421    time = read_pool_string (r);    time = read_pool_string (r);
422    product = match (r, '1') ? read_pool_string (r) : (unsigned char *) "";    product = match (r, '1') ? read_pool_string (r) : empty_string;
423    author = match (r, '2') ? read_pool_string (r) : (unsigned char *) "";    author = match (r, '2') ? read_pool_string (r) : empty_string;
424    subproduct    subproduct = match (r, '3') ? read_pool_string (r) : empty_string;
     = match (r, '3') ? read_pool_string (r) : (unsigned char *) "";  
425    
426    /* Validate file. */    /* Validate file. */
427    if (strlen (date) != 8)    if (strlen (date) != 8)

Legend:
Removed from v.1.27  
changed lines
  Added in v.1.28

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26