Platon Technologies
neprihlásený Prihlásiť Registrácia
SlovakEnglish
open source software development oslavujeme 10 rokov vývoja otvoreného softvéru! Piatok, 29. marec 2024

Rozdiely pre cpdf/parse.c medzi verziami 1.3 a 1.4

verzia 1.3, 2002/09/13 20:39:36 verzia 1.4, 2002/09/14 12:42:40
Riadok 3 
Riadok 3 
 #include <string.h>  #include <string.h>
 /* function compute number of locations of char c from buffer to character e  /* function compute number of locations of char c from buffer to character e
  */   */
 int strlenc(char *buffer, char c, char e)  int strlenc(char *buffer, char c, char to)
 {  {
         register int i = 0;          register int i = 0;
         register char *p = buffer;          register char *p = buffer;
         while (*p && *p != e) {          while (*p && *p != to) {
                 if (*p == c)                  if (*p == c)
                         i++;                          i++;
                 p++;                  p++;
         }          }
         return i;          return i;
 }  }
   /* function compute lenght of string to char e */
   int strlento(register char *buffer, char e)
   {
           register int i = 0;
           register char *p = buffer;
           register char to = e;
           while (*p && *p != to)
                   i++;
           return i;
   }
   
 /* interpreting special characters in name string */  /* convert hex to bin  */
   char *hex(char *buffer)
   {
           char *hex_array;
           char num[2];
           int i;
           if (*buffer != '<')
                   return NULL;
           i = strlento(buffer + 1, '>') / 2 * sizeof(char);
           hex_array = (char *) malloc(i);
           while (*buffer != '>') {
                   num[0] = *buffer;
                   if (*(buffer + 1) == '>')
                           num[1] = '0';
                   else {
                           num[1] = *(buffer + 1);
                           buffer += 2;
                   }
                   *hex_array = (char) strtoul((char *) &num, NULL, 16);
                   hex_array++;
           }
           return hex_array;
   }
   
   /* interpreter for special characters in name string */
 char *name(char *buffer)  char *name(char *buffer)
 {  {
         register char *ret;          register char *ret;
         char num[4] = "0x";          char num[4] = "0x";
         if (*ret != '/')          if (*buffer != '/')
                 return NULL;                  return NULL;
         ret = (char *) malloc(255);          ret = (char *) malloc(strlento(buffer, ' ') * sizeof(char));
         while (*buffer != ' ') {          while (*buffer != ' ') {
                 if (*buffer == '#') {                  if (*buffer == '#') {
                         num[2] = *(buffer + 1);                          num[2] = *(buffer + 1);
                         num[3] = *(buffer + 2);                          num[3] = *(buffer + 2);
                         *ret = (char) strtoul(&num,NULL,16);                          *ret = (char) strtoul((char *) &num, NULL, 16);
                         buffer += 2;                          ret++;
                           buffer += 3;
                 }                  }
                 *ret = *buffer;                  *ret = *buffer;
                 ret++;                  ret++;
Riadok 44  char **array(char *buffer)
Riadok 79  char **array(char *buffer)
         register int end, a, index;          register int end, a, index;
         if (*buffer != '[')          if (*buffer != '[')
                 return NULL;                  return NULL;
         ret = (char **) malloc(strlenc(buffer,' ',']') * sizeof(char));          ret = (char **) malloc(strlenc(buffer, ' ', ']') * sizeof(char));
         end = a = index = 0;          end = a = index = 0;
         while (end > 0) {          while (end > 0) {
                 switch (*buffer) {                  switch (*buffer) {
                 case '[':                  case '[':
                         end++;                          end++;
                         if(*(buffer + 1) == ' ')                          if (*(buffer + 1) == ' ') {
                                 buffer++;                                  buffer += 2;
                                   continue;
                           }
                         break;                          break;
                 case ']':                  case ']':
                         end--;                          end--;

Legend:
Odstranené z verzie1.3  
zmenené riadky
  Pridané vo verzii1.4

Platon Group <platon@platon.sk> http://platon.sk/
Copyright © 2002-2006 Platon Group
Stránka používa redakčný systém Metafox
Na začiatok