Diff for /parser3/src/main/pa_string.C between versions 1.125.2.1 and 1.125.2.1.2.2

version 1.125.2.1, 2001/11/23 10:41:21 version 1.125.2.1.2.2, 2001/12/07 13:10:18
Line 852  int String::as_int() const { Line 852  int String::as_int() const {
         return result;          return result;
 }  }
   
   inline void ushort2uchars(ushort word, uchar& byte1, uchar& byte2) {
           byte1=word&0xFF;
           byte2=word>>8;
   }
   inline ushort uchars2ushort(uchar byte1, uchar byte2) {
           return (byte2<<8) | byte1;
   }
 /* @todo maybe network order worth spending some effort?  /* @todo maybe network order worth spending some effort?
         don't bothering myself with network byte order,          don't bothering myself with network byte order,
         am not planning to be able to move resulting file across platforms          am not planning to be able to move resulting file across platforms
Line 870  void String::serialize(size_t prolog_siz Line 877  void String::serialize(size_t prolog_siz
                 memcpy(cur, &row->item.lang, sizeof(uchar));                  memcpy(cur, &row->item.lang, sizeof(uchar));
                 cur+=sizeof(uchar);                  cur+=sizeof(uchar);
                 // size                  // size
                 memcpy(cur, &row->item.size, sizeof(ushort));                  uchar byte1; uchar byte2;
                 cur+=sizeof(ushort);                  ushort2uchars(row->item.size, byte1, byte2);
                   memcpy(cur, &byte1, sizeof(uchar)); cur+=sizeof(uchar);
                   memcpy(cur, &byte2, sizeof(uchar)); cur+=sizeof(uchar);
                 // bytes                  // bytes
                 memcpy(cur, row->item.ptr, row->item.size);                  memcpy(cur, row->item.ptr, row->item.size);
                 cur+=row->item.size;                  cur+=row->item.size;
Line 884  void String::deserialize(size_t prolog_s Line 893  void String::deserialize(size_t prolog_s
         buf_size-=prolog_size;          buf_size-=prolog_size;
   
         while(buf_size) {          while(buf_size) {
                 uchar lang=*(const uchar*)((const char*)cur+0);                  uchar lang=*(uchar *)(cur);
                 ushort size=*(const ushort*)((const char*)cur+sizeof(uchar));                  
                 const char *ptr=(const char*)cur+sizeof(uchar)+sizeof(ushort);                  ushort size=uchars2ushort(
                           *(uchar*)(cur+sizeof(uchar)*1),
                           *(uchar*)(cur+sizeof(uchar)*2)
                   );
   
                   const char *ptr=(const char*)(cur+sizeof(uchar)*3); 
                 APPEND(ptr, size, lang, file, 0);                  APPEND(ptr, size, lang, file, 0);
   
                 size_t piece_size=sizeof(uchar)+sizeof(ushort)+size;                  size_t piece_size=sizeof(uchar)+sizeof(ushort)+size;

Removed from v.1.125.2.1  
changed lines
  Added in v.1.125.2.1.2.2


E-mail: