Skip to content

Commit

Permalink
Merge pull request unidoc#442 from unidoc-build/prep-rc-v1.7.1
Browse files Browse the repository at this point in the history
Prepare release of UniOffice v1.7.1
  • Loading branch information
gunnsth authored Dec 17, 2020
2 parents f4941d7 + 570c747 commit 0fcd777
Show file tree
Hide file tree
Showing 45 changed files with 18,812 additions and 18,803 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 _a "strconv";func _ab (_f byte )bool {return _f >='0'&&_f <='9'};func RepeatString (s string ,cnt int )string {if cnt <=0{return "";};_bd :=make ([]byte ,len (s )*cnt );_fc :=[]byte (s );for _fd :=0;_fd < cnt ;_fd ++{copy (_bd [_fd :],_fc );};return string (_bd );};
package algo ;import _a "strconv";func _e (_c byte )bool {return _c >='0'&&_c <='9'};func RepeatString (s string ,cnt int )string {if cnt <=0{return "";};_fg :=make ([]byte ,len (s )*cnt );_bb :=[]byte (s );for _df :=0;_df < cnt ;_df ++{copy (_fg [_df :],_bb );};return string (_fg );};

// NaturalLess compares two strings in a human manner so rId2 sorts less than rId10
func NaturalLess (lhs ,rhs string )bool {_de ,_c :=0,0;for _de < len (lhs )&&_c < len (rhs ){_cb :=lhs [_de ];_e :=rhs [_c ];_b :=_ab (_cb );_cg :=_ab (_e );switch {case _b &&!_cg :return true ;case !_b &&_cg :return false ;case !_b &&!_cg :if _cb !=_e {return _cb < _e ;};_de ++;_c ++;default:_cf :=_de +1;_db :=_c +1;for _cf < len (lhs )&&_ab (lhs [_cf ]){_cf ++;};for _db < len (rhs )&&_ab (rhs [_db ]){_db ++;};_g ,_ :=_a .ParseUint (lhs [_de :_cf ],10,64);_bc ,_ :=_a .ParseUint (rhs [_de :_db ],10,64);if _g !=_bc {return _g < _bc ;};_de =_cf ;_c =_db ;};};return len (lhs )< len (rhs );};
func NaturalLess (lhs ,rhs string )bool {_b ,_ab :=0,0;for _b < len (lhs )&&_ab < len (rhs ){_abf :=lhs [_b ];_cc :=rhs [_ab ];_d :=_e (_abf );_dd :=_e (_cc );switch {case _d &&!_dd :return true ;case !_d &&_dd :return false ;case !_d &&!_dd :if _abf !=_cc {return _abf < _cc ;};_b ++;_ab ++;default:_be :=_b +1;_ag :=_ab +1;for _be < len (lhs )&&_e (lhs [_be ]){_be ++;};for _ag < len (rhs )&&_e (rhs [_ag ]){_ag ++;};_ae ,_ :=_a .ParseUint (lhs [_b :_be ],10,64);_cb ,_ :=_a .ParseUint (rhs [_b :_ag ],10,64);if _ae !=_cb {return _ae < _cb ;};_b =_be ;_ab =_ag ;};};return len (lhs )< len (rhs );};
664 changes: 332 additions & 332 deletions chart/chart.go

Large diffs are not rendered by default.

30 changes: 15 additions & 15 deletions color/color.go

Large diffs are not rendered by default.

520 changes: 260 additions & 260 deletions common/common.go

Large diffs are not rendered by default.

50 changes: 25 additions & 25 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 (_b "github.com/unidoc/unioffice/common/tempstorage";_a "io/ioutil";_c "os";_ee "strings";);
package diskstore ;import (_gc "github.com/unidoc/unioffice/common/tempstorage";_g "io/ioutil";_gd "os";_b "strings";);

// TempFile creates a new temp file by calling ioutil TempFile
func (_de diskStorage )TempFile (dir ,pattern string )(_b .File ,error ){return _a .TempFile (dir ,pattern );};
// Open opens file from disk according to a path
func (_e diskStorage )Open (path string )(_gc .File ,error ){return _gd .Open (path )};

// RemoveAll removes all files in the directory
func (_f diskStorage )RemoveAll (dir string )error {if _b .HasPrefix (dir ,_gd .TempDir ()){return _gd .RemoveAll (dir );};return nil ;};type diskStorage struct{};

// SetAsStorage sets temp storage as a disk storage
func SetAsStorage (){_bd :=diskStorage {};_b .SetAsStorage (&_bd )};
func SetAsStorage (){_c :=diskStorage {};_gc .SetAsStorage (&_c )};

// Open opens file from disk according to a path
func (_d diskStorage )Open (path string )(_b .File ,error ){return _c .Open (path )};
// TempFile creates a new temp file by calling ioutil TempFile
func (_cd diskStorage )TempFile (dir ,pattern string )(_gc .File ,error ){return _g .TempFile (dir ,pattern );};

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

// RemoveAll removes all files in the directory
func (_fb diskStorage )RemoveAll (dir string )error {if _ee .HasPrefix (dir ,_c .TempDir ()){return _c .RemoveAll (dir );};return nil ;};
func (_df diskStorage )Add (path string )error {return nil };

// TempFile creates a new temp directory by calling ioutil TempDir
func (_f diskStorage )TempDir (pattern string )(string ,error ){return _a .TempDir ("",pattern )};type diskStorage struct{};
func (_eg diskStorage )TempDir (pattern string )(string ,error ){return _g .TempDir ("",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 (_ef "encoding/hex";_ac "errors";_g "fmt";_ad "github.com/unidoc/unioffice/common/tempstorage";_c "io";_b "io/ioutil";_a "math/rand";_e "sync";);func _fc (_gg int )(string ,error ){_daf :=make ([]byte ,_gg );if _ ,_db :=_a .Read (_daf );_db !=nil {return "",_db ;};return _ef .EncodeToString (_daf ),nil ;};
package memstore ;import (_e "encoding/hex";_df "errors";_da "fmt";_ea "github.com/unidoc/unioffice/common/tempstorage";_c "io";_d "io/ioutil";_ad "math/rand";_ae "sync";);func _eg (_dc int )(string ,error ){_bd :=make ([]byte ,_dc );if _ ,_cc :=_ad .Read (_bd );_cc !=nil {return "",_cc ;};return _e .EncodeToString (_bd ),nil ;};

// TempDir creates a name for a new temp directory using a pattern argument
func (_cb *memStorage )TempDir (pattern string )(string ,error ){return _ega (pattern ),nil };
// Read reads from the underlying memDataCell in order to implement Reader interface
func (_f *memFile )Read (p []byte )(int ,error ){_ab :=_f ._ee ;_g :=_f ._ag ._bf ;_ce :=int64 (len (p ));if _ce > _g {_ce =_g ;p =p [:_ce ];};if _ab >=_g {return 0,_c .EOF ;};_ff :=_ab +_ce ;if _ff >=_g {_ff =_g ;};_fa :=copy (p ,_f ._ag ._de [_ab :_ff ]);_f ._ee =_ff ;return _fa ,nil ;};

// Close is not applicable in this implementation
func (_gf *memFile )Close ()error {return nil };func _ega (_cg string )string {_ce ,_ :=_fc (6);return _cg +_ce };
// SetAsStorage sets temp storage as a memory storage
func SetAsStorage (){_agb :=memStorage {_b :_ae .Map {}};_ea .SetAsStorage (&_agb )};func _cge (_ge string )string {_dec ,_ :=_eg (6);return _ge +_dec };type memStorage struct{_b _ae .Map };type memDataCell struct{_bc string ;_de []byte ;_bf int64 ;};

// TempFile creates a new empty file in the storage and returns it
func (_gdb *memStorage )TempFile (dir ,pattern string )(_ad .File ,error ){_bf :=dir +"\u002f"+_ega (pattern );_fg :=&memDataCell {_bc :_bf ,_efb :[]byte {}};_bfe :=&memFile {_eb :_fg };_gdb ._da .Store (_bf ,_fg );return _bfe ,nil ;};
func (_dd *memStorage )TempFile (dir ,pattern string )(_ea .File ,error ){_eb :=dir +"\u002f"+_cge (pattern );_faa :=&memDataCell {_bc :_eb ,_de :[]byte {}};_ga :=&memFile {_ag :_faa };_dd ._b .Store (_eb ,_faa );return _ga ,nil ;};

// SetAsStorage sets temp storage as a memory storage
func SetAsStorage (){_bb :=memStorage {_da :_e .Map {}};_ad .SetAsStorage (&_bb )};

// Name returns the filename of the underlying memDataCell
func (_ea *memFile )Name ()string {return _ea ._eb ._bc };
// TempDir creates a name for a new temp directory using a pattern argument
func (_ca *memStorage )TempDir (pattern string )(string ,error ){return _cge (pattern ),nil };type memFile struct{_ag *memDataCell ;_ee int64 ;};

// Write writes to the end of the underlying memDataCell in order to implement Writer interface
func (_dc *memFile )Write (p []byte )(int ,error ){_dc ._eb ._efb =append (_dc ._eb ._efb ,p ...);_dc ._eb ._adf +=int64 (len (p ));return len (p ),nil ;};type memStorage struct{_da _e .Map };
func (_gb *memFile )Write (p []byte )(int ,error ){_gb ._ag ._de =append (_gb ._ag ._de ,p ...);_gb ._ag ._bf +=int64 (len (p ));return len (p ),nil ;};

// RemoveAll removes all files according to the dir argument prefix
func (_afg *memStorage )RemoveAll (dir string )error {_afg ._da .Range (func (_egf ,_bbg interface{})bool {_afg ._da .Delete (_egf );return true });return nil ;};
// Close is not applicable in this implementation
func (_fe *memFile )Close ()error {return nil };

// Open returns tempstorage File object by name
func (_fd *memStorage )Open (path string )(_ad .File ,error ){_fa ,_gfb :=_fd ._da .Load (path );if !_gfb {return nil ,_ac .New (_g .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 {_eb :_fa .(*memDataCell )},nil ;};type memFile struct{_eb *memDataCell ;_gd int64 ;};
func (_ac *memStorage )Open (path string )(_ea .File ,error ){_fef ,_ec :=_ac ._b .Load (path );if !_ec {return nil ,_df .New (_da .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 {_ag :_fef .(*memDataCell )},nil ;};

// Add reads a file from a disk and adds it to the storage
func (_afa *memStorage )Add (path string )error {_ ,_aec :=_afa ._da .Load (path );if _aec {return nil ;};_gdg ,_ga :=_b .ReadFile (path );if _ga !=nil {return _ga ;};_afa ._da .Store (path ,&memDataCell {_bc :path ,_efb :_gdg });return nil ;};type memDataCell struct{_bc string ;_efb []byte ;_adf int64 ;};
// RemoveAll removes all files according to the dir argument prefix
func (_agg *memStorage )RemoveAll (dir string )error {_agg ._b .Range (func (_gf ,_db interface{})bool {_agg ._b .Delete (_gf );return true });return nil ;};

// Read reads from the underlying memDataCell in order to implement Reader interface
func (_d *memFile )Read (p []byte )(int ,error ){_ag :=_d ._gd ;_af :=_d ._eb ._adf ;_eg :=int64 (len (p ));if _eg > _af {_eg =_af ;p =p [:_eg ];};if _ag >=_af {return 0,_c .EOF ;};_gb :=_ag +_eg ;if _gb >=_af {_gb =_af ;};_ae :=copy (p ,_d ._eb ._efb [_ag :_gb ]);_d ._gd =_gb ;return _ae ,nil ;};
// Name returns the filename of the underlying memDataCell
func (_cd *memFile )Name ()string {return _cd ._ag ._bc };

// Add reads a file from a disk and adds it to the storage
func (_cg *memStorage )Add (path string )error {_ ,_agf :=_cg ._b .Load (path );if _agf {return nil ;};_bg ,_dag :=_d .ReadFile (path );if _dag !=nil {return _dag ;};_cg ._b .Store (path ,&memDataCell {_bc :path ,_de :_bg ,_bf :int64 (len (_bg ))});return nil ;};
24 changes: 12 additions & 12 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 _e "io";type storage interface{Open (_b string )(File ,error );TempFile (_a ,_f string )(File ,error );TempDir (_d string )(string ,error );RemoveAll (_bg string )error ;Add (_ab string )error ;};

// RemoveAll removes all files according to the dir argument prefix.
func RemoveAll (dir string )error {return _fb .RemoveAll (dir )};
package tempstorage ;import _dd "io";type storage interface{Open (_f string )(File ,error );TempFile (_e ,_dg string )(File ,error );TempDir (_a string )(string ,error );RemoveAll (_fc string )error ;Add (_c string )error ;};

// Open returns tempstorage File object by name.
func Open (path string )(File ,error ){return _fb .Open (path )};
func Open (path string )(File ,error ){return _cd .Open (path )};

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

// TempFile creates new empty file in the storage and returns it.
func TempFile (dir ,pattern string )(File ,error ){return _fb .TempFile (dir ,pattern )};var _fb storage ;
func TempDir (pattern string )(string ,error ){return _cd .TempDir (pattern )};

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

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

// RemoveAll removes all files according to the dir argument prefix.
func RemoveAll (dir string )error {return _cd .RemoveAll (dir )};

// Add reads a file from a disk and adds it to the storage.
func Add (path string )error {return _fb .Add (path )};
func Add (path string )error {return _cd .Add (path )};

// TempFile creates new empty file in the storage and returns it.
func TempFile (dir ,pattern string )(File ,error ){return _cd .TempFile (dir ,pattern )};
Loading

0 comments on commit 0fcd777

Please sign in to comment.