Skip to content

Commit

Permalink
Merge pull request unidoc#440 from unidoc-build/prep-rc-v1.7.0
Browse files Browse the repository at this point in the history
Prepare UniOffice release v1.7.0
  • Loading branch information
gunnsth authored Nov 9, 2020
2 parents 35b6f98 + ff1d404 commit f4941d7
Show file tree
Hide file tree
Showing 47 changed files with 18,703 additions and 18,681 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 _f "strconv";
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 );};

// NaturalLess compares two strings in a human manner so rId2 sorts less than rId10
func NaturalLess (lhs ,rhs string )bool {_ff ,_a :=0,0;for _ff < len (lhs )&&_a < len (rhs ){_ad :=lhs [_ff ];_ba :=rhs [_a ];_af :=_d (_ad );_fb :=_d (_ba );switch {case _af &&!_fb :return true ;case !_af &&_fb :return false ;case !_af &&!_fb :if _ad !=_ba {return _ad < _ba ;};_ff ++;_a ++;default:_bf :=_ff +1;_df :=_a +1;for _bf < len (lhs )&&_d (lhs [_bf ]){_bf ++;};for _df < len (rhs )&&_d (rhs [_df ]){_df ++;};_g ,_ :=_f .ParseUint (lhs [_ff :_bf ],10,64);_gb ,_ :=_f .ParseUint (rhs [_ff :_df ],10,64);if _g !=_gb {return _g < _gb ;};_ff =_bf ;_a =_df ;};};return len (lhs )< len (rhs );};func _d (_fe byte )bool {return _fe >='0'&&_fe <='9'};func RepeatString (s string ,cnt int )string {if cnt <=0{return "";};_dd :=make ([]byte ,len (s )*cnt );_bb :=[]byte (s );for _c :=0;_c < cnt ;_c ++{copy (_dd [_c :],_bb );};return string (_dd );};
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 );};
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.

510 changes: 264 additions & 246 deletions common/common.go

Large diffs are not rendered by default.

46 changes: 23 additions & 23 deletions common/license/license.go

Large diffs are not rendered by default.

24 changes: 12 additions & 12 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 (_g "github.com/unidoc/unioffice/common/tempstorage";_d "io/ioutil";_a "os";_c "strings";);

// Add is not applicable in the diskstore implementation
func (_ac diskStorage )Add (path string )error {return nil };
package diskstore ;import (_b "github.com/unidoc/unioffice/common/tempstorage";_a "io/ioutil";_c "os";_ee "strings";);

// TempFile creates a new temp file by calling ioutil TempFile
func (_dd diskStorage )TempFile (dir ,pattern string )(_g .File ,error ){return _d .TempFile (dir ,pattern );};

// TempFile creates a new temp directory by calling ioutil TempDir
func (_ag diskStorage )TempDir (pattern string )(string ,error ){return _d .TempDir ("",pattern )};
func (_de diskStorage )TempFile (dir ,pattern string )(_b .File ,error ){return _a .TempFile (dir ,pattern );};

// SetAsStorage sets temp storage as a disk storage
func SetAsStorage (){_gg :=diskStorage {};_g .SetAsStorage (&_gg )};type diskStorage struct{};
func SetAsStorage (){_bd :=diskStorage {};_b .SetAsStorage (&_bd )};

// Open opens file from disk according to a path
func (_d diskStorage )Open (path string )(_b .File ,error ){return _c .Open (path )};

// 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 (_gd diskStorage )RemoveAll (dir string )error {if _c .HasPrefix (dir ,_a .TempDir ()){return _a .RemoveAll (dir );};return nil ;};
func (_fb diskStorage )RemoveAll (dir string )error {if _ee .HasPrefix (dir ,_c .TempDir ()){return _c .RemoveAll (dir );};return nil ;};

// Open opens file from disk according to a path
func (_b diskStorage )Open (path string )(_g .File ,error ){return _a .Open (path )};
// 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{};
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 (_a "encoding/hex";_fd "errors";_gd "fmt";_ca "github.com/unidoc/unioffice/common/tempstorage";_g "io";_bd "io/ioutil";_f "math/rand";_b "sync";);func _df (_ea int )(string ,error ){_ggf :=make ([]byte ,_ea );if _ ,_gb :=_f .Read (_ggf );_gb !=nil {return "",_gb ;};return _a .EncodeToString (_ggf ),nil ;};type memFile struct{_ga *memDataCell ;_ba int64 ;};
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 ;};

// Name returns the filename of the underlying memDataCell
func (_bgg *memFile )Name ()string {return _bgg ._ga ._bab };
// 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 };

// Close is not applicable in this implementation
func (_ee *memFile )Close ()error {return nil };type memStorage struct{_ae _b .Map };

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

// SetAsStorage sets temp storage as a memory storage
func SetAsStorage (){_cbd :=memStorage {_ae :_b .Map {}};_ca .SetAsStorage (&_cbd )};
func (_gf *memFile )Close ()error {return nil };func _ega (_cg string )string {_ce ,_ :=_fc (6);return _cg +_ce };

// TempFile creates a new empty file in the storage and returns it
func (_baa *memStorage )TempFile (dir ,pattern string )(_ca .File ,error ){_dad :=dir +"\u002f"+_dea (pattern );_af :=&memDataCell {_bab :_dad ,_ace :[]byte {}};_bae :=&memFile {_ga :_af };_baa ._ae .Store (_dad ,_af );return _bae ,nil ;};
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 ;};

// TempDir creates a name for a new temp directory using a pattern argument
func (_gg *memStorage )TempDir (pattern string )(string ,error ){return _dea (pattern ),nil };type memDataCell struct{_bab string ;_ace []byte ;_cb int64 ;};
// SetAsStorage sets temp storage as a memory storage
func SetAsStorage (){_bb :=memStorage {_da :_e .Map {}};_ad .SetAsStorage (&_bb )};

// Add reads a file from a disk and adds it to the storage
func (_fde *memStorage )Add (path string )error {_bc ,_eec :=_bd .ReadFile (path );if _eec !=nil {return _eec ;};_fde ._ae .Store (path ,&memDataCell {_bab :path ,_ace :_bc });return nil ;};func _dea (_dec string )string {_ff ,_ :=_df (6);return _dec +_ff };
// Name returns the filename of the underlying memDataCell
func (_ea *memFile )Name ()string {return _ea ._eb ._bc };

// Read reads from the underlying memDataCell in order to implement Reader interface
func (_ac *memFile )Read (p []byte )(int ,error ){_d :=_ac ._ba ;_bg :=_ac ._ga ._cb ;_e :=int64 (len (p ));if _e > _bg {_e =_bg ;p =p [:_e ];};if _d >=_bg {return 0,_g .EOF ;};_bad :=_d +_e ;if _bad >=_bg {_bad =_bg ;};_ed :=copy (p ,_ac ._ga ._ace [_d :_bad ]);_ac ._ba =_bad ;return _ed ,nil ;};
// 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 };

// RemoveAll removes all files according to the dir argument prefix
func (_gac *memStorage )RemoveAll (dir string )error {_gac ._ae .Range (func (_fb ,_de interface{})bool {_gac ._ae .Delete (_fb );return true });return nil ;};
func (_afg *memStorage )RemoveAll (dir string )error {_afg ._da .Range (func (_egf ,_bbg interface{})bool {_afg ._da .Delete (_egf );return true });return nil ;};

// Open returns tempstorage File object by name
func (_baf *memStorage )Open (path string )(_ca .File ,error ){_da ,_bdb :=_baf ._ae .Load (path );if !_bdb {return nil ,_fd .New (_gd .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 {_ga :_da .(*memDataCell )},nil ;};
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 ;};

// 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 ;};

// 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 ;};
28 changes: 14 additions & 14 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 _a "io";
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 ;};

// Open returns tempstorage File object by name.
func Open (path string )(File ,error ){return _b .Open (path )};type storage interface{Open (_gg string )(File ,error );TempFile (_ga ,_d string )(File ,error );TempDir (_da string )(string ,error );RemoveAll (_gc string )error ;Add (_f string )error ;};
// RemoveAll removes all files according to the dir argument prefix.
func RemoveAll (dir string )error {return _fb .RemoveAll (dir )};

// Add reads a file from a disk and adds it to the storage.
func Add (path string )error {return _b .Add (path )};
// Open returns tempstorage File object by name.
func Open (path string )(File ,error ){return _fb .Open (path )};

// File is a representation of a storage file
// with Read, Write, Close and Name methods identical to os.File.
type File interface{_a .Reader ;_a .Writer ;_a .Closer ;Name ()string ;};
// 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 _b .TempFile (dir ,pattern )};
func TempFile (dir ,pattern string )(File ,error ){return _fb .TempFile (dir ,pattern )};var _fb storage ;

// TempDir creates a name for a new temp directory using a pattern argument.
func TempDir (pattern string )(string ,error ){return _b .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 ;};

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

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

0 comments on commit f4941d7

Please sign in to comment.