About Store Forum Documentation Contact



Post Reply 
EE's File changes
Author Message
Zervox Offline
Source Licensee

Post: #1
EE's File changes
I'd like to request having the deprecated functions available for a short while so that people do not have to dig through the sources to get ahold of custom written files so that they can write new ones using the new methods, just name the functions DepgetStr() or something.
I'd rather not write a mini library just so that I access the old functions easily across all my projects.
12-06-2017 07:32 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #2
RE: EE's File changes
Hi,
please use the following code to read deprecated string format:
Code:
int DecIntV(File &f)
{
   Byte v; f>>v;
   Bool positive=((v>>6)&1);
   UInt u=(v&63);
   if(v&128)
   {
      f>>v; u|=((v&127)<<6);
      if(v&128)
      {
         f>>v; u|=((v&127)<<(6+7));
         if(v&128)
         {
            f>>v; u|=((v&127)<<(6+7+7));
            if(v&128)
            {
               f>>v; u|=(v<<(6+7+7+7));
            }
         }
      }
   }
   return positive ? u+1 : -Int(u);
}
void GetStr2(File &f, Str &s) {s=GetStr2(f);}
Str  GetStr2(File &f)
{
   Int length=DecIntV(f);
   if( length<0) // unicode
   {
      CHS(length); MIN(length, f.left()/2);
      Str s; s.reserve(length); REP(length){char c; f>>c; s+=c;} return s;
   }else
   if(length)
   {
      MIN(length, f.left());
      Str8 s; s.reserve(length); REP(length){char8 c; f>>c; s+=c;} return s;
   }
   return S;
}
12-06-2017 08:35 PM
Find all posts by this user Quote this message in a reply
Zervox Offline
Source Licensee

Post: #3
RE: EE's File changes
Thank you, I have to admit I was too lazy to copy the functions myself. pfft
(This post was last modified: 12-08-2017 06:19 PM by Zervox.)
12-08-2017 06:19 PM
Find all posts by this user Quote this message in a reply
Post Reply