Skip to content

Commit

Permalink
Merge pull request #434 from unidoc-build/prep-rc-v1.5.1
Browse files Browse the repository at this point in the history
Prepare release v1.5.1
  • Loading branch information
gunnsth authored Aug 31, 2020
2 parents 373b458 + b8160fa commit ec21603
Show file tree
Hide file tree
Showing 46 changed files with 18,614 additions and 18,614 deletions.
4 changes: 2 additions & 2 deletions algo/algo.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
// Use of this source code is governed by the UniDoc End User License Agreement
// terms that can be accessed at https://unidoc.io/eula/

package algo ;import _d "strconv";func _fa (_ga byte )bool {return _ga >='0'&&_ga <='9'};func RepeatString (s string ,cnt int )string {if cnt <=0{return "";};_fd :=make ([]byte ,len (s )*cnt );_egf :=[]byte (s );for _de :=0;_de < cnt ;_de ++{copy (_fd [_de :],_egf );};return string (_fd );};
package algo ;import _b "strconv";func _e (_g byte )bool {return _g >='0'&&_g <='9'};func RepeatString (s string ,cnt int )string {if cnt <=0{return "";};_dd :=make ([]byte ,len (s )*cnt );_gd :=[]byte (s );for _f :=0;_f < cnt ;_f ++{copy (_dd [_f :],_gd );};return string (_dd );};

// NaturalLess compares two strings in a human manner so rId2 sorts less than rId10
func NaturalLess (lhs ,rhs string )bool {_dd ,_ad :=0,0;for _dd < len (lhs )&&_ad < len (rhs ){_ab :=lhs [_dd ];_fb :=rhs [_ad ];_f :=_fa (_ab );_b :=_fa (_fb );switch {case _f &&!_b :return true ;case !_f &&_b :return false ;case !_f &&!_b :if _ab !=_fb {return _ab < _fb ;};_dd ++;_ad ++;default:_e :=_dd +1;_bf :=_ad +1;for _e < len (lhs )&&_fa (lhs [_e ]){_e ++;};for _bf < len (rhs )&&_fa (rhs [_bf ]){_bf ++;};_bd ,_ :=_d .ParseUint (lhs [_dd :_e ],10,64);_g ,_ :=_d .ParseUint (rhs [_dd :_bf ],10,64);if _bd !=_g {return _bd < _g ;};_dd =_e ;_ad =_bf ;};};return len (lhs )< len (rhs );};
func NaturalLess (lhs ,rhs string )bool {_a ,_bf :=0,0;for _a < len (lhs )&&_bf < len (rhs ){_c :=lhs [_a ];_bd :=rhs [_bf ];_df :=_e (_c );_ag :=_e (_bd );switch {case _df &&!_ag :return true ;case !_df &&_ag :return false ;case !_df &&!_ag :if _c !=_bd {return _c < _bd ;};_a ++;_bf ++;default:_ea :=_a +1;_af :=_bf +1;for _ea < len (lhs )&&_e (lhs [_ea ]){_ea ++;};for _af < len (rhs )&&_e (rhs [_af ]){_af ++;};_gc ,_ :=_b .ParseUint (lhs [_a :_ea ],10,64);_da ,_ :=_b .ParseUint (rhs [_a :_af ],10,64);if _gc !=_da {return _gc < _da ;};_a =_ea ;_bf =_af ;};};return len (lhs )< len (rhs );};
662 changes: 331 additions & 331 deletions chart/chart.go

Large diffs are not rendered by default.

26 changes: 13 additions & 13 deletions color/color.go

Large diffs are not rendered by default.

430 changes: 215 additions & 215 deletions common/common.go

Large diffs are not rendered by default.

42 changes: 21 additions & 21 deletions common/license/license.go

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions common/tempstorage/diskstore/diskstore.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,22 @@

// Package diskstore implements tempStorage interface
// by using disk as a storage
package diskstore ;import (_c "github.com/unidoc/unioffice/common/tempstorage";_eb "io/ioutil";_a "os";_bd "strings";);type diskStorage struct{};
package diskstore ;import (_f "github.com/unidoc/unioffice/common/tempstorage";_c "io/ioutil";_eb "os";_e "strings";);

// TempFile creates a new temp file by calling ioutil TempFile
func (_b diskStorage )TempFile (dir ,pattern string )(_c .File ,error ){return _eb .TempFile (dir ,pattern );};
// SetAsStorage sets temp storage as a disk storage
func SetAsStorage (){_bb :=diskStorage {};_f .SetAsStorage (&_bb )};

// Add is not applicable in the diskstore implementation
func (_f diskStorage )Add (path string )error {return nil };
func (_ff diskStorage )Add (path string )error {return nil };type diskStorage struct{};

// TempFile creates a new temp directory by calling ioutil TempDir
func (_e diskStorage )TempDir (pattern string )(string ,error ){return _eb .TempDir ("",pattern )};
// Open opens file from disk according to a path
func (_g diskStorage )Open (path string )(_f .File ,error ){return _eb .Open (path )};

// RemoveAll removes all files in the directory
func (_ce diskStorage )RemoveAll (dir string )error {if _bd .HasPrefix (dir ,_a .TempDir ()){return _a .RemoveAll (dir );};return nil ;};
func (_da diskStorage )RemoveAll (dir string )error {if _e .HasPrefix (dir ,_eb .TempDir ()){return _eb .RemoveAll (dir );};return nil ;};

// Open opens file from disk according to a path
func (_d diskStorage )Open (path string )(_c .File ,error ){return _a .Open (path )};
// TempFile creates a new temp directory by calling ioutil TempDir
func (_d diskStorage )TempDir (pattern string )(string ,error ){return _c .TempDir ("",pattern )};

// SetAsStorage sets temp storage as a disk storage
func SetAsStorage (){_eg :=diskStorage {};_c .SetAsStorage (&_eg )};
// TempFile creates a new temp file by calling ioutil TempFile
func (_fg diskStorage )TempFile (dir ,pattern string )(_f .File ,error ){return _c .TempFile (dir ,pattern );};
38 changes: 19 additions & 19 deletions common/tempstorage/memstore/memstore.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,34 +11,34 @@

// Package memstore implements tempStorage interface
// by using memory as a storage
package memstore ;import (_ede "encoding/hex";_fe "errors";_dc "fmt";_ge "github.com/unidoc/unioffice/common/tempstorage";_daf "io";_dfb "io/ioutil";_bd "math/rand";_ff "sync";);type memStorage struct{_g _ff .Map };

// Open returns tempstorage File object by name
func (_gg *memStorage )Open (path string )(_ge .File ,error ){_bc ,_ab :=_gg ._g .Load (path );if !_ab {return nil ,_fe .New (_dc .Sprintf ("\u0043\u0061\u006eno\u0074\u0020\u006f\u0070\u0065\u006e\u0020\u0074\u0068\u0065\u0020\u0066\u0069\u006c\u0065\u0020\u0025\u0073",path ));};return &memFile {_be :_bc .(*memDataCell )},nil ;};

// Name returns the filename of the underlying memDataCell
func (_da *memFile )Name ()string {return _da ._be ._ead };
package memstore ;import (_f "encoding/hex";_dg "errors";_de "fmt";_fb "github.com/unidoc/unioffice/common/tempstorage";_c "io";_b "io/ioutil";_cf "math/rand";_d "sync";);

// Write writes to the end of the underlying memDataCell in order to implement Writer interface
func (_dg *memFile )Write (p []byte )(int ,error ){_dg ._be ._cb =append (_dg ._be ._cb ,p ...);_dg ._be ._ea +=int64 (len (p ));return len (p ),nil ;};

// TempFile creates a new empty file in the storage and returns it
func (_ec *memStorage )TempFile (dir ,pattern string )(_ge .File ,error ){_a :=dir +"\u002f"+_fee (pattern );_e :=&memDataCell {_ead :_a ,_cb :[]byte {}};_dab :=&memFile {_be :_e };_ec ._g .Store (_a ,_e );return _dab ,nil ;};
func (_da *memFile )Write (p []byte )(int ,error ){_da ._df ._fef =append (_da ._df ._fef ,p ...);_da ._df ._feg +=int64 (len (p ));return len (p ),nil ;};type memStorage struct{_ac _d .Map };func _eb (_eg string )string {_bc ,_ :=_efc (6);return _eg +_bc };

// SetAsStorage sets temp storage as a memory storage
func SetAsStorage (){_cae :=memStorage {_g :_ff .Map {}};_ge .SetAsStorage (&_cae )};
func SetAsStorage (){_be :=memStorage {_ac :_d .Map {}};_fb .SetAsStorage (&_be )};

// RemoveAll removes all files according to the dir argument prefix
func (_bf *memStorage )RemoveAll (dir string )error {_bf ._ac .Range (func (_bfd ,_gfd interface{})bool {_bf ._ac .Delete (_bfd );return true });return nil ;};

// Name returns the filename of the underlying memDataCell
func (_a *memFile )Name ()string {return _a ._df ._dfb };

// TempDir creates a name for a new temp directory using a pattern argument
func (_dbf *memStorage )TempDir (pattern string )(string ,error ){return _fee (pattern ),nil };
func (_eed *memStorage )TempDir (pattern string )(string ,error ){return _eb (pattern ),nil };type memFile struct{_df *memDataCell ;_gf int64 ;};func _efc (_efd int )(string ,error ){_gfb :=make ([]byte ,_efd );if _ ,_gd :=_cf .Read (_gfb );_gd !=nil {return "",_gd ;};return _f .EncodeToString (_gfb ),nil ;};

// Read reads from the underlying memDataCell in order to implement Reader interface
func (_df *memFile )Read (p []byte )(int ,error ){_cc :=_df ._dd ;_d :=_df ._be ._ea ;_f :=int64 (len (p ));if _f > _d {_f =_d ;p =p [:_f ];};if _cc >=_d {return 0,_daf .EOF ;};_af :=_cc +_f ;if _af >=_d {_af =_d ;};_baf :=copy (p ,_df ._be ._cb [_cc :_af ]);_df ._dd =_af ;return _baf ,nil ;};type memFile struct{_be *memDataCell ;_dd int64 ;};type memDataCell struct{_ead string ;_cb []byte ;_ea int64 ;};
func (_bg *memFile )Read (p []byte )(int ,error ){_ga :=_bg ._gf ;_fe :=_bg ._df ._feg ;_cb :=int64 (len (p ));if _cb > _fe {_cb =_fe ;p =p [:_cb ];};if _ga >=_fe {return 0,_c .EOF ;};_e :=_ga +_cb ;if _e >=_fe {_e =_fe ;};_gfe :=copy (p ,_bg ._df ._fef [_ga :_e ]);_bg ._gf =_e ;return _gfe ,nil ;};

// Close is not applicable in this implementation
func (_ef *memFile )Close ()error {return nil };

// Add reads a file from a disk and adds it to the storage
func (_efa *memStorage )Add (path string )error {_ba ,_eab :=_dfb .ReadFile (path );if _eab !=nil {return _eab ;};_efa ._g .Store (path ,&memDataCell {_ead :path ,_cb :_ba });return nil ;};func _fee (_ef string )string {_db ,_ :=_cad (6);return _ef +_db };
func (_fd *memStorage )Add (path string )error {_ge ,_agb :=_b .ReadFile (path );if _agb !=nil {return _agb ;};_fd ._ac .Store (path ,&memDataCell {_dfb :path ,_fef :_ge });return nil ;};

// Close is not applicable in this implementation
func (_gd *memFile )Close ()error {return nil };func _cad (_ac int )(string ,error ){_bb :=make ([]byte ,_ac );if _ ,_ag :=_bd .Read (_bb );_ag !=nil {return "",_ag ;};return _ede .EncodeToString (_bb ),nil ;};
// TempFile creates a new empty file in the storage and returns it
func (_cc *memStorage )TempFile (dir ,pattern string )(_fb .File ,error ){_gc :=dir +"\u002f"+_eb (pattern );_fege :=&memDataCell {_dfb :_gc ,_fef :[]byte {}};_beg :=&memFile {_df :_fege };_cc ._ac .Store (_gc ,_fege );return _beg ,nil ;};

// RemoveAll removes all files according to the dir argument prefix
func (_c *memStorage )RemoveAll (dir string )error {_c ._g .Range (func (_ca ,_ad interface{})bool {_c ._g .Delete (_ca );return true });return nil ;};
// Open returns tempstorage File object by name
func (_cd *memStorage )Open (path string )(_fb .File ,error ){_ee ,_ag :=_cd ._ac .Load (path );if !_ag {return nil ,_dg .New (_de .Sprintf ("\u0043\u0061\u006eno\u0074\u0020\u006f\u0070\u0065\u006e\u0020\u0074\u0068\u0065\u0020\u0066\u0069\u006c\u0065\u0020\u0025\u0073",path ));};return &memFile {_df :_ee .(*memDataCell )},nil ;};type memDataCell struct{_dfb string ;_fef []byte ;_feg int64 ;};
30 changes: 15 additions & 15 deletions common/tempstorage/tempstorage.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,26 @@
// Use of this source code is governed by the UniDoc End User License Agreement
// terms that can be accessed at https://unidoc.io/eula/

package tempstorage ;import _ae "io";
package tempstorage ;import _cg "io";type storage interface{Open (_b string )(File ,error );TempFile (_f ,_bg string )(File ,error );TempDir (_a string )(string ,error );RemoveAll (_e string )error ;Add (_g string )error ;};var _eg storage ;

// SetAsStorage changes temporary storage to newStorage.
func SetAsStorage (newStorage storage ){_ag =newStorage };

// File is a representation of a storage file
// with Read, Write, Close and Name methods identical to os.File.
type File interface{_ae .Reader ;_ae .Writer ;_ae .Closer ;Name ()string ;};
// Open returns tempstorage File object by name.
func Open (path string )(File ,error ){return _eg .Open (path )};

// RemoveAll removes all files according to the dir argument prefix.
func RemoveAll (dir string )error {return _ag .RemoveAll (dir )};
// Add reads a file from a disk and adds it to the storage.
func Add (path string )error {return _eg .Add (path )};

// TempDir creates a name for a new temp directory using a pattern argument.
func TempDir (pattern string )(string ,error ){return _ag .TempDir (pattern )};
func TempDir (pattern string )(string ,error ){return _eg .TempDir (pattern )};

// File is a representation of a storage file
// with Read, Write, Close and Name methods identical to os.File.
type File interface{_cg .Reader ;_cg .Writer ;_cg .Closer ;Name ()string ;};

// TempFile creates new empty file in the storage and returns it.
func TempFile (dir ,pattern string )(File ,error ){return _ag .TempFile (dir ,pattern )};var _ag storage ;type storage interface{Open (_dde string )(File ,error );TempFile (_c ,_b string )(File ,error );TempDir (_bf string )(string ,error );RemoveAll (_d string )error ;Add (_a string )error ;};
func TempFile (dir ,pattern string )(File ,error ){return _eg .TempFile (dir ,pattern )};

// Add reads a file from a disk and adds it to the storage.
func Add (path string )error {return _ag .Add (path )};
// RemoveAll removes all files according to the dir argument prefix.
func RemoveAll (dir string )error {return _eg .RemoveAll (dir )};

// Open returns tempstorage File object by name.
func Open (path string )(File ,error ){return _ag .Open (path )};
// SetAsStorage changes temporary storage to newStorage.
func SetAsStorage (newStorage storage ){_eg =newStorage };
Loading

0 comments on commit ec21603

Please sign in to comment.