mirror of
				https://github.com/MariaDB/server.git
				synced 2025-11-03 14:33:32 +03:00 
			
		
		
		
	Changed header to GPL version 2 only BUILD/Makefile.am: Changed header to GPL version 2 only Docs/Makefile.am: Changed header to GPL version 2 only Makefile.am: Changed header to GPL version 2 only SSL/Makefile.am: Changed header to GPL version 2 only bdb/Makefile.in: Changed header to GPL version 2 only client/Makefile.am: Changed header to GPL version 2 only client/client_priv.h: Changed header to GPL version 2 only client/completion_hash.cc: Changed header to GPL version 2 only client/completion_hash.h: Changed header to GPL version 2 only client/get_password.c: Changed header to GPL version 2 only client/my_readline.h: Changed header to GPL version 2 only client/mysql.cc: Changed header to GPL version 2 only client/mysql_upgrade.c: Changed header to GPL version 2 only client/mysqladmin.cc: Changed header to GPL version 2 only client/mysqlbinlog.cc: Changed header to GPL version 2 only client/mysqlcheck.c: Changed header to GPL version 2 only client/mysqldump.c: Changed header to GPL version 2 only client/mysqlimport.c: Changed header to GPL version 2 only client/mysqlmanager-pwgen.c: Changed header to GPL version 2 only client/mysqlmanagerc.c: Changed header to GPL version 2 only client/mysqlshow.c: Changed header to GPL version 2 only client/mysqltest.c: Changed header to GPL version 2 only client/readline.cc: Changed header to GPL version 2 only client/sql_string.cc: Changed header to GPL version 2 only client/sql_string.h: Changed header to GPL version 2 only cmd-line-utils/Makefile.am: Changed header to GPL version 2 only dbug/Makefile.am: Changed header to GPL version 2 only extra/Makefile.am: Changed header to GPL version 2 only extra/charset2html.c: Changed header to GPL version 2 only extra/comp_err.c: Changed header to GPL version 2 only extra/innochecksum.c: Changed header to GPL version 2 only extra/my_print_defaults.c: Changed header to GPL version 2 only extra/mysql_waitpid.c: Changed header to GPL version 2 only extra/perror.c: Changed header to GPL version 2 only extra/replace.c: Changed header to GPL version 2 only extra/resolve_stack_dump.c: Changed header to GPL version 2 only extra/resolveip.c: Changed header to GPL version 2 only heap/Makefile.am: Changed header to GPL version 2 only heap/_check.c: Changed header to GPL version 2 only heap/_rectest.c: Changed header to GPL version 2 only heap/heapdef.h: Changed header to GPL version 2 only heap/hp_block.c: Changed header to GPL version 2 only heap/hp_clear.c: Changed header to GPL version 2 only heap/hp_close.c: Changed header to GPL version 2 only heap/hp_create.c: Changed header to GPL version 2 only heap/hp_delete.c: Changed header to GPL version 2 only heap/hp_extra.c: Changed header to GPL version 2 only heap/hp_hash.c: Changed header to GPL version 2 only heap/hp_info.c: Changed header to GPL version 2 only heap/hp_open.c: Changed header to GPL version 2 only heap/hp_panic.c: Changed header to GPL version 2 only heap/hp_rename.c: Changed header to GPL version 2 only heap/hp_rfirst.c: Changed header to GPL version 2 only heap/hp_rkey.c: Changed header to GPL version 2 only heap/hp_rlast.c: Changed header to GPL version 2 only heap/hp_rnext.c: Changed header to GPL version 2 only heap/hp_rprev.c: Changed header to GPL version 2 only heap/hp_rrnd.c: Changed header to GPL version 2 only heap/hp_rsame.c: Changed header to GPL version 2 only heap/hp_scan.c: Changed header to GPL version 2 only heap/hp_static.c: Changed header to GPL version 2 only heap/hp_test1.c: Changed header to GPL version 2 only heap/hp_test2.c: Changed header to GPL version 2 only heap/hp_update.c: Changed header to GPL version 2 only heap/hp_write.c: Changed header to GPL version 2 only include/Makefile.am: Changed header to GPL version 2 only include/base64.h: Changed header to GPL version 2 only include/config-netware.h: Changed header to GPL version 2 only include/config-os2.h: Changed header to GPL version 2 only include/config-win.h: Changed header to GPL version 2 only include/decimal.h: Changed header to GPL version 2 only include/errmsg.h: Changed header to GPL version 2 only include/ft_global.h: Changed header to GPL version 2 only include/hash.h: Changed header to GPL version 2 only include/heap.h: Changed header to GPL version 2 only include/keycache.h: Changed header to GPL version 2 only include/m_ctype.h: Changed header to GPL version 2 only include/m_string.h: Changed header to GPL version 2 only include/md5.h: Changed header to GPL version 2 only include/my_aes.h: Changed header to GPL version 2 only include/my_alarm.h: Changed header to GPL version 2 only include/my_alloc.h: Changed header to GPL version 2 only include/my_base.h: Changed header to GPL version 2 only include/my_bitmap.h: Changed header to GPL version 2 only include/my_dbug.h: Changed header to GPL version 2 only include/my_dir.h: Changed header to GPL version 2 only include/my_getopt.h: Changed header to GPL version 2 only include/my_global.h: Changed header to GPL version 2 only include/my_handler.h: Changed header to GPL version 2 only include/my_libwrap.h: Changed header to GPL version 2 only include/my_list.h: Changed header to GPL version 2 only include/my_net.h: Changed header to GPL version 2 only include/my_no_pthread.h: Changed header to GPL version 2 only include/my_nosys.h: Changed header to GPL version 2 only include/my_pthread.h: Changed header to GPL version 2 only include/my_sys.h: Changed header to GPL version 2 only include/my_time.h: Changed header to GPL version 2 only include/my_tree.h: Changed header to GPL version 2 only include/my_user.h: Changed header to GPL version 2 only include/my_xml.h: Changed header to GPL version 2 only include/myisam.h: Changed header to GPL version 2 only include/myisammrg.h: Changed header to GPL version 2 only include/myisampack.h: Changed header to GPL version 2 only include/mysql.h: Changed header to GPL version 2 only include/mysql_com.h: Changed header to GPL version 2 only include/mysql_embed.h: Changed header to GPL version 2 only include/mysql_time.h: Changed header to GPL version 2 only include/mysys_err.h: Changed header to GPL version 2 only include/queues.h: Changed header to GPL version 2 only include/raid.h: Changed header to GPL version 2 only include/rijndael.h: Changed header to GPL version 2 only include/sha1.h: Changed header to GPL version 2 only include/sql_common.h: Changed header to GPL version 2 only include/sslopt-case.h: Changed header to GPL version 2 only include/sslopt-longopts.h: Changed header to GPL version 2 only include/sslopt-vars.h: Changed header to GPL version 2 only include/t_ctype.h: Changed header to GPL version 2 only include/thr_alarm.h: Changed header to GPL version 2 only include/thr_lock.h: Changed header to GPL version 2 only include/typelib.h: Changed header to GPL version 2 only include/violite.h: Changed header to GPL version 2 only innobase/Makefile.am: Changed header to GPL version 2 only innobase/btr/Makefile.am: Changed header to GPL version 2 only innobase/buf/Makefile.am: Changed header to GPL version 2 only innobase/data/Makefile.am: Changed header to GPL version 2 only innobase/dict/Makefile.am: Changed header to GPL version 2 only innobase/dyn/Makefile.am: Changed header to GPL version 2 only innobase/eval/Makefile.am: Changed header to GPL version 2 only innobase/fil/Makefile.am: Changed header to GPL version 2 only innobase/fsp/Makefile.am: Changed header to GPL version 2 only innobase/fut/Makefile.am: Changed header to GPL version 2 only innobase/ha/Makefile.am: Changed header to GPL version 2 only innobase/ibuf/Makefile.am: Changed header to GPL version 2 only innobase/include/Makefile.am: Changed header to GPL version 2 only innobase/lock/Makefile.am: Changed header to GPL version 2 only innobase/log/Makefile.am: Changed header to GPL version 2 only innobase/mach/Makefile.am: Changed header to GPL version 2 only innobase/mem/Makefile.am: Changed header to GPL version 2 only innobase/mtr/Makefile.am: Changed header to GPL version 2 only innobase/os/Makefile.am: Changed header to GPL version 2 only innobase/page/Makefile.am: Changed header to GPL version 2 only innobase/pars/Makefile.am: Changed header to GPL version 2 only innobase/que/Makefile.am: Changed header to GPL version 2 only innobase/read/Makefile.am: Changed header to GPL version 2 only innobase/rem/Makefile.am: Changed header to GPL version 2 only innobase/row/Makefile.am: Changed header to GPL version 2 only innobase/srv/Makefile.am: Changed header to GPL version 2 only innobase/sync/Makefile.am: Changed header to GPL version 2 only innobase/thr/Makefile.am: Changed header to GPL version 2 only innobase/trx/Makefile.am: Changed header to GPL version 2 only innobase/usr/Makefile.am: Changed header to GPL version 2 only innobase/ut/Makefile.am: Changed header to GPL version 2 only libmysql/client_settings.h: Changed header to GPL version 2 only libmysqld/Makefile.am: Changed header to GPL version 2 only libmysqld/emb_qcache.cc: Changed header to GPL version 2 only libmysqld/emb_qcache.h: Changed header to GPL version 2 only libmysqld/embedded_priv.h: Changed header to GPL version 2 only libmysqld/examples/Makefile.am: Changed header to GPL version 2 only libmysqld/libmysqld.c: Changed header to GPL version 2 only man/Makefile.am: Changed header to GPL version 2 only myisam/Makefile.am: Changed header to GPL version 2 only myisam/ft_boolean_search.c: Changed header to GPL version 2 only myisam/ft_eval.c: Changed header to GPL version 2 only myisam/ft_eval.h: Changed header to GPL version 2 only myisam/ft_nlq_search.c: Changed header to GPL version 2 only myisam/ft_parser.c: Changed header to GPL version 2 only myisam/ft_static.c: Changed header to GPL version 2 only myisam/ft_stem.c: Changed header to GPL version 2 only myisam/ft_stopwords.c: Changed header to GPL version 2 only myisam/ft_test1.c: Changed header to GPL version 2 only myisam/ft_test1.h: Changed header to GPL version 2 only myisam/ft_update.c: Changed header to GPL version 2 only myisam/ftdefs.h: Changed header to GPL version 2 only myisam/fulltext.h: Changed header to GPL version 2 only myisam/mi_cache.c: Changed header to GPL version 2 only myisam/mi_changed.c: Changed header to GPL version 2 only myisam/mi_check.c: Changed header to GPL version 2 only myisam/mi_checksum.c: Changed header to GPL version 2 only myisam/mi_close.c: Changed header to GPL version 2 only myisam/mi_create.c: Changed header to GPL version 2 only myisam/mi_dbug.c: Changed header to GPL version 2 only myisam/mi_delete.c: Changed header to GPL version 2 only myisam/mi_delete_all.c: Changed header to GPL version 2 only myisam/mi_delete_table.c: Changed header to GPL version 2 only myisam/mi_dynrec.c: Changed header to GPL version 2 only myisam/mi_extra.c: Changed header to GPL version 2 only myisam/mi_info.c: Changed header to GPL version 2 only myisam/mi_key.c: Changed header to GPL version 2 only myisam/mi_keycache.c: Changed header to GPL version 2 only myisam/mi_locking.c: Changed header to GPL version 2 only myisam/mi_log.c: Changed header to GPL version 2 only myisam/mi_open.c: Changed header to GPL version 2 only myisam/mi_packrec.c: Changed header to GPL version 2 only myisam/mi_page.c: Changed header to GPL version 2 only myisam/mi_panic.c: Changed header to GPL version 2 only myisam/mi_preload.c: Changed header to GPL version 2 only myisam/mi_range.c: Changed header to GPL version 2 only myisam/mi_rename.c: Changed header to GPL version 2 only myisam/mi_rfirst.c: Changed header to GPL version 2 only myisam/mi_rkey.c: Changed header to GPL version 2 only myisam/mi_rlast.c: Changed header to GPL version 2 only myisam/mi_rnext.c: Changed header to GPL version 2 only myisam/mi_rnext_same.c: Changed header to GPL version 2 only myisam/mi_rprev.c: Changed header to GPL version 2 only myisam/mi_rrnd.c: Changed header to GPL version 2 only myisam/mi_rsame.c: Changed header to GPL version 2 only myisam/mi_rsamepos.c: Changed header to GPL version 2 only myisam/mi_scan.c: Changed header to GPL version 2 only myisam/mi_search.c: Changed header to GPL version 2 only myisam/mi_static.c: Changed header to GPL version 2 only myisam/mi_statrec.c: Changed header to GPL version 2 only myisam/mi_test1.c: Changed header to GPL version 2 only myisam/mi_test2.c: Changed header to GPL version 2 only myisam/mi_test3.c: Changed header to GPL version 2 only myisam/mi_unique.c: Changed header to GPL version 2 only myisam/mi_update.c: Changed header to GPL version 2 only myisam/mi_write.c: Changed header to GPL version 2 only myisam/myisam_ftdump.c: Changed header to GPL version 2 only myisam/myisamchk.c: Changed header to GPL version 2 only myisam/myisamdef.h: Changed header to GPL version 2 only myisam/myisamlog.c: Changed header to GPL version 2 only myisam/myisampack.c: Changed header to GPL version 2 only myisam/rt_index.c: Changed header to GPL version 2 only myisam/rt_index.h: Changed header to GPL version 2 only myisam/rt_key.c: Changed header to GPL version 2 only myisam/rt_key.h: Changed header to GPL version 2 only myisam/rt_mbr.c: Changed header to GPL version 2 only myisam/rt_mbr.h: Changed header to GPL version 2 only myisam/rt_split.c: Changed header to GPL version 2 only myisam/rt_test.c: Changed header to GPL version 2 only myisam/sort.c: Changed header to GPL version 2 only myisam/sp_defs.h: Changed header to GPL version 2 only myisam/sp_key.c: Changed header to GPL version 2 only myisam/sp_test.c: Changed header to GPL version 2 only myisammrg/Makefile.am: Changed header to GPL version 2 only myisammrg/myrg_close.c: Changed header to GPL version 2 only myisammrg/myrg_create.c: Changed header to GPL version 2 only myisammrg/myrg_def.h: Changed header to GPL version 2 only myisammrg/myrg_delete.c: Changed header to GPL version 2 only myisammrg/myrg_extra.c: Changed header to GPL version 2 only myisammrg/myrg_info.c: Changed header to GPL version 2 only myisammrg/myrg_locking.c: Changed header to GPL version 2 only myisammrg/myrg_open.c: Changed header to GPL version 2 only myisammrg/myrg_panic.c: Changed header to GPL version 2 only myisammrg/myrg_queue.c: Changed header to GPL version 2 only myisammrg/myrg_range.c: Changed header to GPL version 2 only myisammrg/myrg_rfirst.c: Changed header to GPL version 2 only myisammrg/myrg_rkey.c: Changed header to GPL version 2 only myisammrg/myrg_rlast.c: Changed header to GPL version 2 only myisammrg/myrg_rnext.c: Changed header to GPL version 2 only myisammrg/myrg_rnext_same.c: Changed header to GPL version 2 only myisammrg/myrg_rprev.c: Changed header to GPL version 2 only myisammrg/myrg_rrnd.c: Changed header to GPL version 2 only myisammrg/myrg_rsame.c: Changed header to GPL version 2 only myisammrg/myrg_static.c: Changed header to GPL version 2 only myisammrg/myrg_update.c: Changed header to GPL version 2 only myisammrg/myrg_write.c: Changed header to GPL version 2 only mysql-test/Makefile.am: Changed header to GPL version 2 only mysys/Makefile.am: Changed header to GPL version 2 only mysys/array.c: Changed header to GPL version 2 only mysys/base64.c: Changed header to GPL version 2 only mysys/charset-def.c: Changed header to GPL version 2 only mysys/charset.c: Changed header to GPL version 2 only mysys/checksum.c: Changed header to GPL version 2 only mysys/default.c: Changed header to GPL version 2 only mysys/default_modify.c: Changed header to GPL version 2 only mysys/errors.c: Changed header to GPL version 2 only mysys/hash.c: Changed header to GPL version 2 only mysys/list.c: Changed header to GPL version 2 only mysys/make-conf.c: Changed header to GPL version 2 only mysys/md5.c: Changed header to GPL version 2 only mysys/mf_brkhant.c: Changed header to GPL version 2 only mysys/mf_cache.c: Changed header to GPL version 2 only mysys/mf_dirname.c: Changed header to GPL version 2 only mysys/mf_fn_ext.c: Changed header to GPL version 2 only mysys/mf_format.c: Changed header to GPL version 2 only mysys/mf_getdate.c: Changed header to GPL version 2 only mysys/mf_iocache.c: Changed header to GPL version 2 only mysys/mf_iocache2.c: Changed header to GPL version 2 only mysys/mf_keycache.c: Changed header to GPL version 2 only mysys/mf_keycaches.c: Changed header to GPL version 2 only mysys/mf_loadpath.c: Changed header to GPL version 2 only mysys/mf_pack.c: Changed header to GPL version 2 only mysys/mf_path.c: Changed header to GPL version 2 only mysys/mf_qsort.c: Changed header to GPL version 2 only mysys/mf_qsort2.c: Changed header to GPL version 2 only mysys/mf_radix.c: Changed header to GPL version 2 only mysys/mf_same.c: Changed header to GPL version 2 only mysys/mf_sort.c: Changed header to GPL version 2 only mysys/mf_soundex.c: Changed header to GPL version 2 only mysys/mf_strip.c: Changed header to GPL version 2 only mysys/mf_tempdir.c: Changed header to GPL version 2 only mysys/mf_tempfile.c: Changed header to GPL version 2 only mysys/mf_unixpath.c: Changed header to GPL version 2 only mysys/mf_util.c: Changed header to GPL version 2 only mysys/mf_wcomp.c: Changed header to GPL version 2 only mysys/mf_wfile.c: Changed header to GPL version 2 only mysys/mulalloc.c: Changed header to GPL version 2 only mysys/my_access.c: Changed header to GPL version 2 only mysys/my_aes.c: Changed header to GPL version 2 only mysys/my_alarm.c: Changed header to GPL version 2 only mysys/my_alloc.c: Changed header to GPL version 2 only mysys/my_append.c: Changed header to GPL version 2 only mysys/my_bit.c: Changed header to GPL version 2 only mysys/my_bitmap.c: Changed header to GPL version 2 only mysys/my_chsize.c: Changed header to GPL version 2 only mysys/my_clock.c: Changed header to GPL version 2 only mysys/my_compress.c: Changed header to GPL version 2 only mysys/my_conio.c: Changed header to GPL version 2 only mysys/my_copy.c: Changed header to GPL version 2 only mysys/my_crc32.c: Changed header to GPL version 2 only mysys/my_create.c: Changed header to GPL version 2 only mysys/my_delete.c: Changed header to GPL version 2 only mysys/my_div.c: Changed header to GPL version 2 only mysys/my_dup.c: Changed header to GPL version 2 only mysys/my_error.c: Changed header to GPL version 2 only mysys/my_file.c: Changed header to GPL version 2 only mysys/my_fopen.c: Changed header to GPL version 2 only mysys/my_fstream.c: Changed header to GPL version 2 only mysys/my_gethostbyname.c: Changed header to GPL version 2 only mysys/my_gethwaddr.c: Changed header to GPL version 2 only mysys/my_getopt.c: Changed header to GPL version 2 only mysys/my_getpagesize.c: Changed header to GPL version 2 only mysys/my_getsystime.c: Changed header to GPL version 2 only mysys/my_getwd.c: Changed header to GPL version 2 only mysys/my_handler.c: Changed header to GPL version 2 only mysys/my_init.c: Changed header to GPL version 2 only mysys/my_largepage.c: Changed header to GPL version 2 only mysys/my_lib.c: Changed header to GPL version 2 only mysys/my_libwrap.c: Changed header to GPL version 2 only mysys/my_lock.c: Changed header to GPL version 2 only mysys/my_lockmem.c: Changed header to GPL version 2 only mysys/my_lread.c: Changed header to GPL version 2 only mysys/my_lwrite.c: Changed header to GPL version 2 only mysys/my_malloc.c: Changed header to GPL version 2 only mysys/my_messnc.c: Changed header to GPL version 2 only mysys/my_mkdir.c: Changed header to GPL version 2 only mysys/my_mmap.c: Changed header to GPL version 2 only mysys/my_net.c: Changed header to GPL version 2 only mysys/my_netware.c: Changed header to GPL version 2 only mysys/my_new.cc: Changed header to GPL version 2 only mysys/my_once.c: Changed header to GPL version 2 only mysys/my_open.c: Changed header to GPL version 2 only mysys/my_os2cond.c: Changed header to GPL version 2 only mysys/my_os2dirsrch.c: Changed header to GPL version 2 only mysys/my_os2dirsrch.h: Changed header to GPL version 2 only mysys/my_os2dlfcn.c: Changed header to GPL version 2 only mysys/my_os2dlfcn.h0: Changed header to GPL version 2 only mysys/my_os2file64.c: Changed header to GPL version 2 only mysys/my_os2thread.c: Changed header to GPL version 2 only mysys/my_os2tls.c: Changed header to GPL version 2 only mysys/my_port.c: Changed header to GPL version 2 only mysys/my_pread.c: Changed header to GPL version 2 only mysys/my_pthread.c: Changed header to GPL version 2 only mysys/my_quick.c: Changed header to GPL version 2 only mysys/my_read.c: Changed header to GPL version 2 only mysys/my_realloc.c: Changed header to GPL version 2 only mysys/my_redel.c: Changed header to GPL version 2 only mysys/my_rename.c: Changed header to GPL version 2 only mysys/my_seek.c: Changed header to GPL version 2 only mysys/my_semaphore.c: Changed header to GPL version 2 only mysys/my_sleep.c: Changed header to GPL version 2 only mysys/my_static.c: Changed header to GPL version 2 only mysys/my_static.h: Changed header to GPL version 2 only mysys/my_symlink.c: Changed header to GPL version 2 only mysys/my_symlink2.c: Changed header to GPL version 2 only mysys/my_sync.c: Changed header to GPL version 2 only mysys/my_thr_init.c: Changed header to GPL version 2 only mysys/my_wincond.c: Changed header to GPL version 2 only mysys/my_windac.c: Changed header to GPL version 2 only mysys/my_winthread.c: Changed header to GPL version 2 only mysys/my_write.c: Changed header to GPL version 2 only mysys/mysys_priv.h: Changed header to GPL version 2 only mysys/ptr_cmp.c: Changed header to GPL version 2 only mysys/queues.c: Changed header to GPL version 2 only mysys/raid.cc: Changed header to GPL version 2 only mysys/raid2.c: Changed header to GPL version 2 only mysys/rijndael.c: Changed header to GPL version 2 only mysys/safemalloc.c: Changed header to GPL version 2 only mysys/sha1.c: Changed header to GPL version 2 only mysys/string.c: Changed header to GPL version 2 only mysys/test_charset.c: Changed header to GPL version 2 only mysys/test_dir.c: Changed header to GPL version 2 only mysys/test_fn.c: Changed header to GPL version 2 only mysys/test_xml.c: Changed header to GPL version 2 only mysys/testhash.c: Changed header to GPL version 2 only mysys/thr_alarm.c: Changed header to GPL version 2 only mysys/thr_lock.c: Changed header to GPL version 2 only mysys/thr_mutex.c: Changed header to GPL version 2 only mysys/thr_rwlock.c: Changed header to GPL version 2 only mysys/tree.c: Changed header to GPL version 2 only mysys/typelib.c: Changed header to GPL version 2 only ndb/include/debugger/DebuggerNames.hpp: Changed header to GPL version 2 only ndb/include/debugger/EventLogger.hpp: Changed header to GPL version 2 only ndb/include/debugger/GrepError.hpp: Changed header to GPL version 2 only ndb/include/debugger/SignalLoggerManager.hpp: Changed header to GPL version 2 only ndb/include/editline/editline.h: Changed header to GPL version 2 only ndb/include/kernel/AttributeDescriptor.hpp: Changed header to GPL version 2 only ndb/include/kernel/AttributeHeader.hpp: Changed header to GPL version 2 only ndb/include/kernel/AttributeList.hpp: Changed header to GPL version 2 only ndb/include/kernel/BlockNumbers.h: Changed header to GPL version 2 only ndb/include/kernel/GlobalSignalNumbers.h: Changed header to GPL version 2 only ndb/include/kernel/GrepEvent.hpp: Changed header to GPL version 2 only ndb/include/kernel/Interpreter.hpp: Changed header to GPL version 2 only ndb/include/kernel/LogLevel.hpp: Changed header to GPL version 2 only ndb/include/kernel/NodeBitmask.hpp: Changed header to GPL version 2 only ndb/include/kernel/NodeInfo.hpp: Changed header to GPL version 2 only ndb/include/kernel/NodeState.hpp: Changed header to GPL version 2 only ndb/include/kernel/RefConvert.hpp: Changed header to GPL version 2 only ndb/include/kernel/kernel_types.h: Changed header to GPL version 2 only ndb/include/kernel/ndb_limits.h: Changed header to GPL version 2 only ndb/include/kernel/signaldata/AbortAll.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/AccFrag.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/AccLock.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/AccScan.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/AccSizeAltReq.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/AlterIndx.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/AlterTab.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/AlterTable.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/AlterTrig.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/ApiBroadcast.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/ApiRegSignalData.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/ApiVersion.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/ArbitSignalData.hpp: Changed header to GPL version 2 only ndb/include/kernel/trigger_definitions.h: Changed header to GPL version 2 only ndb/include/ndb_constants.h: Changed header to GPL version 2 only ndb/include/ndb_global.h.in: Changed header to GPL version 2 only ndb/include/ndb_init.h: Changed header to GPL version 2 only ndb/include/ndb_types.h.in: Changed header to GPL version 2 only ndb/include/ndb_version.h.in: Changed header to GPL version 2 only ndb/include/kernel/signaldata/AttrInfo.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/BackupContinueB.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/BackupImpl.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/BackupSignalData.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/BlockCommitOrd.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/BuildIndx.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/CheckNodeGroups.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/CloseComReqConf.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/CmInit.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/CmRegSignalData.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/CmvmiCfgConf.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/CntrMasterConf.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/CntrMasterReq.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/ConfigParamId.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/ContinueFragmented.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/CopyActive.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/CopyFrag.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/CopyGCIReq.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/CreateEvnt.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/CreateFrag.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/CreateFragmentation.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/CreateIndx.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/CreateTab.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/CreateTable.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/CreateTrig.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/DiAddTab.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/DiGetNodes.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/DictLock.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/DictSchemaInfo.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/DictSizeAltReq.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/DictStart.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/DictTabInfo.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/DihAddFrag.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/DihContinueB.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/DihSizeAltReq.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/DihStartTab.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/DihSwitchReplica.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/DisconnectRep.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/DropIndx.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/DropTab.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/DropTabFile.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/DropTable.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/DropTrig.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/DumpStateOrd.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/EmptyLcp.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/EndTo.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/EventReport.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/EventSubscribeReq.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/ExecFragReq.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/FailRep.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/FireTrigOrd.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/FsAppendReq.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/FsCloseReq.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/FsConf.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/FsOpenReq.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/FsReadWriteReq.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/FsRef.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/FsRemoveReq.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/GCPSave.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/GetTabInfo.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/GetTableId.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/GrepImpl.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/HotSpareRep.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/IndxAttrInfo.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/IndxKeyInfo.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/InvalidateNodeLCPConf.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/InvalidateNodeLCPReq.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/KeyInfo.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/LCP.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/ListTables.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/LqhFrag.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/LqhKey.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/LqhSizeAltReq.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/LqhTransConf.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/ManagementServer.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/MasterGCP.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/MasterLCP.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/NFCompleteRep.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/NdbSttor.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/NdbfsContinueB.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/NextScan.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/NodeFailRep.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/NodeStateSignalData.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/PackedSignal.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/PrepDropTab.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/PrepFailReqRef.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/ReadNodesConf.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/RelTabMem.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/RepImpl.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/ResumeReq.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/ScanFrag.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/ScanTab.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/SetLogLevelOrd.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/SetVarReq.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/SignalData.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/SignalDataPrint.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/SignalDroppedRep.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/SrFragidConf.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/StartFragReq.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/StartInfo.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/StartMe.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/StartOrd.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/StartPerm.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/StartRec.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/StartTo.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/StopMe.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/StopPerm.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/StopReq.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/SumaImpl.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/SystemError.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/TamperOrd.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/TcCommit.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/TcContinueB.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/TcHbRep.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/TcIndx.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/TcKeyConf.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/TcKeyFailConf.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/TcKeyRef.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/TcKeyReq.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/TcRollbackRep.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/TcSizeAltReq.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/TestOrd.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/TransIdAI.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/TrigAttrInfo.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/TupCommit.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/TupFrag.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/TupKey.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/TupSizeAltReq.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/TuxBound.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/TuxContinueB.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/TuxMaint.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/TuxSizeAltReq.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/UpdateTo.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/UtilDelete.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/UtilExecute.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/UtilLock.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/UtilPrepare.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/UtilRelease.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/UtilSequence.hpp: Changed header to GPL version 2 only ndb/include/kernel/signaldata/WaitGCP.hpp: Changed header to GPL version 2 only ndb/include/logger/ConsoleLogHandler.hpp: Changed header to GPL version 2 only ndb/include/logger/FileLogHandler.hpp: Changed header to GPL version 2 only ndb/include/logger/LogHandler.hpp: Changed header to GPL version 2 only ndb/include/logger/Logger.hpp: Changed header to GPL version 2 only ndb/include/logger/SysLogHandler.hpp: Changed header to GPL version 2 only ndb/include/mgmapi/mgmapi.h: Changed header to GPL version 2 only ndb/include/mgmapi/mgmapi_debug.h: Changed header to GPL version 2 only ndb/include/mgmapi/ndb_logevent.h: Changed header to GPL version 2 only ndb/include/mgmapi/ndbd_exit_codes.h: Changed header to GPL version 2 only ndb/include/mgmcommon/ConfigRetriever.hpp: Changed header to GPL version 2 only ndb/include/mgmcommon/IPCConfig.hpp: Changed header to GPL version 2 only ndb/include/mgmcommon/MgmtErrorReporter.hpp: Changed header to GPL version 2 only ndb/include/ndbapi/Ndb.hpp: Changed header to GPL version 2 only ndb/include/ndbapi/NdbApi.hpp: Changed header to GPL version 2 only ndb/include/ndbapi/NdbBlob.hpp: Changed header to GPL version 2 only ndb/include/ndbapi/NdbDictionary.hpp: Changed header to GPL version 2 only ndb/include/ndbapi/NdbError.hpp: Changed header to GPL version 2 only ndb/include/ndbapi/NdbEventOperation.hpp: Changed header to GPL version 2 only ndb/include/ndbapi/NdbIndexOperation.hpp: Changed header to GPL version 2 only ndb/include/ndbapi/NdbIndexScanOperation.hpp: Changed header to GPL version 2 only ndb/include/ndbapi/NdbOperation.hpp: Changed header to GPL version 2 only ndb/include/ndbapi/NdbPool.hpp: Changed header to GPL version 2 only ndb/include/ndbapi/NdbRecAttr.hpp: Changed header to GPL version 2 only ndb/include/ndbapi/NdbReceiver.hpp: Changed header to GPL version 2 only ndb/include/ndbapi/NdbScanFilter.hpp: Changed header to GPL version 2 only ndb/include/ndbapi/NdbScanOperation.hpp: Changed header to GPL version 2 only ndb/include/ndbapi/NdbTransaction.hpp: Changed header to GPL version 2 only ndb/include/ndbapi/ndb_cluster_connection.hpp: Changed header to GPL version 2 only ndb/include/ndbapi/ndb_opt_defaults.h: Changed header to GPL version 2 only ndb/include/ndbapi/ndbapi_limits.h: Changed header to GPL version 2 only ndb/include/ndbapi/ndberror.h: Changed header to GPL version 2 only ndb/include/newtonapi/dba.h: Changed header to GPL version 2 only ndb/include/newtonapi/defs/pcn_types.h: Changed header to GPL version 2 only ndb/include/portlib/NdbCondition.h: Changed header to GPL version 2 only ndb/include/portlib/NdbConfig.h: Changed header to GPL version 2 only ndb/include/portlib/NdbDaemon.h: Changed header to GPL version 2 only ndb/include/portlib/NdbEnv.h: Changed header to GPL version 2 only ndb/include/portlib/NdbHost.h: Changed header to GPL version 2 only ndb/include/portlib/NdbMain.h: Changed header to GPL version 2 only ndb/include/portlib/NdbMem.h: Changed header to GPL version 2 only ndb/include/portlib/NdbMutex.h: Changed header to GPL version 2 only ndb/include/portlib/NdbSleep.h: Changed header to GPL version 2 only ndb/include/portlib/NdbTCP.h: Changed header to GPL version 2 only ndb/include/portlib/NdbThread.h: Changed header to GPL version 2 only ndb/include/portlib/NdbTick.h: Changed header to GPL version 2 only ndb/include/portlib/PortDefs.h: Changed header to GPL version 2 only ndb/include/portlib/prefetch.h: Changed header to GPL version 2 only ndb/include/transporter/TransporterCallback.hpp: Changed header to GPL version 2 only ndb/include/transporter/TransporterDefinitions.hpp: Changed header to GPL version 2 only ndb/include/transporter/TransporterRegistry.hpp: Changed header to GPL version 2 only ndb/include/util/BaseString.hpp: Changed header to GPL version 2 only ndb/include/util/Bitmask.hpp: Changed header to GPL version 2 only ndb/include/util/File.hpp: Changed header to GPL version 2 only ndb/include/util/InputStream.hpp: Changed header to GPL version 2 only ndb/include/util/NdbAutoPtr.hpp: Changed header to GPL version 2 only ndb/include/util/NdbOut.hpp: Changed header to GPL version 2 only ndb/include/util/NdbSqlUtil.hpp: Changed header to GPL version 2 only ndb/include/util/OutputStream.hpp: Changed header to GPL version 2 only ndb/include/util/Parser.hpp: Changed header to GPL version 2 only ndb/include/util/Properties.hpp: Changed header to GPL version 2 only ndb/include/util/SimpleProperties.hpp: Changed header to GPL version 2 only ndb/include/util/SocketAuthenticator.hpp: Changed header to GPL version 2 only ndb/include/util/SocketClient.hpp: Changed header to GPL version 2 only ndb/include/util/SocketServer.hpp: Changed header to GPL version 2 only ndb/include/util/UtilBuffer.hpp: Changed header to GPL version 2 only ndb/include/util/Vector.hpp: Changed header to GPL version 2 only ndb/include/util/basestring_vsnprintf.h: Changed header to GPL version 2 only ndb/include/util/md5_hash.hpp: Changed header to GPL version 2 only ndb/include/util/ndb_opts.h: Changed header to GPL version 2 only ndb/include/util/random.h: Changed header to GPL version 2 only ndb/include/util/socket_io.h: Changed header to GPL version 2 only ndb/include/util/uucode.h: Changed header to GPL version 2 only ndb/include/util/version.h: Changed header to GPL version 2 only ndb/ndbapi-examples/mgmapi_logevent_example/mgmapi_logevent.cpp: Changed header to GPL version 2 only ndb/ndbapi-examples/ndbapi_async_example/ndbapi_async.cpp: Changed header to GPL version 2 only ndb/ndbapi-examples/ndbapi_async_example1/ndbapi_async1.cpp: Changed header to GPL version 2 only ndb/ndbapi-examples/ndbapi_event_example/ndbapi_event.cpp: Changed header to GPL version 2 only ndb/ndbapi-examples/ndbapi_retries_example/ndbapi_retries.cpp: Changed header to GPL version 2 only ndb/ndbapi-examples/ndbapi_scan_example/ndbapi_scan.cpp: Changed header to GPL version 2 only ndb/ndbapi-examples/ndbapi_simple_example/ndbapi_simple.cpp: Changed header to GPL version 2 only ndb/ndbapi-examples/ndbapi_simple_index_example/ndbapi_simple_index.cpp: Changed header to GPL version 2 only ndb/src/common/debugger/BlockNames.cpp: Changed header to GPL version 2 only ndb/src/common/debugger/DebuggerNames.cpp: Changed header to GPL version 2 only ndb/src/common/debugger/EventLogger.cpp: Changed header to GPL version 2 only ndb/src/common/debugger/GrepError.cpp: Changed header to GPL version 2 only ndb/src/common/debugger/SignalLoggerManager.cpp: Changed header to GPL version 2 only ndb/src/common/debugger/signaldata/AccLock.cpp: Changed header to GPL version 2 only ndb/src/common/debugger/signaldata/AlterIndx.cpp: Changed header to GPL version 2 only ndb/src/common/debugger/signaldata/AlterTab.cpp: Changed header to GPL version 2 only ndb/src/common/debugger/signaldata/AlterTable.cpp: Changed header to GPL version 2 only ndb/src/common/debugger/signaldata/AlterTrig.cpp: Changed header to GPL version 2 only ndb/src/common/debugger/signaldata/BackupImpl.cpp: Changed header to GPL version 2 only ndb/src/common/debugger/signaldata/BackupSignalData.cpp: Changed header to GPL version 2 only ndb/src/common/debugger/signaldata/CloseComReqConf.cpp: Changed header to GPL version 2 only ndb/src/common/debugger/signaldata/ContinueB.cpp: Changed header to GPL version 2 only ndb/src/common/debugger/signaldata/CopyGCI.cpp: Changed header to GPL version 2 only ndb/src/common/debugger/signaldata/CreateEvnt.cpp: Changed header to GPL version 2 only ndb/src/common/debugger/signaldata/CreateFragmentation.cpp: Changed header to GPL version 2 only ndb/src/common/debugger/signaldata/CreateIndx.cpp: Changed header to GPL version 2 only ndb/src/common/debugger/signaldata/CreateTrig.cpp: Changed header to GPL version 2 only ndb/src/common/debugger/signaldata/DictTabInfo.cpp: Changed header to GPL version 2 only ndb/src/common/debugger/signaldata/DihContinueB.cpp: Changed header to GPL version 2 only ndb/src/common/debugger/signaldata/DihSwitchReplicaReq.cpp: Changed header to GPL version 2 only ndb/src/common/debugger/signaldata/DisconnectRep.cpp: Changed header to GPL version 2 only ndb/src/common/debugger/signaldata/DropIndx.cpp: Changed header to GPL version 2 only ndb/src/common/debugger/signaldata/DropTab.cpp: Changed header to GPL version 2 only ndb/src/common/debugger/signaldata/DropTrig.cpp: Changed header to GPL version 2 only ndb/src/common/debugger/signaldata/FailRep.cpp: Changed header to GPL version 2 only ndb/src/common/debugger/signaldata/FireTrigOrd.cpp: Changed header to GPL version 2 only ndb/src/common/debugger/signaldata/FsAppendReq.cpp: Changed header to GPL version 2 only ndb/src/common/debugger/signaldata/FsCloseReq.cpp: Changed header to GPL version 2 only ndb/src/common/debugger/signaldata/FsConf.cpp: Changed header to GPL version 2 only ndb/src/common/debugger/signaldata/FsOpenReq.cpp: Changed header to GPL version 2 only ndb/src/common/debugger/signaldata/FsReadWriteReq.cpp: Changed header to GPL version 2 only ndb/src/common/debugger/signaldata/FsRef.cpp: Changed header to GPL version 2 only ndb/src/common/debugger/signaldata/GCPSave.cpp: Changed header to GPL version 2 only ndb/src/common/debugger/signaldata/IndxAttrInfo.cpp: Changed header to GPL version 2 only ndb/src/common/debugger/signaldata/IndxKeyInfo.cpp: Changed header to GPL version 2 only ndb/src/common/debugger/signaldata/LCP.cpp: Changed header to GPL version 2 only ndb/src/common/debugger/signaldata/LqhFrag.cpp: Changed header to GPL version 2 only ndb/src/common/debugger/signaldata/LqhKey.cpp: Changed header to GPL version 2 only ndb/src/common/debugger/signaldata/LqhTrans.cpp: Changed header to GPL version 2 only ndb/src/common/debugger/signaldata/MasterLCP.cpp: Changed header to GPL version 2 only ndb/src/common/debugger/signaldata/NFCompleteRep.cpp: Changed header to GPL version 2 only ndb/src/common/debugger/signaldata/NdbSttor.cpp: Changed header to GPL version 2 only ndb/src/common/debugger/signaldata/NdbfsContinueB.cpp: Changed header to GPL version 2 only ndb/src/common/debugger/signaldata/PackedSignal.cpp: Changed header to GPL version 2 only ndb/src/common/debugger/signaldata/PrepDropTab.cpp: Changed header to GPL version 2 only ndb/src/common/debugger/signaldata/PrepFailReqRef.cpp: Changed header to GPL version 2 only ndb/src/common/debugger/signaldata/ScanFrag.cpp: Changed header to GPL version 2 only ndb/src/common/debugger/signaldata/ScanTab.cpp: Changed header to GPL version 2 only ndb/src/common/debugger/signaldata/SignalDataPrint.cpp: Changed header to GPL version 2 only ndb/src/common/debugger/signaldata/SignalDroppedRep.cpp: Changed header to GPL version 2 only ndb/src/common/debugger/signaldata/SignalNames.cpp: Changed header to GPL version 2 only ndb/src/common/debugger/signaldata/StartRec.cpp: Changed header to GPL version 2 only ndb/src/common/debugger/signaldata/SumaImpl.cpp: Changed header to GPL version 2 only ndb/src/common/debugger/signaldata/SystemError.cpp: Changed header to GPL version 2 only ndb/src/common/debugger/signaldata/TcIndx.cpp: Changed header to GPL version 2 only ndb/src/common/debugger/signaldata/TcKeyConf.cpp: Changed header to GPL version 2 only ndb/src/common/debugger/signaldata/TcKeyRef.cpp: Changed header to GPL version 2 only ndb/src/common/debugger/signaldata/TcKeyReq.cpp: Changed header to GPL version 2 only ndb/src/common/debugger/signaldata/TcRollbackRep.cpp: Changed header to GPL version 2 only ndb/src/common/debugger/signaldata/TrigAttrInfo.cpp: Changed header to GPL version 2 only ndb/src/common/debugger/signaldata/TupCommit.cpp: Changed header to GPL version 2 only ndb/src/common/debugger/signaldata/TupKey.cpp: Changed header to GPL version 2 only ndb/src/common/debugger/signaldata/TuxMaint.cpp: Changed header to GPL version 2 only ndb/src/common/debugger/signaldata/UtilDelete.cpp: Changed header to GPL version 2 only ndb/src/common/debugger/signaldata/UtilExecute.cpp: Changed header to GPL version 2 only ndb/src/common/debugger/signaldata/UtilLock.cpp: Changed header to GPL version 2 only ndb/src/common/debugger/signaldata/UtilPrepare.cpp: Changed header to GPL version 2 only ndb/src/common/debugger/signaldata/UtilSequence.cpp: Changed header to GPL version 2 only ndb/src/common/logger/ConsoleLogHandler.cpp: Changed header to GPL version 2 only ndb/src/common/logger/FileLogHandler.cpp: Changed header to GPL version 2 only ndb/src/common/logger/LogHandler.cpp: Changed header to GPL version 2 only ndb/src/common/logger/LogHandlerList.cpp: Changed header to GPL version 2 only ndb/src/common/logger/LogHandlerList.hpp: Changed header to GPL version 2 only ndb/src/common/logger/Logger.cpp: Changed header to GPL version 2 only ndb/src/common/logger/SysLogHandler.cpp: Changed header to GPL version 2 only ndb/src/common/logger/listtest/LogHandlerListUnitTest.cpp: Changed header to GPL version 2 only ndb/src/common/logger/listtest/LogHandlerListUnitTest.hpp: Changed header to GPL version 2 only ndb/src/common/logger/loggertest/LoggerUnitTest.cpp: Changed header to GPL version 2 only ndb/src/common/logger/loggertest/LoggerUnitTest.hpp: Changed header to GPL version 2 only ndb/src/common/mgmcommon/ConfigRetriever.cpp: Changed header to GPL version 2 only ndb/src/common/mgmcommon/IPCConfig.cpp: Changed header to GPL version 2 only ndb/src/common/mgmcommon/printConfig/printConfig.cpp: Changed header to GPL version 2 only ndb/src/common/portlib/NdbCondition.c: Changed header to GPL version 2 only ndb/src/common/portlib/NdbConfig.c: Changed header to GPL version 2 only ndb/src/common/portlib/NdbDaemon.c: Changed header to GPL version 2 only ndb/src/common/portlib/NdbEnv.c: Changed header to GPL version 2 only ndb/src/common/portlib/NdbHost.c: Changed header to GPL version 2 only ndb/src/common/portlib/NdbMem.c: Changed header to GPL version 2 only ndb/src/common/portlib/NdbMutex.c: Changed header to GPL version 2 only ndb/src/common/portlib/NdbPortLibTest.cpp: Changed header to GPL version 2 only ndb/src/common/portlib/NdbSleep.c: Changed header to GPL version 2 only ndb/src/common/portlib/NdbTCP.cpp: Changed header to GPL version 2 only ndb/src/common/portlib/NdbThread.c: Changed header to GPL version 2 only ndb/src/common/portlib/NdbTick.c: Changed header to GPL version 2 only ndb/src/common/portlib/memtest.c: Changed header to GPL version 2 only ndb/src/common/portlib/mmslist.cpp: Changed header to GPL version 2 only ndb/src/common/portlib/mmstest.cpp: Changed header to GPL version 2 only ndb/src/common/portlib/munmaptest.cpp: Changed header to GPL version 2 only ndb/src/common/portlib/old_dirs/ose/NdbCondition.c: Changed header to GPL version 2 only ndb/src/common/portlib/old_dirs/ose/NdbConditionOSE.h: Changed header to GPL version 2 only ndb/src/common/portlib/old_dirs/ose/NdbEnv.c: Changed header to GPL version 2 only ndb/src/common/portlib/old_dirs/ose/NdbHost.c: Changed header to GPL version 2 only ndb/src/common/portlib/old_dirs/ose/NdbMem.c: Changed header to GPL version 2 only ndb/src/common/portlib/old_dirs/ose/NdbMem_SoftOse.cpp: Changed header to GPL version 2 only ndb/src/common/portlib/old_dirs/ose/NdbMutex.c: Changed header to GPL version 2 only ndb/src/common/portlib/old_dirs/ose/NdbOut.cpp: Changed header to GPL version 2 only ndb/src/common/portlib/old_dirs/ose/NdbSleep.c: Changed header to GPL version 2 only ndb/src/common/portlib/old_dirs/ose/NdbTCP.c: Changed header to GPL version 2 only ndb/src/common/portlib/old_dirs/ose/NdbThread.c: Changed header to GPL version 2 only ndb/src/common/portlib/old_dirs/ose/NdbTick.c: Changed header to GPL version 2 only ndb/src/common/portlib/old_dirs/win32/NdbCondition.c: Changed header to GPL version 2 only ndb/src/common/portlib/old_dirs/win32/NdbDaemon.c: Changed header to GPL version 2 only ndb/src/common/portlib/old_dirs/win32/NdbEnv.c: Changed header to GPL version 2 only ndb/src/common/portlib/old_dirs/win32/NdbHost.c: Changed header to GPL version 2 only ndb/src/common/portlib/old_dirs/win32/NdbMem.c: Changed header to GPL version 2 only ndb/src/common/portlib/old_dirs/win32/NdbMutex.c: Changed header to GPL version 2 only ndb/src/common/portlib/old_dirs/win32/NdbSleep.c: Changed header to GPL version 2 only ndb/src/common/portlib/old_dirs/win32/NdbTCP.c: Changed header to GPL version 2 only ndb/src/common/portlib/old_dirs/win32/NdbThread.c: Changed header to GPL version 2 only ndb/src/common/portlib/old_dirs/win32/NdbTick.c: Changed header to GPL version 2 only ndb/src/common/portlib/win32/NdbCondition.c: Changed header to GPL version 2 only ndb/src/common/portlib/win32/NdbDaemon.c: Changed header to GPL version 2 only ndb/src/common/portlib/win32/NdbEnv.c: Changed header to GPL version 2 only ndb/src/common/portlib/win32/NdbHost.c: Changed header to GPL version 2 only ndb/src/common/portlib/win32/NdbMem.c: Changed header to GPL version 2 only ndb/src/common/portlib/win32/NdbMutex.c: Changed header to GPL version 2 only ndb/src/common/portlib/win32/NdbSleep.c: Changed header to GPL version 2 only ndb/src/common/portlib/win32/NdbTCP.c: Changed header to GPL version 2 only ndb/src/common/portlib/win32/NdbThread.c: Changed header to GPL version 2 only ndb/src/common/portlib/win32/NdbTick.c: Changed header to GPL version 2 only ndb/src/common/transporter/OSE_Receiver.cpp: Changed header to GPL version 2 only ndb/src/common/transporter/OSE_Receiver.hpp: Changed header to GPL version 2 only ndb/src/common/transporter/OSE_Signals.hpp: Changed header to GPL version 2 only ndb/src/common/transporter/OSE_Transporter.cpp: Changed header to GPL version 2 only ndb/src/common/transporter/OSE_Transporter.hpp: Changed header to GPL version 2 only ndb/src/common/transporter/Packer.cpp: Changed header to GPL version 2 only ndb/src/common/transporter/Packer.hpp: Changed header to GPL version 2 only ndb/src/common/transporter/SCI_Transporter.cpp: Changed header to GPL version 2 only ndb/src/common/transporter/SCI_Transporter.hpp: Changed header to GPL version 2 only ndb/src/common/transporter/SHM_Buffer.hpp: Changed header to GPL version 2 only ndb/src/common/transporter/SHM_Transporter.cpp: Changed header to GPL version 2 only ndb/src/common/transporter/SHM_Transporter.hpp: Changed header to GPL version 2 only ndb/src/common/transporter/SHM_Transporter.unix.cpp: Changed header to GPL version 2 only ndb/src/common/transporter/SHM_Transporter.win32.cpp: Changed header to GPL version 2 only ndb/src/common/transporter/SendBuffer.cpp: Changed header to GPL version 2 only ndb/src/common/transporter/SendBuffer.hpp: Changed header to GPL version 2 only ndb/src/common/transporter/TCP_Transporter.cpp: Changed header to GPL version 2 only ndb/src/common/transporter/TCP_Transporter.hpp: Changed header to GPL version 2 only ndb/src/common/transporter/Transporter.cpp: Changed header to GPL version 2 only ndb/src/common/transporter/Transporter.hpp: Changed header to GPL version 2 only ndb/src/common/transporter/TransporterInternalDefinitions.hpp: Changed header to GPL version 2 only ndb/src/common/transporter/TransporterRegistry.cpp: Changed header to GPL version 2 only ndb/src/common/transporter/basictest/basicTransporterTest.cpp: Changed header to GPL version 2 only ndb/src/common/transporter/buddy.cpp: Changed header to GPL version 2 only ndb/src/common/transporter/buddy.hpp: Changed header to GPL version 2 only ndb/src/common/transporter/failoverSCI/failoverSCI.cpp: Changed header to GPL version 2 only ndb/src/common/transporter/perftest/perfTransporterTest.cpp: Changed header to GPL version 2 only ndb/src/common/transporter/priotest/prioSCI/prioSCI.cpp: Changed header to GPL version 2 only ndb/src/common/transporter/priotest/prioSHM/prioSHM.cpp: Changed header to GPL version 2 only ndb/src/common/transporter/priotest/prioTCP/prioTCP.cpp: Changed header to GPL version 2 only ndb/src/common/transporter/priotest/prioTransporterTest.cpp: Changed header to GPL version 2 only ndb/src/common/transporter/priotest/prioTransporterTest.hpp: Changed header to GPL version 2 only ndb/src/common/util/BaseString.cpp: Changed header to GPL version 2 only ndb/src/common/util/File.cpp: Changed header to GPL version 2 only ndb/src/common/util/InputStream.cpp: Changed header to GPL version 2 only ndb/src/common/util/NdbErrHnd.cpp: Changed header to GPL version 2 only ndb/src/common/util/NdbOut.cpp: Changed header to GPL version 2 only ndb/src/common/util/NdbSqlUtil.cpp: Changed header to GPL version 2 only ndb/src/common/util/OutputStream.cpp: Changed header to GPL version 2 only ndb/src/common/util/Parser.cpp: Changed header to GPL version 2 only ndb/src/common/util/Properties.cpp: Changed header to GPL version 2 only ndb/src/common/util/SimpleProperties.cpp: Changed header to GPL version 2 only ndb/src/common/util/SocketAuthenticator.cpp: Changed header to GPL version 2 only ndb/src/common/util/SocketClient.cpp: Changed header to GPL version 2 only ndb/src/common/util/SocketServer.cpp: Changed header to GPL version 2 only ndb/src/common/util/basestring_vsnprintf.c: Changed header to GPL version 2 only ndb/src/common/util/filetest/FileUnitTest.cpp: Changed header to GPL version 2 only ndb/src/common/util/filetest/FileUnitTest.hpp: Changed header to GPL version 2 only ndb/src/common/util/md5_hash.cpp: Changed header to GPL version 2 only ndb/src/common/util/ndb_init.c: Changed header to GPL version 2 only ndb/src/common/util/random.c: Changed header to GPL version 2 only ndb/src/common/util/socket_io.cpp: Changed header to GPL version 2 only ndb/src/common/util/strdup.c: Changed header to GPL version 2 only ndb/src/common/util/testProperties/testProperties.cpp: Changed header to GPL version 2 only ndb/src/common/util/testSimpleProperties/sp_test.cpp: Changed header to GPL version 2 only ndb/src/common/util/uucode.c: Changed header to GPL version 2 only ndb/src/common/util/version.c: Changed header to GPL version 2 only ndb/src/cw/cpcc-win32/C++/CPC_GUI.cpp: Changed header to GPL version 2 only ndb/src/cw/cpcc-win32/C++/CPC_GUI.h: Changed header to GPL version 2 only ndb/src/cw/cpcc-win32/C++/NdbControls.cpp: Changed header to GPL version 2 only ndb/src/cw/cpcc-win32/C++/StdAfx.cpp: Changed header to GPL version 2 only ndb/src/cw/cpcc-win32/C++/StdAfx.h: Changed header to GPL version 2 only ndb/src/cw/cpcc-win32/C++/TreeView.cpp: Changed header to GPL version 2 only ndb/src/cw/cpcc-win32/C++/TreeView.h: Changed header to GPL version 2 only ndb/src/cw/cpcc-win32/C++/resource.h: Changed header to GPL version 2 only ndb/src/cw/cpcd/APIService.cpp: Changed header to GPL version 2 only ndb/src/cw/cpcd/APIService.hpp: Changed header to GPL version 2 only ndb/src/cw/cpcd/CPCD.cpp: Changed header to GPL version 2 only ndb/src/cw/cpcd/CPCD.hpp: Changed header to GPL version 2 only ndb/src/cw/cpcd/Monitor.cpp: Changed header to GPL version 2 only ndb/src/cw/cpcd/Process.cpp: Changed header to GPL version 2 only ndb/src/cw/cpcd/common.cpp: Changed header to GPL version 2 only ndb/src/cw/cpcd/common.hpp: Changed header to GPL version 2 only ndb/src/cw/cpcd/main.cpp: Changed header to GPL version 2 only ndb/src/cw/test/socketclient/socketClientTest.cpp: Changed header to GPL version 2 only ndb/src/cw/util/ClientInterface.cpp: Changed header to GPL version 2 only ndb/src/cw/util/ClientInterface.hpp: Changed header to GPL version 2 only ndb/src/cw/util/SocketRegistry.cpp: Changed header to GPL version 2 only ndb/src/cw/util/SocketRegistry.hpp: Changed header to GPL version 2 only ndb/src/cw/util/SocketService.cpp: Changed header to GPL version 2 only ndb/src/cw/util/SocketService.hpp: Changed header to GPL version 2 only ndb/src/kernel/SimBlockList.cpp: Changed header to GPL version 2 only ndb/src/kernel/blocks/backup/Backup.cpp: Changed header to GPL version 2 only ndb/src/kernel/blocks/backup/Backup.hpp: Changed header to GPL version 2 only ndb/src/kernel/blocks/backup/BackupFormat.hpp: Changed header to GPL version 2 only ndb/src/kernel/blocks/backup/BackupInit.cpp: Changed header to GPL version 2 only ndb/src/kernel/blocks/backup/FsBuffer.hpp: Changed header to GPL version 2 only ndb/src/kernel/blocks/backup/read.cpp: Changed header to GPL version 2 only ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp: Changed header to GPL version 2 only ndb/src/kernel/blocks/cmvmi/Cmvmi.hpp: Changed header to GPL version 2 only ndb/src/kernel/blocks/dbacc/Dbacc.hpp: Changed header to GPL version 2 only ndb/src/kernel/blocks/dbacc/DbaccInit.cpp: Changed header to GPL version 2 only ndb/src/kernel/blocks/dbacc/DbaccMain.cpp: Changed header to GPL version 2 only ndb/src/kernel/blocks/mutexes.hpp: Changed header to GPL version 2 only ndb/src/kernel/main.cpp: Changed header to GPL version 2 only ndb/src/kernel/blocks/dbdict/Dbdict.cpp: Changed header to GPL version 2 only ndb/src/kernel/blocks/dbdict/Dbdict.hpp: Changed header to GPL version 2 only ndb/src/kernel/blocks/dbdict/SchemaFile.hpp: Changed header to GPL version 2 only ndb/src/kernel/blocks/dbdict/printSchemaFile.cpp: Changed header to GPL version 2 only ndb/src/kernel/blocks/dbdih/Dbdih.hpp: Changed header to GPL version 2 only ndb/src/kernel/blocks/dbdih/DbdihInit.cpp: Changed header to GPL version 2 only ndb/src/kernel/blocks/dbdih/DbdihMain.cpp: Changed header to GPL version 2 only ndb/src/kernel/blocks/dbdih/Sysfile.hpp: Changed header to GPL version 2 only ndb/src/kernel/blocks/dbdih/printSysfile/printSysfile.cpp: Changed header to GPL version 2 only ndb/src/kernel/blocks/dblqh/Dblqh.hpp: Changed header to GPL version 2 only ndb/src/kernel/blocks/dblqh/DblqhInit.cpp: Changed header to GPL version 2 only ndb/src/kernel/blocks/dblqh/DblqhMain.cpp: Changed header to GPL version 2 only ndb/src/kernel/blocks/dblqh/redoLogReader/records.cpp: Changed header to GPL version 2 only ndb/src/kernel/blocks/dblqh/redoLogReader/records.hpp: Changed header to GPL version 2 only ndb/src/kernel/blocks/dblqh/redoLogReader/redoLogFileReader.cpp: Changed header to GPL version 2 only ndb/src/kernel/blocks/dbtc/Dbtc.hpp: Changed header to GPL version 2 only ndb/src/kernel/blocks/dbtc/DbtcInit.cpp: Changed header to GPL version 2 only ndb/src/kernel/blocks/dbtc/DbtcMain.cpp: Changed header to GPL version 2 only ndb/src/kernel/blocks/dbtup/AttributeOffset.hpp: Changed header to GPL version 2 only ndb/src/kernel/blocks/dbtup/Dbtup.hpp: Changed header to GPL version 2 only ndb/src/kernel/blocks/dbtup/DbtupAbort.cpp: Changed header to GPL version 2 only ndb/src/kernel/blocks/dbtup/DbtupBuffer.cpp: Changed header to GPL version 2 only ndb/src/kernel/blocks/dbtup/DbtupCommit.cpp: Changed header to GPL version 2 only ndb/src/kernel/blocks/dbtup/DbtupDebug.cpp: Changed header to GPL version 2 only ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp: Changed header to GPL version 2 only ndb/src/kernel/blocks/dbtup/DbtupFixAlloc.cpp: Changed header to GPL version 2 only ndb/src/kernel/blocks/dbtup/DbtupGen.cpp: Changed header to GPL version 2 only ndb/src/kernel/blocks/dbtup/DbtupIndex.cpp: Changed header to GPL version 2 only ndb/src/kernel/blocks/dbtup/DbtupLCP.cpp: Changed header to GPL version 2 only ndb/src/kernel/blocks/dbtup/DbtupMeta.cpp: Changed header to GPL version 2 only ndb/src/kernel/blocks/dbtup/DbtupPagMan.cpp: Changed header to GPL version 2 only ndb/src/kernel/blocks/dbtup/DbtupPageMap.cpp: Changed header to GPL version 2 only ndb/src/kernel/blocks/dbtup/DbtupRoutines.cpp: Changed header to GPL version 2 only ndb/src/kernel/blocks/dbtup/DbtupScan.cpp: Changed header to GPL version 2 only ndb/src/kernel/blocks/dbtup/DbtupStoredProcDef.cpp: Changed header to GPL version 2 only ndb/src/kernel/blocks/dbtup/DbtupSystemRestart.cpp: Changed header to GPL version 2 only ndb/src/kernel/blocks/dbtup/DbtupTabDesMan.cpp: Changed header to GPL version 2 only ndb/src/kernel/blocks/dbtup/DbtupTrigger.cpp: Changed header to GPL version 2 only ndb/src/kernel/blocks/dbtup/DbtupUndoLog.cpp: Changed header to GPL version 2 only ndb/src/kernel/blocks/dbtux/Dbtux.hpp: Changed header to GPL version 2 only ndb/src/kernel/blocks/dbtux/DbtuxCmp.cpp: Changed header to GPL version 2 only ndb/src/kernel/blocks/dbtux/DbtuxDebug.cpp: Changed header to GPL version 2 only ndb/src/kernel/blocks/dbtux/DbtuxGen.cpp: Changed header to GPL version 2 only ndb/src/kernel/blocks/dbtux/DbtuxMaint.cpp: Changed header to GPL version 2 only ndb/src/kernel/blocks/dbtux/DbtuxMeta.cpp: Changed header to GPL version 2 only ndb/src/kernel/blocks/dbtux/DbtuxNode.cpp: Changed header to GPL version 2 only ndb/src/kernel/blocks/dbtux/DbtuxScan.cpp: Changed header to GPL version 2 only ndb/src/kernel/blocks/dbtux/DbtuxSearch.cpp: Changed header to GPL version 2 only ndb/src/kernel/blocks/dbtux/DbtuxTree.cpp: Changed header to GPL version 2 only ndb/src/kernel/blocks/dbutil/DbUtil.cpp: Changed header to GPL version 2 only ndb/src/kernel/blocks/dbutil/DbUtil.hpp: Changed header to GPL version 2 only ndb/src/kernel/blocks/ndbcntr/Ndbcntr.hpp: Changed header to GPL version 2 only ndb/src/kernel/blocks/ndbcntr/NdbcntrInit.cpp: Changed header to GPL version 2 only ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp: Changed header to GPL version 2 only ndb/src/kernel/blocks/ndbcntr/NdbcntrSysTable.cpp: Changed header to GPL version 2 only ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp: Changed header to GPL version 2 only ndb/src/kernel/blocks/ndbfs/AsyncFile.hpp: Changed header to GPL version 2 only ndb/src/kernel/blocks/ndbfs/AsyncFileTest/AsyncFileTest.cpp: Changed header to GPL version 2 only ndb/src/kernel/blocks/ndbfs/CircularIndex.cpp: Changed header to GPL version 2 only ndb/src/kernel/blocks/ndbfs/CircularIndex.hpp: Changed header to GPL version 2 only ndb/src/kernel/blocks/ndbfs/Filename.cpp: Changed header to GPL version 2 only ndb/src/kernel/blocks/ndbfs/Filename.hpp: Changed header to GPL version 2 only ndb/src/kernel/blocks/ndbfs/MemoryChannel.cpp: Changed header to GPL version 2 only ndb/src/kernel/blocks/ndbfs/MemoryChannel.hpp: Changed header to GPL version 2 only ndb/src/kernel/blocks/ndbfs/MemoryChannelOSE.hpp: Changed header to GPL version 2 only ndb/src/kernel/blocks/ndbfs/MemoryChannelTest/MemoryChannelTest.cpp: Changed header to GPL version 2 only ndb/src/kernel/blocks/ndbfs/Ndbfs.cpp: Changed header to GPL version 2 only ndb/src/kernel/blocks/ndbfs/Ndbfs.hpp: Changed header to GPL version 2 only ndb/src/kernel/blocks/ndbfs/OpenFiles.hpp: Changed header to GPL version 2 only ndb/src/kernel/blocks/ndbfs/Pool.hpp: Changed header to GPL version 2 only ndb/src/kernel/blocks/ndbfs/VoidFs.cpp: Changed header to GPL version 2 only ndb/src/kernel/blocks/qmgr/Qmgr.hpp: Changed header to GPL version 2 only ndb/src/kernel/blocks/qmgr/QmgrInit.cpp: Changed header to GPL version 2 only ndb/src/kernel/blocks/qmgr/QmgrMain.cpp: Changed header to GPL version 2 only ndb/src/kernel/blocks/qmgr/timer.hpp: Changed header to GPL version 2 only ndb/src/kernel/blocks/suma/Suma.cpp: Changed header to GPL version 2 only ndb/src/kernel/blocks/suma/Suma.hpp: Changed header to GPL version 2 only ndb/src/kernel/blocks/suma/SumaInit.cpp: Changed header to GPL version 2 only ndb/src/kernel/blocks/trix/Trix.cpp: Changed header to GPL version 2 only ndb/src/kernel/blocks/trix/Trix.hpp: Changed header to GPL version 2 only ndb/src/kernel/error/ErrorHandlingMacros.hpp: Changed header to GPL version 2 only ndb/src/kernel/error/ErrorReporter.cpp: Changed header to GPL version 2 only ndb/src/kernel/error/ErrorReporter.hpp: Changed header to GPL version 2 only ndb/src/kernel/error/TimeModule.cpp: Changed header to GPL version 2 only ndb/src/kernel/error/TimeModule.hpp: Changed header to GPL version 2 only ndb/src/kernel/error/ndbd_exit_codes.c: Changed header to GPL version 2 only ndb/src/kernel/vm/Array.hpp: Changed header to GPL version 2 only ndb/src/kernel/vm/ArrayFifoList.hpp: Changed header to GPL version 2 only ndb/src/kernel/vm/ArrayList.hpp: Changed header to GPL version 2 only ndb/src/kernel/vm/ArrayPool.hpp: Changed header to GPL version 2 only ndb/src/kernel/vm/CArray.hpp: Changed header to GPL version 2 only ndb/src/kernel/vm/Callback.hpp: Changed header to GPL version 2 only ndb/src/kernel/vm/ClusterConfiguration.cpp: Changed header to GPL version 2 only ndb/src/kernel/vm/ClusterConfiguration.hpp: Changed header to GPL version 2 only ndb/src/kernel/vm/Configuration.cpp: Changed header to GPL version 2 only ndb/src/kernel/vm/Configuration.hpp: Changed header to GPL version 2 only ndb/src/kernel/vm/DLFifoList.hpp: Changed header to GPL version 2 only ndb/src/kernel/vm/DLHashTable.hpp: Changed header to GPL version 2 only ndb/src/kernel/vm/DLHashTable2.hpp: Changed header to GPL version 2 only ndb/src/kernel/vm/DLList.hpp: Changed header to GPL version 2 only ndb/src/kernel/vm/DataBuffer.hpp: Changed header to GPL version 2 only ndb/src/kernel/vm/Emulator.cpp: Changed header to GPL version 2 only ndb/src/kernel/vm/Emulator.hpp: Changed header to GPL version 2 only ndb/src/kernel/vm/FastScheduler.cpp: Changed header to GPL version 2 only ndb/src/kernel/vm/FastScheduler.hpp: Changed header to GPL version 2 only ndb/src/kernel/vm/GlobalData.hpp: Changed header to GPL version 2 only ndb/src/kernel/vm/KeyDescriptor.hpp: Changed header to GPL version 2 only ndb/src/kernel/vm/KeyTable.hpp: Changed header to GPL version 2 only ndb/src/kernel/vm/KeyTable2.hpp: Changed header to GPL version 2 only ndb/src/kernel/vm/LongSignal.hpp: Changed header to GPL version 2 only ndb/src/kernel/vm/MetaData.cpp: Changed header to GPL version 2 only ndb/src/kernel/vm/MetaData.hpp: Changed header to GPL version 2 only ndb/src/kernel/vm/Mutex.cpp: Changed header to GPL version 2 only ndb/src/kernel/vm/Mutex.hpp: Changed header to GPL version 2 only ndb/src/kernel/vm/Prio.hpp: Changed header to GPL version 2 only ndb/src/kernel/vm/RequestTracker.hpp: Changed header to GPL version 2 only ndb/src/kernel/vm/SLList.hpp: Changed header to GPL version 2 only ndb/src/kernel/vm/SafeCounter.cpp: Changed header to GPL version 2 only ndb/src/kernel/vm/SafeCounter.hpp: Changed header to GPL version 2 only ndb/src/kernel/vm/SectionReader.cpp: Changed header to GPL version 2 only ndb/src/kernel/vm/SectionReader.hpp: Changed header to GPL version 2 only ndb/src/kernel/vm/SignalCounter.hpp: Changed header to GPL version 2 only ndb/src/kernel/vm/SimBlockList.hpp: Changed header to GPL version 2 only ndb/src/kernel/vm/SimplePropertiesSection.cpp: Changed header to GPL version 2 only ndb/src/kernel/vm/SimulatedBlock.cpp: Changed header to GPL version 2 only ndb/src/kernel/vm/SimulatedBlock.hpp: Changed header to GPL version 2 only ndb/src/kernel/vm/SuperPool.cpp: Changed header to GPL version 2 only ndb/src/kernel/vm/SuperPool.hpp: Changed header to GPL version 2 only ndb/src/kernel/vm/ThreadConfig.cpp: Changed header to GPL version 2 only ndb/src/kernel/vm/ThreadConfig.hpp: Changed header to GPL version 2 only ndb/src/kernel/vm/TimeQueue.cpp: Changed header to GPL version 2 only ndb/src/kernel/vm/TimeQueue.hpp: Changed header to GPL version 2 only ndb/src/kernel/vm/TransporterCallback.cpp: Changed header to GPL version 2 only ndb/src/kernel/vm/VMSignal.cpp: Changed header to GPL version 2 only ndb/src/kernel/vm/VMSignal.hpp: Changed header to GPL version 2 only ndb/src/kernel/vm/WaitQueue.hpp: Changed header to GPL version 2 only ndb/src/kernel/vm/WatchDog.cpp: Changed header to GPL version 2 only ndb/src/kernel/vm/WatchDog.hpp: Changed header to GPL version 2 only ndb/src/kernel/vm/al_test/arrayListTest.cpp: Changed header to GPL version 2 only ndb/src/kernel/vm/al_test/arrayPoolTest.cpp: Changed header to GPL version 2 only ndb/src/kernel/vm/al_test/main.cpp: Changed header to GPL version 2 only ndb/src/kernel/vm/ndbd_malloc.cpp: Changed header to GPL version 2 only ndb/src/kernel/vm/ndbd_malloc.hpp: Changed header to GPL version 2 only ndb/src/kernel/vm/pc.hpp: Changed header to GPL version 2 only ndb/src/kernel/vm/testCopy/rr.cpp: Changed header to GPL version 2 only ndb/src/kernel/vm/testCopy/testCopy.cpp: Changed header to GPL version 2 only ndb/src/kernel/vm/testDataBuffer/testDataBuffer.cpp: Changed header to GPL version 2 only ndb/src/kernel/vm/testLongSig/testLongSig.cpp: Changed header to GPL version 2 only ndb/src/kernel/vm/testSimplePropertiesSection/test.cpp: Changed header to GPL version 2 only ndb/src/kernel/vm/testSuperPool.cpp: Changed header to GPL version 2 only ndb/src/mgmapi/LocalConfig.cpp: Changed header to GPL version 2 only ndb/src/mgmapi/LocalConfig.hpp: Changed header to GPL version 2 only ndb/src/mgmapi/mgmapi.cpp: Changed header to GPL version 2 only ndb/src/mgmapi/mgmapi_configuration.hpp: Changed header to GPL version 2 only ndb/src/mgmapi/mgmapi_internal.h: Changed header to GPL version 2 only ndb/src/mgmapi/ndb_logevent.cpp: Changed header to GPL version 2 only ndb/src/mgmapi/ndb_logevent.hpp: Changed header to GPL version 2 only ndb/src/mgmapi/test/keso.c: Changed header to GPL version 2 only ndb/src/mgmapi/test/mgmSrvApi.cpp: Changed header to GPL version 2 only ndb/src/mgmclient/CommandInterpreter.cpp: Changed header to GPL version 2 only ndb/src/mgmclient/main.cpp: Changed header to GPL version 2 only ndb/src/mgmclient/ndb_mgmclient.hpp: Changed header to GPL version 2 only ndb/src/mgmclient/ndb_mgmclient.h: Changed header to GPL version 2 only ndb/src/mgmclient/test_cpcd/test_cpcd.cpp: Changed header to GPL version 2 only ndb/src/mgmsrv/Config.cpp: Changed header to GPL version 2 only ndb/src/mgmsrv/Config.hpp: Changed header to GPL version 2 only ndb/src/mgmsrv/ConfigInfo.cpp: Changed header to GPL version 2 only ndb/src/mgmsrv/ConfigInfo.hpp: Changed header to GPL version 2 only ndb/src/mgmsrv/InitConfigFileParser.cpp: Changed header to GPL version 2 only ndb/src/mgmsrv/InitConfigFileParser.hpp: Changed header to GPL version 2 only ndb/src/mgmsrv/MgmtSrvr.cpp: Changed header to GPL version 2 only ndb/src/mgmsrv/MgmtSrvr.hpp: Changed header to GPL version 2 only ndb/src/mgmsrv/MgmtSrvrConfig.cpp: Changed header to GPL version 2 only ndb/src/mgmsrv/MgmtSrvrGeneralSignalHandling.cpp: Changed header to GPL version 2 only ndb/src/mgmsrv/Services.cpp: Changed header to GPL version 2 only ndb/src/mgmsrv/Services.hpp: Changed header to GPL version 2 only ndb/src/mgmsrv/SignalQueue.cpp: Changed header to GPL version 2 only ndb/src/mgmsrv/SignalQueue.hpp: Changed header to GPL version 2 only ndb/src/mgmsrv/convertStrToInt.cpp: Changed header to GPL version 2 only ndb/src/mgmsrv/convertStrToInt.hpp: Changed header to GPL version 2 only ndb/src/mgmsrv/main.cpp: Changed header to GPL version 2 only ndb/src/mgmsrv/mkconfig/mkconfig.cpp: Changed header to GPL version 2 only ndb/src/ndbapi/API.hpp: Changed header to GPL version 2 only ndb/src/ndbapi/ClusterMgr.cpp: Changed header to GPL version 2 only ndb/src/ndbapi/ClusterMgr.hpp: Changed header to GPL version 2 only ndb/src/ndbapi/DictCache.cpp: Changed header to GPL version 2 only ndb/src/ndbapi/DictCache.hpp: Changed header to GPL version 2 only ndb/src/ndbapi/Ndb.cpp: Changed header to GPL version 2 only ndb/src/ndbapi/NdbApiSignal.cpp: Changed header to GPL version 2 only ndb/src/ndbapi/NdbApiSignal.hpp: Changed header to GPL version 2 only ndb/src/ndbapi/NdbBlob.cpp: Changed header to GPL version 2 only ndb/src/ndbapi/NdbBlobImpl.hpp: Changed header to GPL version 2 only ndb/src/ndbapi/NdbDictionary.cpp: Changed header to GPL version 2 only ndb/src/ndbapi/NdbDictionaryImpl.cpp: Changed header to GPL version 2 only ndb/src/ndbapi/NdbDictionaryImpl.hpp: Changed header to GPL version 2 only ndb/src/ndbapi/NdbErrorOut.cpp: Changed header to GPL version 2 only ndb/src/ndbapi/NdbEventOperation.cpp: Changed header to GPL version 2 only ndb/src/ndbapi/NdbEventOperationImpl.cpp: Changed header to GPL version 2 only ndb/src/ndbapi/NdbEventOperationImpl.hpp: Changed header to GPL version 2 only ndb/src/ndbapi/NdbImpl.hpp: Changed header to GPL version 2 only ndb/src/ndbapi/NdbIndexOperation.cpp: Changed header to GPL version 2 only ndb/src/ndbapi/NdbLinHash.hpp: Changed header to GPL version 2 only ndb/src/ndbapi/NdbOperation.cpp: Changed header to GPL version 2 only ndb/src/ndbapi/NdbOperationDefine.cpp: Changed header to GPL version 2 only ndb/src/ndbapi/NdbOperationExec.cpp: Changed header to GPL version 2 only ndb/src/ndbapi/NdbOperationInt.cpp: Changed header to GPL version 2 only ndb/src/ndbapi/NdbOperationScan.cpp: Changed header to GPL version 2 only ndb/src/ndbapi/NdbOperationSearch.cpp: Changed header to GPL version 2 only ndb/src/ndbapi/NdbPool.cpp: Changed header to GPL version 2 only ndb/src/ndbapi/NdbPoolImpl.cpp: Changed header to GPL version 2 only ndb/src/ndbapi/NdbPoolImpl.hpp: Changed header to GPL version 2 only ndb/src/ndbapi/NdbRecAttr.cpp: Changed header to GPL version 2 only ndb/src/ndbapi/NdbReceiver.cpp: Changed header to GPL version 2 only ndb/src/ndbapi/NdbScanFilter.cpp: Changed header to GPL version 2 only ndb/src/ndbapi/NdbScanOperation.cpp: Changed header to GPL version 2 only ndb/src/ndbapi/NdbTransaction.cpp: Changed header to GPL version 2 only ndb/src/ndbapi/NdbTransactionScan.cpp: Changed header to GPL version 2 only ndb/src/ndbapi/NdbUtil.cpp: Changed header to GPL version 2 only ndb/src/ndbapi/NdbUtil.hpp: Changed header to GPL version 2 only ndb/src/ndbapi/NdbWaiter.hpp: Changed header to GPL version 2 only ndb/src/ndbapi/Ndberr.cpp: Changed header to GPL version 2 only ndb/src/ndbapi/Ndbif.cpp: Changed header to GPL version 2 only ndb/src/ndbapi/Ndbinit.cpp: Changed header to GPL version 2 only ndb/src/ndbapi/Ndblist.cpp: Changed header to GPL version 2 only ndb/src/ndbapi/ObjectMap.hpp: Changed header to GPL version 2 only ndb/src/ndbapi/SignalSender.cpp: Changed header to GPL version 2 only ndb/src/ndbapi/SignalSender.hpp: Changed header to GPL version 2 only ndb/src/ndbapi/TransporterFacade.cpp: Changed header to GPL version 2 only ndb/src/ndbapi/TransporterFacade.hpp: Changed header to GPL version 2 only ndb/src/ndbapi/ndb_cluster_connection.cpp: Changed header to GPL version 2 only ndb/src/ndbapi/ndb_cluster_connection_impl.hpp: Changed header to GPL version 2 only ndb/src/ndbapi/ndberror.c: Changed header to GPL version 2 only ndb/src/ndbapi/signal-sender/SignalSender.cpp: Changed header to GPL version 2 only ndb/src/ndbapi/signal-sender/SignalSender.hpp: Changed header to GPL version 2 only ndb/test/include/CpcClient.hpp: Changed header to GPL version 2 only ndb/test/include/HugoAsynchTransactions.hpp: Changed header to GPL version 2 only ndb/test/include/HugoCalculator.hpp: Changed header to GPL version 2 only ndb/test/include/HugoOperations.hpp: Changed header to GPL version 2 only ndb/test/include/HugoTransactions.hpp: Changed header to GPL version 2 only ndb/test/include/NDBT.hpp: Changed header to GPL version 2 only ndb/test/include/NDBT_DataSet.hpp: Changed header to GPL version 2 only ndb/test/include/NDBT_DataSetTransaction.hpp: Changed header to GPL version 2 only ndb/test/include/NDBT_Error.hpp: Changed header to GPL version 2 only ndb/test/include/NDBT_Output.hpp: Changed header to GPL version 2 only ndb/test/include/NDBT_ResultRow.hpp: Changed header to GPL version 2 only ndb/test/include/NDBT_ReturnCodes.h: Changed header to GPL version 2 only ndb/test/include/NDBT_Stats.hpp: Changed header to GPL version 2 only ndb/test/include/NDBT_Table.hpp: Changed header to GPL version 2 only ndb/test/include/NDBT_Tables.hpp: Changed header to GPL version 2 only ndb/test/include/NDBT_Test.hpp: Changed header to GPL version 2 only ndb/test/include/NdbBackup.hpp: Changed header to GPL version 2 only ndb/test/include/NdbConfig.hpp: Changed header to GPL version 2 only ndb/test/include/NdbGrep.hpp: Changed header to GPL version 2 only ndb/test/include/NdbRestarter.hpp: Changed header to GPL version 2 only ndb/test/include/NdbRestarts.hpp: Changed header to GPL version 2 only ndb/test/include/NdbSchemaCon.hpp: Changed header to GPL version 2 only ndb/test/include/NdbSchemaOp.hpp: Changed header to GPL version 2 only ndb/test/include/NdbTest.hpp: Changed header to GPL version 2 only ndb/test/include/NdbTimer.hpp: Changed header to GPL version 2 only ndb/test/include/TestNdbEventOperation.hpp: Changed header to GPL version 2 only ndb/test/include/UtilTransactions.hpp: Changed header to GPL version 2 only ndb/test/include/getarg.h: Changed header to GPL version 2 only ndb/test/ndbapi/InsertRecs.cpp: Changed header to GPL version 2 only ndb/test/ndbapi/ScanFilter.hpp: Changed header to GPL version 2 only ndb/test/ndbapi/ScanFunctions.hpp: Changed header to GPL version 2 only ndb/test/ndbapi/ScanInterpretTest.hpp: Changed header to GPL version 2 only ndb/test/ndbapi/TraceNdbApi.cpp: Changed header to GPL version 2 only ndb/test/ndbapi/VerifyNdbApi.cpp: Changed header to GPL version 2 only ndb/test/ndbapi/acid.cpp: Changed header to GPL version 2 only ndb/test/ndbapi/acid2.cpp: Changed header to GPL version 2 only ndb/test/ndbapi/adoInsertRecs.cpp: Changed header to GPL version 2 only ndb/test/ndbapi/asyncGenerator.cpp: Changed header to GPL version 2 only ndb/test/ndbapi/benchronja.cpp: Changed header to GPL version 2 only ndb/test/ndbapi/bulk_copy.cpp: Changed header to GPL version 2 only ndb/test/ndbapi/cdrserver.cpp: Changed header to GPL version 2 only ndb/test/ndbapi/celloDb.cpp: Changed header to GPL version 2 only ndb/test/ndbapi/create_all_tabs.cpp: Changed header to GPL version 2 only ndb/test/ndbapi/create_tab.cpp: Changed header to GPL version 2 only ndb/test/ndbapi/drop_all_tabs.cpp: Changed header to GPL version 2 only ndb/test/ndbapi/flexAsynch.cpp: Changed header to GPL version 2 only ndb/test/ndbapi/flexBench.cpp: Changed header to GPL version 2 only ndb/test/ndbapi/flexHammer.cpp: Changed header to GPL version 2 only ndb/test/ndbapi/flexScan.cpp: Changed header to GPL version 2 only ndb/test/ndbapi/flexTT.cpp: Changed header to GPL version 2 only ndb/test/ndbapi/flexTimedAsynch.cpp: Changed header to GPL version 2 only ndb/test/ndbapi/flex_bench_mysql.cpp: Changed header to GPL version 2 only ndb/test/ndbapi/index.cpp: Changed header to GPL version 2 only ndb/test/ndbapi/index2.cpp: Changed header to GPL version 2 only ndb/test/ndbapi/initronja.cpp: Changed header to GPL version 2 only ndb/test/ndbapi/interpreterInTup.cpp: Changed header to GPL version 2 only ndb/test/ndbapi/mainAsyncGenerator.cpp: Changed header to GPL version 2 only ndb/test/ndbapi/msa.cpp: Changed header to GPL version 2 only ndb/test/ndbapi/ndb_async1.cpp: Changed header to GPL version 2 only ndb/test/ndbapi/ndb_async2.cpp: Changed header to GPL version 2 only ndb/test/ndbapi/ndb_user_populate.cpp: Changed header to GPL version 2 only ndb/test/ndbapi/ndb_user_transaction.cpp: Changed header to GPL version 2 only ndb/test/ndbapi/ndb_user_transaction2.cpp: Changed header to GPL version 2 only ndb/test/ndbapi/ndb_user_transaction3.cpp: Changed header to GPL version 2 only ndb/test/ndbapi/ndb_user_transaction4.cpp: Changed header to GPL version 2 only ndb/test/ndbapi/ndb_user_transaction5.cpp: Changed header to GPL version 2 only ndb/test/ndbapi/ndb_user_transaction6.cpp: Changed header to GPL version 2 only ndb/test/ndbapi/restarter.cpp: Changed header to GPL version 2 only ndb/test/ndbapi/restarter2.cpp: Changed header to GPL version 2 only ndb/test/ndbapi/restarts.cpp: Changed header to GPL version 2 only ndb/test/ndbapi/size.cpp: Changed header to GPL version 2 only ndb/test/ndbapi/testBackup.cpp: Changed header to GPL version 2 only ndb/test/ndbapi/testBasic.cpp: Changed header to GPL version 2 only ndb/test/ndbapi/testBasicAsynch.cpp: Changed header to GPL version 2 only ndb/test/ndbapi/testBlobs.cpp: Changed header to GPL version 2 only ndb/test/ndbapi/testDataBuffers.cpp: Changed header to GPL version 2 only ndb/test/ndbapi/testDeadlock.cpp: Changed header to GPL version 2 only ndb/test/ndbapi/testDict.cpp: Changed header to GPL version 2 only ndb/test/ndbapi/testGrepVerify.cpp: Changed header to GPL version 2 only ndb/test/ndbapi/testIndex.cpp: Changed header to GPL version 2 only ndb/test/ndbapi/testInterpreter.cpp: Changed header to GPL version 2 only ndb/test/ndbapi/testMgm.cpp: Changed header to GPL version 2 only ndb/test/ndbapi/testNdbApi.cpp: Changed header to GPL version 2 only ndb/test/ndbapi/testNodeRestart.cpp: Changed header to GPL version 2 only ndb/test/ndbapi/testOIBasic.cpp: Changed header to GPL version 2 only ndb/test/ndbapi/testOperations.cpp: Changed header to GPL version 2 only ndb/test/ndbapi/testOrderedIndex.cpp: Changed header to GPL version 2 only ndb/test/ndbapi/testPartitioning.cpp: Changed header to GPL version 2 only ndb/test/ndbapi/testReadPerf.cpp: Changed header to GPL version 2 only ndb/test/ndbapi/testRestartGci.cpp: Changed header to GPL version 2 only ndb/test/ndbapi/testSRBank.cpp: Changed header to GPL version 2 only ndb/test/ndbapi/testScan.cpp: Changed header to GPL version 2 only ndb/test/ndbapi/testScanInterpreter.cpp: Changed header to GPL version 2 only ndb/test/ndbapi/testScanPerf.cpp: Changed header to GPL version 2 only ndb/test/ndbapi/testSystemRestart.cpp: Changed header to GPL version 2 only ndb/test/ndbapi/bank/Bank.cpp: Changed header to GPL version 2 only ndb/test/ndbapi/bank/Bank.hpp: Changed header to GPL version 2 only ndb/test/ndbapi/bank/BankLoad.cpp: Changed header to GPL version 2 only ndb/test/ndbapi/bank/bankCreator.cpp: Changed header to GPL version 2 only ndb/test/ndbapi/bank/bankMakeGL.cpp: Changed header to GPL version 2 only ndb/test/ndbapi/bank/bankSumAccounts.cpp: Changed header to GPL version 2 only ndb/test/ndbapi/bank/bankTimer.cpp: Changed header to GPL version 2 only ndb/test/ndbapi/bank/bankTransactionMaker.cpp: Changed header to GPL version 2 only ndb/test/ndbapi/bank/bankValidateAllGLs.cpp: Changed header to GPL version 2 only ndb/test/ndbapi/bank/testBank.cpp: Changed header to GPL version 2 only ndb/test/ndbapi/bench/asyncGenerator.cpp: Changed header to GPL version 2 only ndb/test/ndbapi/bench/dbGenerator.h: Changed header to GPL version 2 only ndb/test/ndbapi/bench/dbPopulate.cpp: Changed header to GPL version 2 only ndb/test/ndbapi/bench/dbPopulate.h: Changed header to GPL version 2 only ndb/test/ndbapi/bench/macros.h: Changed header to GPL version 2 only ndb/test/ndbapi/bench/mainAsyncGenerator.cpp: Changed header to GPL version 2 only ndb/test/ndbapi/bench/mainPopulate.cpp: Changed header to GPL version 2 only ndb/test/ndbapi/bench/ndb_async1.cpp: Changed header to GPL version 2 only ndb/test/ndbapi/bench/ndb_async2.cpp: Changed header to GPL version 2 only ndb/test/ndbapi/bench/ndb_error.hpp: Changed header to GPL version 2 only ndb/test/ndbapi/bench/ndb_schema.hpp: Changed header to GPL version 2 only ndb/test/ndbapi/bench/ndb_user_transaction.cpp: Changed header to GPL version 2 only ndb/test/ndbapi/bench/ndb_user_transaction2.cpp: Changed header to GPL version 2 only ndb/test/ndbapi/bench/ndb_user_transaction3.cpp: Changed header to GPL version 2 only ndb/test/ndbapi/bench/ndb_user_transaction4.cpp: Changed header to GPL version 2 only ndb/test/ndbapi/bench/ndb_user_transaction5.cpp: Changed header to GPL version 2 only ndb/test/ndbapi/bench/ndb_user_transaction6.cpp: Changed header to GPL version 2 only ndb/test/ndbapi/bench/testData.h: Changed header to GPL version 2 only ndb/test/ndbapi/bench/testDefinitions.h: Changed header to GPL version 2 only ndb/test/ndbapi/bench/userInterface.cpp: Changed header to GPL version 2 only ndb/test/ndbapi/bench/userInterface.h: Changed header to GPL version 2 only ndb/test/ndbapi/old_dirs/acid2/TraceNdbApi.hpp: Changed header to GPL version 2 only ndb/test/ndbapi/old_dirs/acid2/VerifyNdbApi.hpp: Changed header to GPL version 2 only ndb/test/ndbapi/old_dirs/lmc-bench/async-src/include/dbGenerator.h: Changed header to GPL version 2 only ndb/test/ndbapi/old_dirs/lmc-bench/async-src/include/testData.h: Changed header to GPL version 2 only ndb/test/ndbapi/old_dirs/lmc-bench/async-src/include/userInterface.h: Changed header to GPL version 2 only ndb/test/ndbapi/old_dirs/lmc-bench/async-src/user/macros.h: Changed header to GPL version 2 only ndb/test/ndbapi/old_dirs/lmc-bench/async-src/user/ndb_error.hpp: Changed header to GPL version 2 only ndb/test/ndbapi/old_dirs/lmc-bench/include/ndb_schema.hpp: Changed header to GPL version 2 only ndb/test/ndbapi/old_dirs/lmc-bench/include/testDefinitions.h: Changed header to GPL version 2 only ndb/test/ndbapi/old_dirs/lmc-bench/src/generator/dbGenerator.c: Changed header to GPL version 2 only ndb/test/ndbapi/old_dirs/lmc-bench/src/generator/dbGenerator.h: Changed header to GPL version 2 only ndb/test/ndbapi/old_dirs/lmc-bench/src/generator/mainGenerator.c: Changed header to GPL version 2 only ndb/test/ndbapi/old_dirs/lmc-bench/src/include/testData.h: Changed header to GPL version 2 only ndb/test/ndbapi/old_dirs/lmc-bench/src/include/userInterface.h: Changed header to GPL version 2 only ndb/test/ndbapi/old_dirs/lmc-bench/src/populator/dbPopulate.c: Changed header to GPL version 2 only ndb/test/ndbapi/old_dirs/lmc-bench/src/populator/dbPopulate.h: Changed header to GPL version 2 only ndb/test/ndbapi/old_dirs/lmc-bench/src/populator/mainPopulate.c: Changed header to GPL version 2 only ndb/test/ndbapi/old_dirs/lmc-bench/src/user/localDbPrepare.c: Changed header to GPL version 2 only ndb/test/ndbapi/old_dirs/lmc-bench/src/user/macros.h: Changed header to GPL version 2 only ndb/test/ndbapi/old_dirs/lmc-bench/src/user/ndb_error.hpp: Changed header to GPL version 2 only ndb/test/ndbapi/old_dirs/lmc-bench/src/user/old/userHandle.h: Changed header to GPL version 2 only ndb/test/ndbapi/old_dirs/lmc-bench/src/user/old/userInterface.c: Changed header to GPL version 2 only ndb/test/ndbapi/old_dirs/lmc-bench/src/user/userHandle.h: Changed header to GPL version 2 only ndb/test/ndbapi/old_dirs/lmc-bench/src/user/userInterface.cpp: Changed header to GPL version 2 only ndb/test/ndbapi/old_dirs/lmc-bench/src/user/userTransaction.c: Changed header to GPL version 2 only ndb/test/ndbapi/testTimeout.cpp: Changed header to GPL version 2 only ndb/test/ndbapi/testTransactions.cpp: Changed header to GPL version 2 only ndb/test/ndbapi/test_event.cpp: Changed header to GPL version 2 only ndb/test/ndbapi/test_event_merge.cpp: Changed header to GPL version 2 only ndb/test/ndbapi/test_event_multi_table.cpp: Changed header to GPL version 2 only ndb/test/ndbapi/userInterface.cpp: Changed header to GPL version 2 only ndb/test/ndbapi/old_dirs/lmc-bench/src/user/old/userTransaction.c: Changed header to GPL version 2 only ndb/test/ndbapi/old_dirs/vw_test/bcd.h: Changed header to GPL version 2 only ndb/test/ndbapi/old_dirs/vw_test/utv.h: Changed header to GPL version 2 only ndb/test/ndbapi/old_dirs/vw_test/vcdrfunc.h: Changed header to GPL version 2 only ndb/test/newtonapi/basic_test/basic/basic.cpp: Changed header to GPL version 2 only ndb/test/newtonapi/basic_test/bulk_read/br_test.cpp: Changed header to GPL version 2 only ndb/test/newtonapi/basic_test/common.cpp: Changed header to GPL version 2 only ndb/test/newtonapi/basic_test/common.hpp: Changed header to GPL version 2 only ndb/test/newtonapi/basic_test/ptr_binding/ptr_binding_test.cpp: Changed header to GPL version 2 only ndb/test/newtonapi/basic_test/too_basic.cpp: Changed header to GPL version 2 only ndb/test/newtonapi/perf_test/perf.cpp: Changed header to GPL version 2 only ndb/test/odbc/SQL99_test/SQL99_test.cpp: Changed header to GPL version 2 only ndb/test/odbc/SQL99_test/SQL99_test.h: Changed header to GPL version 2 only ndb/test/odbc/client/NDBT_ALLOCHANDLE.cpp: Changed header to GPL version 2 only ndb/test/odbc/client/NDBT_ALLOCHANDLE_HDBC.cpp: Changed header to GPL version 2 only ndb/test/odbc/client/NDBT_SQLConnect.cpp: Changed header to GPL version 2 only ndb/test/odbc/client/NDBT_SQLPrepare.cpp: Changed header to GPL version 2 only ndb/test/odbc/client/SQLAllocEnvTest.cpp: Changed header to GPL version 2 only ndb/test/odbc/client/SQLAllocHandleTest.cpp: Changed header to GPL version 2 only ndb/test/odbc/client/SQLAllocHandleTest_bf.cpp: Changed header to GPL version 2 only ndb/test/odbc/client/SQLBindColTest.cpp: Changed header to GPL version 2 only ndb/test/odbc/client/SQLBindParameterTest.cpp: Changed header to GPL version 2 only ndb/test/odbc/client/SQLCancelTest.cpp: Changed header to GPL version 2 only ndb/test/odbc/client/SQLCloseCursorTest.cpp: Changed header to GPL version 2 only ndb/test/odbc/client/SQLColAttributeTest.cpp: Changed header to GPL version 2 only ndb/test/odbc/client/SQLColAttributeTest1.cpp: Changed header to GPL version 2 only ndb/test/odbc/client/SQLColAttributeTest2.cpp: Changed header to GPL version 2 only ndb/test/odbc/client/SQLColAttributeTest3.cpp: Changed header to GPL version 2 only ndb/test/odbc/client/SQLConnectTest.cpp: Changed header to GPL version 2 only ndb/test/odbc/client/SQLCopyDescTest.cpp: Changed header to GPL version 2 only ndb/test/odbc/client/SQLDescribeColTest.cpp: Changed header to GPL version 2 only ndb/test/odbc/client/SQLDisconnectTest.cpp: Changed header to GPL version 2 only ndb/test/odbc/client/SQLDriverConnectTest.cpp: Changed header to GPL version 2 only ndb/test/odbc/client/SQLEndTranTest.cpp: Changed header to GPL version 2 only ndb/test/odbc/client/SQLErrorTest.cpp: Changed header to GPL version 2 only ndb/test/odbc/client/SQLExecDirectTest.cpp: Changed header to GPL version 2 only ndb/test/odbc/client/SQLExecuteTest.cpp: Changed header to GPL version 2 only ndb/test/odbc/client/SQLFetchScrollTest.cpp: Changed header to GPL version 2 only ndb/test/odbc/client/SQLFetchTest.cpp: Changed header to GPL version 2 only ndb/test/odbc/client/SQLFreeHandleTest.cpp: Changed header to GPL version 2 only ndb/test/odbc/client/SQLFreeStmtTest.cpp: Changed header to GPL version 2 only ndb/test/odbc/client/SQLGetConnectAttrTest.cpp: Changed header to GPL version 2 only ndb/test/odbc/client/SQLGetCursorNameTest.cpp: Changed header to GPL version 2 only ndb/test/odbc/client/SQLGetDataTest.cpp: Changed header to GPL version 2 only ndb/test/odbc/client/SQLGetDescFieldTest.cpp: Changed header to GPL version 2 only ndb/test/odbc/client/SQLGetDescRecTest.cpp: Changed header to GPL version 2 only ndb/test/odbc/client/SQLGetDiagFieldTest.cpp: Changed header to GPL version 2 only ndb/test/odbc/client/SQLGetDiagRecSimpleTest.cpp: Changed header to GPL version 2 only ndb/test/odbc/client/SQLGetDiagRecTest.cpp: Changed header to GPL version 2 only ndb/test/odbc/client/SQLGetEnvAttrTest.cpp: Changed header to GPL version 2 only ndb/test/odbc/client/SQLGetFunctionsTest.cpp: Changed header to GPL version 2 only ndb/test/odbc/client/SQLGetInfoTest.cpp: Changed header to GPL version 2 only ndb/test/odbc/client/SQLGetStmtAttrTest.cpp: Changed header to GPL version 2 only ndb/test/odbc/client/SQLGetTypeInfoTest.cpp: Changed header to GPL version 2 only ndb/test/odbc/client/SQLMoreResultsTest.cpp: Changed header to GPL version 2 only ndb/test/odbc/client/SQLNumResultColsTest.cpp: Changed header to GPL version 2 only ndb/test/odbc/client/SQLParamDataTest.cpp: Changed header to GPL version 2 only ndb/test/odbc/client/SQLPrepareTest.cpp: Changed header to GPL version 2 only ndb/test/odbc/client/SQLPutDataTest.cpp: Changed header to GPL version 2 only ndb/test/odbc/client/SQLRowCountTest.cpp: Changed header to GPL version 2 only ndb/test/odbc/client/SQLSetConnectAttrTest.cpp: Changed header to GPL version 2 only ndb/test/odbc/client/SQLSetCursorNameTest.cpp: Changed header to GPL version 2 only ndb/test/odbc/client/SQLSetDescFieldTest.cpp: Changed header to GPL version 2 only ndb/test/odbc/client/SQLSetDescRecTest.cpp: Changed header to GPL version 2 only ndb/test/odbc/client/SQLSetEnvAttrTest.cpp: Changed header to GPL version 2 only ndb/test/odbc/client/SQLSetStmtAttrTest.cpp: Changed header to GPL version 2 only ndb/test/odbc/client/SQLTablesTest.cpp: Changed header to GPL version 2 only ndb/test/odbc/client/SQLTransactTest.cpp: Changed header to GPL version 2 only ndb/test/odbc/client/common.hpp: Changed header to GPL version 2 only ndb/test/odbc/client/main.cpp: Changed header to GPL version 2 only ndb/test/odbc/driver/testOdbcDriver.cpp: Changed header to GPL version 2 only ndb/test/odbc/test_compiler/test_compiler.cpp: Changed header to GPL version 2 only ndb/test/run-test/main.cpp: Changed header to GPL version 2 only ndb/test/run-test/run-test.hpp: Changed header to GPL version 2 only ndb/test/src/CpcClient.cpp: Changed header to GPL version 2 only ndb/test/src/HugoAsynchTransactions.cpp: Changed header to GPL version 2 only ndb/test/src/HugoCalculator.cpp: Changed header to GPL version 2 only ndb/test/src/HugoOperations.cpp: Changed header to GPL version 2 only ndb/test/src/HugoTransactions.cpp: Changed header to GPL version 2 only ndb/test/src/NDBT_Error.cpp: Changed header to GPL version 2 only ndb/test/src/NDBT_Output.cpp: Changed header to GPL version 2 only ndb/test/src/NDBT_ResultRow.cpp: Changed header to GPL version 2 only ndb/test/src/NDBT_ReturnCodes.cpp: Changed header to GPL version 2 only ndb/test/src/NDBT_Table.cpp: Changed header to GPL version 2 only ndb/test/src/NDBT_Tables.cpp: Changed header to GPL version 2 only ndb/test/src/NDBT_Test.cpp: Changed header to GPL version 2 only ndb/test/src/NdbBackup.cpp: Changed header to GPL version 2 only ndb/test/src/NdbConfig.cpp: Changed header to GPL version 2 only ndb/test/src/NdbGrep.cpp: Changed header to GPL version 2 only ndb/test/src/NdbRestarter.cpp: Changed header to GPL version 2 only ndb/test/src/NdbRestarts.cpp: Changed header to GPL version 2 only ndb/test/src/NdbSchemaCon.cpp: Changed header to GPL version 2 only ndb/test/src/NdbSchemaOp.cpp: Changed header to GPL version 2 only ndb/test/src/UtilTransactions.cpp: Changed header to GPL version 2 only ndb/test/tools/copy_tab.cpp: Changed header to GPL version 2 only ndb/test/tools/cpcc.cpp: Changed header to GPL version 2 only ndb/test/tools/create_index.cpp: Changed header to GPL version 2 only ndb/test/tools/hugoCalculator.cpp: Changed header to GPL version 2 only ndb/test/tools/hugoFill.cpp: Changed header to GPL version 2 only ndb/test/tools/hugoLoad.cpp: Changed header to GPL version 2 only ndb/test/tools/hugoLockRecords.cpp: Changed header to GPL version 2 only ndb/test/tools/hugoPkDelete.cpp: Changed header to GPL version 2 only ndb/test/tools/hugoPkRead.cpp: Changed header to GPL version 2 only ndb/test/tools/hugoPkReadRecord.cpp: Changed header to GPL version 2 only ndb/test/tools/hugoPkUpdate.cpp: Changed header to GPL version 2 only ndb/test/tools/hugoScanRead.cpp: Changed header to GPL version 2 only ndb/test/tools/hugoScanUpdate.cpp: Changed header to GPL version 2 only ndb/test/tools/old_dirs/waiter/waiter.cpp: Changed header to GPL version 2 only ndb/test/tools/restart.cpp: Changed header to GPL version 2 only ndb/test/tools/transproxy.cpp: Changed header to GPL version 2 only ndb/test/tools/verify_index.cpp: Changed header to GPL version 2 only ndb/tools/delete_all.cpp: Changed header to GPL version 2 only ndb/tools/desc.cpp: Changed header to GPL version 2 only ndb/tools/drop_index.cpp: Changed header to GPL version 2 only ndb/tools/drop_tab.cpp: Changed header to GPL version 2 only ndb/tools/listTables.cpp: Changed header to GPL version 2 only ndb/tools/ndb_config.cpp: Changed header to GPL version 2 only ndb/tools/ndb_test_platform.cpp: Changed header to GPL version 2 only ndb/tools/ndbsql.cpp: Changed header to GPL version 2 only ndb/tools/restore/Restore.cpp: Changed header to GPL version 2 only ndb/tools/restore/Restore.hpp: Changed header to GPL version 2 only ndb/tools/restore/consumer.cpp: Changed header to GPL version 2 only ndb/tools/restore/consumer.hpp: Changed header to GPL version 2 only ndb/tools/restore/consumer_printer.cpp: Changed header to GPL version 2 only ndb/tools/restore/consumer_printer.hpp: Changed header to GPL version 2 only ndb/tools/restore/consumer_restore.cpp: Changed header to GPL version 2 only ndb/tools/restore/consumer_restore.hpp: Changed header to GPL version 2 only ndb/tools/select_all.cpp: Changed header to GPL version 2 only ndb/tools/select_count.cpp: Changed header to GPL version 2 only ndb/tools/waiter.cpp: Changed header to GPL version 2 only ndb/tools/restore/consumer_restorem.cpp: Changed header to GPL version 2 only ndb/tools/restore/restore_main.cpp: Changed header to GPL version 2 only netware/mysql_fix_privilege_tables.pl: Changed header to GPL version 2 only netware/mysql_secure_installation.pl: Changed header to GPL version 2 only os2/Makefile.am: Changed header to GPL version 2 only os2/include/Makefile.am: Changed header to GPL version 2 only os2/include/sys/Makefile.am: Changed header to GPL version 2 only pstack/Makefile.am: Changed header to GPL version 2 only regex/Makefile.am: Changed header to GPL version 2 only scripts/Makefile.am: Changed header to GPL version 2 only scripts/fill_help_tables.sh: Changed header to GPL version 2 only scripts/mysql_config.sh: Changed header to GPL version 2 only scripts/mysql_secure_installation.sh: Changed header to GPL version 2 only server-tools/instance-manager/Makefile.am: Changed header to GPL version 2 only server-tools/instance-manager/buffer.cc: Changed header to GPL version 2 only server-tools/instance-manager/buffer.h: Changed header to GPL version 2 only server-tools/instance-manager/command.cc: Changed header to GPL version 2 only server-tools/instance-manager/command.h: Changed header to GPL version 2 only server-tools/instance-manager/commands.cc: Changed header to GPL version 2 only server-tools/instance-manager/commands.h: Changed header to GPL version 2 only server-tools/instance-manager/guardian.cc: Changed header to GPL version 2 only server-tools/instance-manager/guardian.h: Changed header to GPL version 2 only server-tools/instance-manager/instance.cc: Changed header to GPL version 2 only server-tools/instance-manager/instance.h: Changed header to GPL version 2 only server-tools/instance-manager/instance_map.cc: Changed header to GPL version 2 only server-tools/instance-manager/instance_map.h: Changed header to GPL version 2 only server-tools/instance-manager/instance_options.cc: Changed header to GPL version 2 only server-tools/instance-manager/instance_options.h: Changed header to GPL version 2 only server-tools/instance-manager/listener.cc: Changed header to GPL version 2 only server-tools/instance-manager/listener.h: Changed header to GPL version 2 only server-tools/instance-manager/log.cc: Changed header to GPL version 2 only server-tools/instance-manager/log.h: Changed header to GPL version 2 only server-tools/instance-manager/manager.cc: Changed header to GPL version 2 only server-tools/instance-manager/manager.h: Changed header to GPL version 2 only server-tools/instance-manager/messages.cc: Changed header to GPL version 2 only server-tools/instance-manager/messages.h: Changed header to GPL version 2 only server-tools/instance-manager/mysql_connection.cc: Changed header to GPL version 2 only server-tools/instance-manager/mysql_connection.h: Changed header to GPL version 2 only server-tools/instance-manager/mysql_manager_error.h: Changed header to GPL version 2 only server-tools/instance-manager/mysqlmanager.cc: Changed header to GPL version 2 only server-tools/instance-manager/options.cc: Changed header to GPL version 2 only server-tools/instance-manager/options.h: Changed header to GPL version 2 only server-tools/instance-manager/parse.cc: Changed header to GPL version 2 only server-tools/instance-manager/parse.h: Changed header to GPL version 2 only server-tools/instance-manager/parse_output.cc: Changed header to GPL version 2 only server-tools/instance-manager/parse_output.h: Changed header to GPL version 2 only server-tools/instance-manager/priv.cc: Changed header to GPL version 2 only server-tools/instance-manager/priv.h: Changed header to GPL version 2 only server-tools/instance-manager/protocol.cc: Changed header to GPL version 2 only server-tools/instance-manager/protocol.h: Changed header to GPL version 2 only server-tools/instance-manager/thread_registry.cc: Changed header to GPL version 2 only server-tools/instance-manager/thread_registry.h: Changed header to GPL version 2 only server-tools/instance-manager/user_map.cc: Changed header to GPL version 2 only server-tools/instance-manager/user_map.h: Changed header to GPL version 2 only sql/Makefile.am: Changed header to GPL version 2 only sql/client_settings.h: Changed header to GPL version 2 only sql/custom_conf.h: Changed header to GPL version 2 only sql/derror.cc: Changed header to GPL version 2 only sql/des_key_file.cc: Changed header to GPL version 2 only sql/discover.cc: Changed header to GPL version 2 only sql/field.cc: Changed header to GPL version 2 only sql/field.h: Changed header to GPL version 2 only sql/field_conv.cc: Changed header to GPL version 2 only sql/filesort.cc: Changed header to GPL version 2 only sql/frm_crypt.cc: Changed header to GPL version 2 only sql/gen_lex_hash.cc: Changed header to GPL version 2 only sql/gstream.cc: Changed header to GPL version 2 only sql/gstream.h: Changed header to GPL version 2 only sql/ha_archive.cc: Changed header to GPL version 2 only sql/ha_archive.h: Changed header to GPL version 2 only sql/ha_berkeley.cc: Changed header to GPL version 2 only sql/ha_berkeley.h: Changed header to GPL version 2 only sql/ha_blackhole.cc: Changed header to GPL version 2 only sql/ha_blackhole.h: Changed header to GPL version 2 only sql/ha_federated.cc: Changed header to GPL version 2 only sql/ha_federated.h: Changed header to GPL version 2 only sql/ha_heap.cc: Changed header to GPL version 2 only sql/ha_heap.h: Changed header to GPL version 2 only sql/ha_innodb.cc: Changed header to GPL version 2 only sql/ha_innodb.h: Changed header to GPL version 2 only sql/ha_myisam.cc: Changed header to GPL version 2 only sql/ha_myisam.h: Changed header to GPL version 2 only sql/ha_myisammrg.cc: Changed header to GPL version 2 only sql/ha_myisammrg.h: Changed header to GPL version 2 only sql/ha_ndbcluster.cc: Changed header to GPL version 2 only sql/ha_ndbcluster.h: Changed header to GPL version 2 only sql/handler.cc: Changed header to GPL version 2 only sql/handler.h: Changed header to GPL version 2 only sql/hash_filo.cc: Changed header to GPL version 2 only sql/hash_filo.h: Changed header to GPL version 2 only sql/hostname.cc: Changed header to GPL version 2 only sql/init.cc: Changed header to GPL version 2 only sql/item.cc: Changed header to GPL version 2 only sql/item.h: Changed header to GPL version 2 only sql/item_buff.cc: Changed header to GPL version 2 only sql/item_cmpfunc.cc: Changed header to GPL version 2 only sql/item_cmpfunc.h: Changed header to GPL version 2 only sql/item_create.cc: Changed header to GPL version 2 only sql/item_create.h: Changed header to GPL version 2 only sql/item_func.cc: Changed header to GPL version 2 only sql/item_func.h: Changed header to GPL version 2 only sql/item_geofunc.cc: Changed header to GPL version 2 only sql/item_geofunc.h: Changed header to GPL version 2 only sql/item_row.cc: Changed header to GPL version 2 only sql/item_row.h: Changed header to GPL version 2 only sql/item_strfunc.cc: Changed header to GPL version 2 only sql/item_strfunc.h: Changed header to GPL version 2 only sql/item_subselect.cc: Changed header to GPL version 2 only sql/item_subselect.h: Changed header to GPL version 2 only sql/item_sum.cc: Changed header to GPL version 2 only sql/item_sum.h: Changed header to GPL version 2 only sql/item_timefunc.cc: Changed header to GPL version 2 only sql/item_timefunc.h: Changed header to GPL version 2 only sql/item_uniq.cc: Changed header to GPL version 2 only sql/item_uniq.h: Changed header to GPL version 2 only sql/key.cc: Changed header to GPL version 2 only sql/lex.h: Changed header to GPL version 2 only sql/lex_symbol.h: Changed header to GPL version 2 only sql/lock.cc: Changed header to GPL version 2 only sql/log.cc: Changed header to GPL version 2 only sql/log_event.cc: Changed header to GPL version 2 only sql/log_event.h: Changed header to GPL version 2 only sql/matherr.c: Changed header to GPL version 2 only sql/mf_iocache.cc: Changed header to GPL version 2 only sql/my_decimal.cc: Changed header to GPL version 2 only sql/my_decimal.h: Changed header to GPL version 2 only sql/my_lock.c: Changed header to GPL version 2 only sql/mysql_priv.h: Changed header to GPL version 2 only sql/mysqld.cc: Changed header to GPL version 2 only sql/mysqld_suffix.h: Changed header to GPL version 2 only sql/net_serv.cc: Changed header to GPL version 2 only sql/opt_range.cc: Changed header to GPL version 2 only sql/opt_range.h: Changed header to GPL version 2 only sql/opt_sum.cc: Changed header to GPL version 2 only sql/parse_file.cc: Changed header to GPL version 2 only sql/parse_file.h: Changed header to GPL version 2 only sql/password.c: Changed header to GPL version 2 only sql/procedure.cc: Changed header to GPL version 2 only sql/procedure.h: Changed header to GPL version 2 only sql/protocol.cc: Changed header to GPL version 2 only sql/protocol.h: Changed header to GPL version 2 only sql/records.cc: Changed header to GPL version 2 only sql/repl_failsafe.cc: Changed header to GPL version 2 only sql/repl_failsafe.h: Changed header to GPL version 2 only sql/set_var.cc: Changed header to GPL version 2 only sql/set_var.h: Changed header to GPL version 2 only sql/slave.cc: Changed header to GPL version 2 only sql/slave.h: Changed header to GPL version 2 only sql/sp.cc: Changed header to GPL version 2 only sql/sp.h: Changed header to GPL version 2 only sql/sp_cache.cc: Changed header to GPL version 2 only sql/sp_cache.h: Changed header to GPL version 2 only sql/sp_head.cc: Changed header to GPL version 2 only sql/sp_head.h: Changed header to GPL version 2 only sql/sp_pcontext.cc: Changed header to GPL version 2 only sql/sp_pcontext.h: Changed header to GPL version 2 only sql/sp_rcontext.cc: Changed header to GPL version 2 only sql/sp_rcontext.h: Changed header to GPL version 2 only sql/spatial.cc: Changed header to GPL version 2 only sql/spatial.h: Changed header to GPL version 2 only sql/sql_acl.cc: Changed header to GPL version 2 only sql/sql_acl.h: Changed header to GPL version 2 only sql/sql_analyse.cc: Changed header to GPL version 2 only sql/sql_analyse.h: Changed header to GPL version 2 only sql/sql_array.h: Changed header to GPL version 2 only sql/sql_base.cc: Changed header to GPL version 2 only sql/sql_bitmap.h: Changed header to GPL version 2 only sql/sql_cache.cc: Changed header to GPL version 2 only sql/sql_cache.h: Changed header to GPL version 2 only sql/sql_class.cc: Changed header to GPL version 2 only sql/sql_class.h: Changed header to GPL version 2 only sql/sql_client.cc: Changed header to GPL version 2 only sql/sql_crypt.cc: Changed header to GPL version 2 only sql/sql_crypt.h: Changed header to GPL version 2 only sql/sql_cursor.cc: Changed header to GPL version 2 only sql/sql_cursor.h: Changed header to GPL version 2 only sql/sql_db.cc: Changed header to GPL version 2 only sql/sql_delete.cc: Changed header to GPL version 2 only sql/sql_derived.cc: Changed header to GPL version 2 only sql/sql_do.cc: Changed header to GPL version 2 only sql/sql_error.cc: Changed header to GPL version 2 only sql/sql_error.h: Changed header to GPL version 2 only sql/sql_handler.cc: Changed header to GPL version 2 only sql/sql_help.cc: Changed header to GPL version 2 only sql/sql_insert.cc: Changed header to GPL version 2 only sql/sql_lex.cc: Changed header to GPL version 2 only sql/sql_lex.h: Changed header to GPL version 2 only sql/sql_list.cc: Changed header to GPL version 2 only sql/sql_list.h: Changed header to GPL version 2 only sql/sql_load.cc: Changed header to GPL version 2 only sql/sql_locale.cc: Changed header to GPL version 2 only sql/sql_manager.cc: Changed header to GPL version 2 only sql/sql_manager.h: Changed header to GPL version 2 only sql/sql_map.cc: Changed header to GPL version 2 only sql/sql_map.h: Changed header to GPL version 2 only sql/sql_olap.cc: Changed header to GPL version 2 only sql/sql_parse.cc: Changed header to GPL version 2 only sql/sql_prepare.cc: Changed header to GPL version 2 only sql/sql_rename.cc: Changed header to GPL version 2 only sql/sql_repl.cc: Changed header to GPL version 2 only sql/sql_repl.h: Changed header to GPL version 2 only sql/sql_select.cc: Changed header to GPL version 2 only sql/sql_select.h: Changed header to GPL version 2 only sql/sql_show.cc: Changed header to GPL version 2 only sql/sql_sort.h: Changed header to GPL version 2 only sql/sql_state.c: Changed header to GPL version 2 only sql/sql_string.cc: Changed header to GPL version 2 only sql/sql_string.h: Changed header to GPL version 2 only sql/sql_table.cc: Changed header to GPL version 2 only sql/sql_test.cc: Changed header to GPL version 2 only sql/sql_trigger.cc: Changed header to GPL version 2 only sql/sql_trigger.h: Changed header to GPL version 2 only sql/sql_udf.cc: Changed header to GPL version 2 only sql/sql_udf.h: Changed header to GPL version 2 only sql/sql_union.cc: Changed header to GPL version 2 only sql/sql_update.cc: Changed header to GPL version 2 only sql-bench/Makefile.am: Changed header to GPL version 2 only sql-bench/as3ap.sh: Changed header to GPL version 2 only sql-bench/bench-count-distinct.sh: Changed header to GPL version 2 only sql-bench/bench-init.pl.sh: Changed header to GPL version 2 only sql-bench/compare-results.sh: Changed header to GPL version 2 only sql-bench/copy-db.sh: Changed header to GPL version 2 only sql-bench/crash-me.sh: Changed header to GPL version 2 only sql-bench/print-limit-table: Changed header to GPL version 2 only sql-bench/run-all-tests.sh: Changed header to GPL version 2 only sql/examples/ha_example.cc: Changed header to GPL version 2 only sql/examples/ha_example.h: Changed header to GPL version 2 only sql/examples/ha_tina.cc: Changed header to GPL version 2 only sql/examples/ha_tina.h: Changed header to GPL version 2 only sql/share/Makefile.am: Changed header to GPL version 2 only sql/share/charsets/Index.xml: Changed header to GPL version 2 only sql/share/charsets/armscii8.xml: Changed header to GPL version 2 only sql/share/charsets/ascii.xml: Changed header to GPL version 2 only sql/share/charsets/cp1250.xml: Changed header to GPL version 2 only sql/share/charsets/cp1251.xml: Changed header to GPL version 2 only sql/share/charsets/cp1256.xml: Changed header to GPL version 2 only sql/share/charsets/cp1257.xml: Changed header to GPL version 2 only sql/share/charsets/cp850.xml: Changed header to GPL version 2 only sql/share/charsets/cp852.xml: Changed header to GPL version 2 only sql/share/charsets/cp866.xml: Changed header to GPL version 2 only sql/share/charsets/dec8.xml: Changed header to GPL version 2 only sql/share/charsets/geostd8.xml: Changed header to GPL version 2 only sql/share/charsets/greek.xml: Changed header to GPL version 2 only sql/share/charsets/hebrew.xml: Changed header to GPL version 2 only sql/share/charsets/hp8.xml: Changed header to GPL version 2 only sql/share/charsets/keybcs2.xml: Changed header to GPL version 2 only sql/share/charsets/koi8r.xml: Changed header to GPL version 2 only sql/share/charsets/koi8u.xml: Changed header to GPL version 2 only sql/share/charsets/latin1.xml: Changed header to GPL version 2 only sql/share/charsets/latin2.xml: Changed header to GPL version 2 only sql/share/charsets/latin5.xml: Changed header to GPL version 2 only sql/share/charsets/latin7.xml: Changed header to GPL version 2 only sql/share/charsets/macce.xml: Changed header to GPL version 2 only sql/share/charsets/macroman.xml: Changed header to GPL version 2 only sql/share/charsets/swe7.xml: Changed header to GPL version 2 only sql/sql_view.cc: Changed header to GPL version 2 only sql/sql_view.h: Changed header to GPL version 2 only sql/sql_yacc.yy: Changed header to GPL version 2 only sql/stacktrace.c: Changed header to GPL version 2 only sql/stacktrace.h: Changed header to GPL version 2 only sql/strfunc.cc: Changed header to GPL version 2 only sql/structs.h: Changed header to GPL version 2 only sql/table.cc: Changed header to GPL version 2 only sql/table.h: Changed header to GPL version 2 only sql/thr_malloc.cc: Changed header to GPL version 2 only sql/time.cc: Changed header to GPL version 2 only sql/tzfile.h: Changed header to GPL version 2 only sql/tztime.cc: Changed header to GPL version 2 only sql/tztime.h: Changed header to GPL version 2 only sql/udf_example.c: Changed header to GPL version 2 only sql/uniques.cc: Changed header to GPL version 2 only sql/unireg.cc: Changed header to GPL version 2 only sql/unireg.h: Changed header to GPL version 2 only sql-bench/server-cfg.sh: Changed header to GPL version 2 only sql-bench/test-ATIS.sh: Changed header to GPL version 2 only sql-bench/test-alter-table.sh: Changed header to GPL version 2 only sql-bench/test-big-tables.sh: Changed header to GPL version 2 only sql-bench/test-connect.sh: Changed header to GPL version 2 only sql-bench/test-create.sh: Changed header to GPL version 2 only sql-bench/test-insert.sh: Changed header to GPL version 2 only sql-bench/test-select.sh: Changed header to GPL version 2 only sql-bench/test-transactions.sh: Changed header to GPL version 2 only sql-bench/test-wisconsin.sh: Changed header to GPL version 2 only sql-common/Makefile.am: Changed header to GPL version 2 only sql-common/client.c: Changed header to GPL version 2 only sql-common/my_time.c: Changed header to GPL version 2 only sql-common/my_user.c: Changed header to GPL version 2 only sql-common/pack.c: Changed header to GPL version 2 only strings/Makefile.am: Changed header to GPL version 2 only strings/bchange.c: Changed header to GPL version 2 only strings/bcmp.c: Changed header to GPL version 2 only strings/bcopy-duff.c: Changed header to GPL version 2 only strings/bfill.c: Changed header to GPL version 2 only strings/bmove.c: Changed header to GPL version 2 only strings/bmove512.c: Changed header to GPL version 2 only strings/bmove_upp-sparc.s: Changed header to GPL version 2 only strings/bmove_upp.c: Changed header to GPL version 2 only strings/bzero.c: Changed header to GPL version 2 only strings/conf_to_src.c: Changed header to GPL version 2 only strings/ctype-big5.c: Changed header to GPL version 2 only strings/ctype-bin.c: Changed header to GPL version 2 only strings/ctype-cp932.c: Changed header to GPL version 2 only strings/ctype-czech.c: Changed header to GPL version 2 only strings/ctype-euc_kr.c: Changed header to GPL version 2 only strings/ctype-eucjpms.c: Changed header to GPL version 2 only strings/ctype-gb2312.c: Changed header to GPL version 2 only strings/ctype-gbk.c: Changed header to GPL version 2 only strings/ctype-latin1.c: Changed header to GPL version 2 only strings/ctype-mb.c: Changed header to GPL version 2 only strings/ctype-simple.c: Changed header to GPL version 2 only strings/ctype-sjis.c: Changed header to GPL version 2 only strings/ctype-tis620.c: Changed header to GPL version 2 only strings/ctype-uca.c: Changed header to GPL version 2 only strings/ctype-ucs2.c: Changed header to GPL version 2 only strings/ctype-ujis.c: Changed header to GPL version 2 only strings/ctype-utf8.c: Changed header to GPL version 2 only strings/ctype-win1250ch.c: Changed header to GPL version 2 only strings/ctype.c: Changed header to GPL version 2 only strings/decimal.c: Changed header to GPL version 2 only strings/do_ctype.c: Changed header to GPL version 2 only strings/int2str.c: Changed header to GPL version 2 only strings/is_prefix.c: Changed header to GPL version 2 only strings/llstr.c: Changed header to GPL version 2 only strings/longlong2str-x86.s: Changed header to GPL version 2 only strings/longlong2str.c: Changed header to GPL version 2 only strings/longlong2str_asm.c: Changed header to GPL version 2 only strings/macros.asm: Changed header to GPL version 2 only strings/memcmp.c: Changed header to GPL version 2 only strings/memcpy.c: Changed header to GPL version 2 only strings/memset.c: Changed header to GPL version 2 only strings/my_strtoll10-x86.s: Changed header to GPL version 2 only strings/my_strtoll10.c: Changed header to GPL version 2 only strings/my_vsnprintf.c: Changed header to GPL version 2 only strings/ptr_cmp.asm: Changed header to GPL version 2 only strings/r_strinstr.c: Changed header to GPL version 2 only strings/str2int.c: Changed header to GPL version 2 only strings/str_alloc.c: Changed header to GPL version 2 only strings/str_test.c: Changed header to GPL version 2 only strings/strappend-sparc.s: Changed header to GPL version 2 only strings/strappend.c: Changed header to GPL version 2 only strings/strcat.c: Changed header to GPL version 2 only strings/strcend.c: Changed header to GPL version 2 only strings/strchr.c: Changed header to GPL version 2 only strings/strcmp.c: Changed header to GPL version 2 only strings/strcont.c: Changed header to GPL version 2 only strings/strend-sparc.s: Changed header to GPL version 2 only strings/strend.c: Changed header to GPL version 2 only strings/strfill.c: Changed header to GPL version 2 only strings/strings-not-used.h: Changed header to GPL version 2 only strings/strings-x86.s: Changed header to GPL version 2 only strings/strings.asm: Changed header to GPL version 2 only strings/strinstr-sparc.s: Changed header to GPL version 2 only strings/strinstr.c: Changed header to GPL version 2 only strings/strlen.c: Changed header to GPL version 2 only strings/strmake-sparc.s: Changed header to GPL version 2 only strings/strmake.c: Changed header to GPL version 2 only strings/strmov-sparc.s: Changed header to GPL version 2 only strings/strmov.c: Changed header to GPL version 2 only strings/strnlen.c: Changed header to GPL version 2 only strings/strnmov-sparc.s: Changed header to GPL version 2 only strings/strnmov.c: Changed header to GPL version 2 only strings/strrchr.c: Changed header to GPL version 2 only strings/strstr-sparc.s: Changed header to GPL version 2 only strings/strstr.c: Changed header to GPL version 2 only strings/strto.c: Changed header to GPL version 2 only strings/strtol.c: Changed header to GPL version 2 only strings/strtoll.c: Changed header to GPL version 2 only strings/strtoul.c: Changed header to GPL version 2 only strings/strtoull.c: Changed header to GPL version 2 only strings/strxmov-sparc.s: Changed header to GPL version 2 only strings/strxmov.asm: Changed header to GPL version 2 only strings/strxmov.c: Changed header to GPL version 2 only strings/strxnmov.c: Changed header to GPL version 2 only strings/t_ctype.h: Changed header to GPL version 2 only strings/udiv.c: Changed header to GPL version 2 only strings/xml.c: Changed header to GPL version 2 only support-files/MacOSX/Makefile.am: Changed header to GPL version 2 only support-files/Makefile.am: Changed header to GPL version 2 only support-files/MySQL-shared-compat.spec.sh: Changed header to GPL version 2 only tests/Makefile.am: Changed header to GPL version 2 only tests/connect_test.c: Changed header to GPL version 2 only tests/deadlock_test.c: Changed header to GPL version 2 only tests/insert_test.c: Changed header to GPL version 2 only tests/list_test.c: Changed header to GPL version 2 only tests/mysql_client_test.c: Changed header to GPL version 2 only tests/select_test.c: Changed header to GPL version 2 only tests/showdb_test.c: Changed header to GPL version 2 only tests/ssl_test.c: Changed header to GPL version 2 only tests/thread_test.c: Changed header to GPL version 2 only tools/Makefile.am: Changed header to GPL version 2 only tools/mysqlmanager.c: Changed header to GPL version 2 only vio/Makefile.am: Changed header to GPL version 2 only vio/test-ssl.c: Changed header to GPL version 2 only vio/test-sslclient.c: Changed header to GPL version 2 only vio/test-sslserver.c: Changed header to GPL version 2 only vio/vio.c: Changed header to GPL version 2 only vio/vio_priv.h: Changed header to GPL version 2 only vio/viosocket.c: Changed header to GPL version 2 only vio/viossl.c: Changed header to GPL version 2 only vio/viosslfactories.c: Changed header to GPL version 2 only vio/viotest-ssl.c: Changed header to GPL version 2 only win/Makefile.am: Changed header to GPL version 2 only zlib/Makefile.am: Changed header to GPL version 2 only
		
			
				
	
	
		
			3108 lines
		
	
	
		
			85 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			3108 lines
		
	
	
		
			85 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
/* Copyright (C) 2000 MySQL AB
 | 
						||
 | 
						||
   This program is free software; you can redistribute it and/or modify
 | 
						||
   it under the terms of the GNU General Public License as published by
 | 
						||
   the Free Software Foundation; version 2 of the License.
 | 
						||
 | 
						||
   This program is distributed in the hope that it will be useful,
 | 
						||
   but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
						||
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
						||
   GNU General Public License for more details.
 | 
						||
 | 
						||
   You should have received a copy of the GNU General Public License
 | 
						||
   along with this program; if not, write to the Free Software
 | 
						||
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
 | 
						||
 | 
						||
#line 18 "decimal.c"
 | 
						||
 | 
						||
/*
 | 
						||
=======================================================================
 | 
						||
  NOTE: this library implements SQL standard "exact numeric" type
 | 
						||
  and is not at all generic, but rather intentinally crippled to
 | 
						||
  follow the standard :)
 | 
						||
=======================================================================
 | 
						||
  Quoting the standard
 | 
						||
  (SQL:2003, Part 2 Foundations, aka ISO/IEC 9075-2:2003)
 | 
						||
 | 
						||
4.4.2 Characteristics of numbers, page 27:
 | 
						||
 | 
						||
  An exact numeric type has a precision P and a scale S. P is a positive
 | 
						||
  integer that determines the number of significant digits in a
 | 
						||
  particular radix R, where R is either 2 or 10. S is a non-negative
 | 
						||
  integer. Every value of an exact numeric type of scale S is of the
 | 
						||
  form n*10^{-S}, where n is an integer such that -R^P <= n <= R^P.
 | 
						||
 | 
						||
  [...]
 | 
						||
 | 
						||
  If an assignment of some number would result in a loss of its most
 | 
						||
  significant digit, an exception condition is raised. If least
 | 
						||
  significant digits are lost, implementation-defined rounding or
 | 
						||
  truncating occurs, with no exception condition being raised.
 | 
						||
 | 
						||
  [...]
 | 
						||
 | 
						||
  Whenever an exact or approximate numeric value is assigned to an exact
 | 
						||
  numeric value site, an approximation of its value that preserves
 | 
						||
  leading significant digits after rounding or truncating is represented
 | 
						||
  in the declared type of the target. The value is converted to have the
 | 
						||
  precision and scale of the target. The choice of whether to truncate
 | 
						||
  or round is implementation-defined.
 | 
						||
 | 
						||
  [...]
 | 
						||
 | 
						||
  All numeric values between the smallest and the largest value,
 | 
						||
  inclusive, in a given exact numeric type have an approximation
 | 
						||
  obtained by rounding or truncation for that type; it is
 | 
						||
  implementation-defined which other numeric values have such
 | 
						||
  approximations.
 | 
						||
 | 
						||
5.3 <literal>, page 143
 | 
						||
 | 
						||
  <exact numeric literal> ::=
 | 
						||
    <unsigned integer> [ <period> [ <unsigned integer> ] ]
 | 
						||
  | <period> <unsigned integer>
 | 
						||
 | 
						||
6.1 <data type>, page 165:
 | 
						||
 | 
						||
  19) The <scale> of an <exact numeric type> shall not be greater than
 | 
						||
      the <precision> of the <exact numeric type>.
 | 
						||
 | 
						||
  20) For the <exact numeric type>s DECIMAL and NUMERIC:
 | 
						||
 | 
						||
    a) The maximum value of <precision> is implementation-defined.
 | 
						||
       <precision> shall not be greater than this value.
 | 
						||
    b) The maximum value of <scale> is implementation-defined. <scale>
 | 
						||
       shall not be greater than this maximum value.
 | 
						||
 | 
						||
  21) NUMERIC specifies the data type exact numeric, with the decimal
 | 
						||
      precision and scale specified by the <precision> and <scale>.
 | 
						||
 | 
						||
  22) DECIMAL specifies the data type exact numeric, with the decimal
 | 
						||
      scale specified by the <scale> and the implementation-defined
 | 
						||
      decimal precision equal to or greater than the value of the
 | 
						||
      specified <precision>.
 | 
						||
 | 
						||
6.26 <numeric value expression>, page 241:
 | 
						||
 | 
						||
  1) If the declared type of both operands of a dyadic arithmetic
 | 
						||
     operator is exact numeric, then the declared type of the result is
 | 
						||
     an implementation-defined exact numeric type, with precision and
 | 
						||
     scale determined as follows:
 | 
						||
 | 
						||
   a) Let S1 and S2 be the scale of the first and second operands
 | 
						||
      respectively.
 | 
						||
   b) The precision of the result of addition and subtraction is
 | 
						||
      implementation-defined, and the scale is the maximum of S1 and S2.
 | 
						||
   c) The precision of the result of multiplication is
 | 
						||
      implementation-defined, and the scale is S1 + S2.
 | 
						||
   d) The precision and scale of the result of division are
 | 
						||
      implementation-defined.
 | 
						||
*/
 | 
						||
 | 
						||
#include <my_global.h>
 | 
						||
#include <m_ctype.h>
 | 
						||
#include <myisampack.h>
 | 
						||
#include <my_sys.h> /* for my_alloca */
 | 
						||
#include <m_string.h>
 | 
						||
#include <decimal.h>
 | 
						||
 | 
						||
/*
 | 
						||
  Internally decimal numbers are stored base 10^9 (see DIG_BASE below)
 | 
						||
  So one variable of type decimal_digit_t is limited:
 | 
						||
 | 
						||
      0 < decimal_digit <= DIG_MAX < DIG_BASE
 | 
						||
 | 
						||
  in the struct st_decimal_t:
 | 
						||
 | 
						||
    intg is the number of *decimal* digits (NOT number of decimal_digit_t's !)
 | 
						||
         before the point
 | 
						||
    frac - number of decimal digits after the point
 | 
						||
    buf is an array of decimal_digit_t's
 | 
						||
    len is the length of buf (length of allocated space) in decimal_digit_t's,
 | 
						||
        not in bytes
 | 
						||
*/
 | 
						||
typedef decimal_digit_t dec1;
 | 
						||
typedef longlong      dec2;
 | 
						||
 | 
						||
#define DIG_PER_DEC1 9
 | 
						||
#define DIG_MASK     100000000
 | 
						||
#define DIG_BASE     1000000000
 | 
						||
#define DIG_MAX      (DIG_BASE-1)
 | 
						||
#define DIG_BASE2    ((dec2)DIG_BASE * (dec2)DIG_BASE)
 | 
						||
#define ROUND_UP(X)  (((X)+DIG_PER_DEC1-1)/DIG_PER_DEC1)
 | 
						||
static const dec1 powers10[DIG_PER_DEC1+1]={
 | 
						||
  1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000};
 | 
						||
static const int dig2bytes[DIG_PER_DEC1+1]={0, 1, 1, 2, 2, 3, 3, 4, 4, 4};
 | 
						||
static const dec1 frac_max[DIG_PER_DEC1-1]={
 | 
						||
  900000000, 990000000, 999000000,
 | 
						||
  999900000, 999990000, 999999000,
 | 
						||
  999999900, 999999990 };
 | 
						||
static double scaler10[]= {
 | 
						||
  1.0, 1e10, 1e20, 1e30, 1e40, 1e50, 1e60, 1e70, 1e80, 1e90
 | 
						||
};
 | 
						||
static double scaler1[]= {
 | 
						||
  1.0, 10.0, 1e2, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9
 | 
						||
};
 | 
						||
 | 
						||
#ifdef HAVE_purify
 | 
						||
#define sanity(d) DBUG_ASSERT((d)->len > 0)
 | 
						||
#else
 | 
						||
#define sanity(d) DBUG_ASSERT((d)->len >0 && ((d)->buf[0] | \
 | 
						||
                              (d)->buf[(d)->len-1] | 1))
 | 
						||
#endif
 | 
						||
 | 
						||
#define FIX_INTG_FRAC_ERROR(len, intg1, frac1, error)                   \
 | 
						||
        do                                                              \
 | 
						||
        {                                                               \
 | 
						||
          if (unlikely(intg1+frac1 > (len)))                            \
 | 
						||
          {                                                             \
 | 
						||
            if (unlikely(intg1 > (len)))                                \
 | 
						||
            {                                                           \
 | 
						||
              intg1=(len);                                              \
 | 
						||
              frac1=0;                                                  \
 | 
						||
              error=E_DEC_OVERFLOW;                                     \
 | 
						||
            }                                                           \
 | 
						||
            else                                                        \
 | 
						||
            {                                                           \
 | 
						||
              frac1=(len)-intg1;                                        \
 | 
						||
              error=E_DEC_TRUNCATED;                                    \
 | 
						||
            }                                                           \
 | 
						||
          }                                                             \
 | 
						||
          else                                                          \
 | 
						||
            error=E_DEC_OK;                                             \
 | 
						||
        } while(0)
 | 
						||
 | 
						||
#define ADD(to, from1, from2, carry)  /* assume carry <= 1 */           \
 | 
						||
        do                                                              \
 | 
						||
        {                                                               \
 | 
						||
          dec1 a=(from1)+(from2)+(carry);                               \
 | 
						||
          DBUG_ASSERT((carry) <= 1);                                    \
 | 
						||
          if (((carry)= a >= DIG_BASE)) /* no division here! */         \
 | 
						||
            a-=DIG_BASE;                                                \
 | 
						||
          (to)=a;                                                       \
 | 
						||
        } while(0)
 | 
						||
 | 
						||
#define ADD2(to, from1, from2, carry)                                   \
 | 
						||
        do                                                              \
 | 
						||
        {                                                               \
 | 
						||
          dec2 a=((dec2)(from1))+(from2)+(carry);                       \
 | 
						||
          if (((carry)= a >= DIG_BASE))                                 \
 | 
						||
            a-=DIG_BASE;                                                \
 | 
						||
          if (unlikely(a >= DIG_BASE))                                  \
 | 
						||
          {                                                             \
 | 
						||
            a-=DIG_BASE;                                                \
 | 
						||
            carry++;                                                    \
 | 
						||
          }                                                             \
 | 
						||
          (to)=(dec1) a;                                                \
 | 
						||
        } while(0)
 | 
						||
 | 
						||
#define SUB(to, from1, from2, carry) /* to=from1-from2 */               \
 | 
						||
        do                                                              \
 | 
						||
        {                                                               \
 | 
						||
          dec1 a=(from1)-(from2)-(carry);                               \
 | 
						||
          if (((carry)= a < 0))                                         \
 | 
						||
            a+=DIG_BASE;                                                \
 | 
						||
          (to)=a;                                                       \
 | 
						||
        } while(0)
 | 
						||
 | 
						||
#define SUB2(to, from1, from2, carry) /* to=from1-from2 */              \
 | 
						||
        do                                                              \
 | 
						||
        {                                                               \
 | 
						||
          dec1 a=(from1)-(from2)-(carry);                               \
 | 
						||
          if (((carry)= a < 0))                                         \
 | 
						||
            a+=DIG_BASE;                                                \
 | 
						||
          if (unlikely(a < 0))                                          \
 | 
						||
          {                                                             \
 | 
						||
            a+=DIG_BASE;                                                \
 | 
						||
            carry++;                                                    \
 | 
						||
          }                                                             \
 | 
						||
          (to)=a;                                                       \
 | 
						||
        } while(0)
 | 
						||
 | 
						||
/*
 | 
						||
  Get maximum value for given precision and scale
 | 
						||
 | 
						||
  SYNOPSIS
 | 
						||
    max_decimal()
 | 
						||
    precision/scale - see decimal_bin_size() below
 | 
						||
    to              - decimal where where the result will be stored
 | 
						||
                      to->buf and to->len must be set.
 | 
						||
*/
 | 
						||
 | 
						||
void max_decimal(int precision, int frac, decimal_t *to)
 | 
						||
{
 | 
						||
  int intpart;
 | 
						||
  dec1 *buf= to->buf;
 | 
						||
  DBUG_ASSERT(precision && precision >= frac);
 | 
						||
 | 
						||
  to->sign= 0;
 | 
						||
  if ((intpart= to->intg= (precision - frac)))
 | 
						||
  {
 | 
						||
    int firstdigits= intpart % DIG_PER_DEC1;
 | 
						||
    if (firstdigits)
 | 
						||
      *buf++= powers10[firstdigits] - 1; /* get 9 99 999 ... */
 | 
						||
    for(intpart/= DIG_PER_DEC1; intpart; intpart--)
 | 
						||
      *buf++= DIG_MAX;
 | 
						||
  }
 | 
						||
 | 
						||
  if ((to->frac= frac))
 | 
						||
  {
 | 
						||
    int lastdigits= frac % DIG_PER_DEC1;
 | 
						||
    for(frac/= DIG_PER_DEC1; frac; frac--)
 | 
						||
      *buf++= DIG_MAX;
 | 
						||
    if (lastdigits)
 | 
						||
      *buf= frac_max[lastdigits - 1];
 | 
						||
  }
 | 
						||
}
 | 
						||
 | 
						||
 | 
						||
static dec1 *remove_leading_zeroes(decimal_t *from, int *intg_result)
 | 
						||
{
 | 
						||
  int intg= from->intg, i;
 | 
						||
  dec1 *buf0= from->buf;
 | 
						||
  i= ((intg - 1) % DIG_PER_DEC1) + 1;
 | 
						||
  while (intg > 0 && *buf0 == 0)
 | 
						||
  {
 | 
						||
    intg-= i;
 | 
						||
    i= DIG_PER_DEC1;
 | 
						||
    buf0++;
 | 
						||
  }
 | 
						||
  if (intg > 0)
 | 
						||
  {
 | 
						||
    for (i= (intg - 1) % DIG_PER_DEC1; *buf0 < powers10[i--]; intg--) ;
 | 
						||
    DBUG_ASSERT(intg > 0);
 | 
						||
  }
 | 
						||
  else
 | 
						||
    intg=0;
 | 
						||
  *intg_result= intg;
 | 
						||
  return buf0;
 | 
						||
}
 | 
						||
 | 
						||
 | 
						||
/*
 | 
						||
  Count actual length of fraction part (without ending zeroes)
 | 
						||
 | 
						||
  SYNOPSIS
 | 
						||
    decimal_actual_fraction()
 | 
						||
    from    number for processing
 | 
						||
*/
 | 
						||
 | 
						||
int decimal_actual_fraction(decimal_t *from)
 | 
						||
{
 | 
						||
  int frac= from->frac, i;
 | 
						||
  dec1 *buf0= from->buf + ROUND_UP(from->intg) + ROUND_UP(frac) - 1;
 | 
						||
 | 
						||
  if (frac == 0)
 | 
						||
    return 0;
 | 
						||
 | 
						||
  i= ((frac - 1) % DIG_PER_DEC1 + 1);
 | 
						||
  while (frac > 0 && *buf0 == 0)
 | 
						||
  {
 | 
						||
    frac-= i;
 | 
						||
    i= DIG_PER_DEC1;
 | 
						||
    buf0--;
 | 
						||
  }
 | 
						||
  if (frac > 0)
 | 
						||
  {
 | 
						||
    for (i= DIG_PER_DEC1 - ((frac - 1) % DIG_PER_DEC1);
 | 
						||
         *buf0 % powers10[i++] == 0;
 | 
						||
         frac--);
 | 
						||
  }
 | 
						||
  return frac;
 | 
						||
}
 | 
						||
 | 
						||
 | 
						||
/*
 | 
						||
  Convert decimal to its printable string representation
 | 
						||
 | 
						||
  SYNOPSIS
 | 
						||
    decimal2string()
 | 
						||
      from            - value to convert
 | 
						||
      to              - points to buffer where string representation
 | 
						||
                        should be stored
 | 
						||
      *to_len         - in:  size of to buffer
 | 
						||
                        out: length of the actually written string
 | 
						||
      fixed_precision - 0 if representation can be variable length and
 | 
						||
                        fixed_decimals will not be checked in this case.
 | 
						||
                        Put number as with fixed point position with this
 | 
						||
                        number of digits (sign counted and decimal point is
 | 
						||
                        counted)
 | 
						||
      fixed_decimals  - number digits after point.
 | 
						||
      filler          - character to fill gaps in case of fixed_precision > 0
 | 
						||
 | 
						||
  RETURN VALUE
 | 
						||
    E_DEC_OK/E_DEC_TRUNCATED/E_DEC_OVERFLOW
 | 
						||
*/
 | 
						||
 | 
						||
int decimal2string(decimal_t *from, char *to, int *to_len,
 | 
						||
                   int fixed_precision, int fixed_decimals,
 | 
						||
                   char filler)
 | 
						||
{
 | 
						||
  int len, intg, frac= from->frac, i, intg_len, frac_len, fill;
 | 
						||
  /* number digits before decimal point */
 | 
						||
  int fixed_intg= (fixed_precision ?
 | 
						||
                   (fixed_precision - fixed_decimals) : 0);
 | 
						||
  int error=E_DEC_OK;
 | 
						||
  char *s=to;
 | 
						||
  dec1 *buf, *buf0=from->buf, tmp;
 | 
						||
 | 
						||
  DBUG_ASSERT(*to_len >= 2+from->sign);
 | 
						||
 | 
						||
  /* removing leading zeroes */
 | 
						||
  buf0= remove_leading_zeroes(from, &intg);
 | 
						||
  if (unlikely(intg+frac==0))
 | 
						||
  {
 | 
						||
    intg=1;
 | 
						||
    tmp=0;
 | 
						||
    buf0=&tmp;
 | 
						||
  }
 | 
						||
 | 
						||
  if (!(intg_len= fixed_precision ? fixed_intg : intg))
 | 
						||
    intg_len= 1;
 | 
						||
  frac_len= fixed_precision ? fixed_decimals : frac;
 | 
						||
  len= from->sign + intg_len + test(frac) + frac_len;
 | 
						||
  if (fixed_precision)
 | 
						||
  {
 | 
						||
    if (frac > fixed_decimals)
 | 
						||
    {
 | 
						||
      error= E_DEC_TRUNCATED;
 | 
						||
      frac= fixed_decimals;
 | 
						||
    }
 | 
						||
    if (intg > fixed_intg)
 | 
						||
    {
 | 
						||
      error= E_DEC_OVERFLOW;
 | 
						||
      intg= fixed_intg;
 | 
						||
    }
 | 
						||
  }
 | 
						||
  else if (unlikely(len > --*to_len)) /* reserve one byte for \0 */
 | 
						||
  {
 | 
						||
    int i=len-*to_len;
 | 
						||
    error= (frac && i <= frac + 1) ? E_DEC_TRUNCATED : E_DEC_OVERFLOW;
 | 
						||
    if (frac && i >= frac + 1) i--;
 | 
						||
    if (i > frac)
 | 
						||
    {
 | 
						||
      intg-= i-frac;
 | 
						||
      frac= 0;
 | 
						||
    }
 | 
						||
    else
 | 
						||
      frac-=i;
 | 
						||
    len= from->sign + intg_len + test(frac) + frac_len;
 | 
						||
  }
 | 
						||
  *to_len=len;
 | 
						||
  s[len]=0;
 | 
						||
 | 
						||
  if (from->sign)
 | 
						||
    *s++='-';
 | 
						||
 | 
						||
  if (frac)
 | 
						||
  {
 | 
						||
    char *s1= s + intg_len;
 | 
						||
    fill= frac_len - frac;
 | 
						||
    buf=buf0+ROUND_UP(intg);
 | 
						||
    *s1++='.';
 | 
						||
    for (; frac>0; frac-=DIG_PER_DEC1)
 | 
						||
    {
 | 
						||
      dec1 x=*buf++;
 | 
						||
      for (i=min(frac, DIG_PER_DEC1); i; i--)
 | 
						||
      {
 | 
						||
        dec1 y=x/DIG_MASK;
 | 
						||
        *s1++='0'+(uchar)y;
 | 
						||
        x-=y*DIG_MASK;
 | 
						||
        x*=10;
 | 
						||
      }
 | 
						||
    }
 | 
						||
    for(; fill; fill--)
 | 
						||
      *s1++=filler;
 | 
						||
  }
 | 
						||
 | 
						||
  fill= intg_len - intg;
 | 
						||
  if (intg == 0)
 | 
						||
    fill--; /* symbol 0 before digital point */
 | 
						||
  for(; fill; fill--)
 | 
						||
    *s++=filler;
 | 
						||
  if (intg)
 | 
						||
  {
 | 
						||
    s+=intg;
 | 
						||
    for (buf=buf0+ROUND_UP(intg); intg>0; intg-=DIG_PER_DEC1)
 | 
						||
    {
 | 
						||
      dec1 x=*--buf;
 | 
						||
      for (i=min(intg, DIG_PER_DEC1); i; i--)
 | 
						||
      {
 | 
						||
        dec1 y=x/10;
 | 
						||
        *--s='0'+(uchar)(x-y*10);
 | 
						||
        x=y;
 | 
						||
      }
 | 
						||
    }
 | 
						||
  }
 | 
						||
  else
 | 
						||
    *s= '0';
 | 
						||
  return error;
 | 
						||
}
 | 
						||
 | 
						||
 | 
						||
/*
 | 
						||
  Return bounds of decimal digits in the number
 | 
						||
 | 
						||
  SYNOPSIS
 | 
						||
    digits_bounds()
 | 
						||
      from         - decimal number for processing
 | 
						||
      start_result - index (from 0 ) of first decimal digits will
 | 
						||
                     be written by this address
 | 
						||
      end_result   - index of position just after last decimal digit
 | 
						||
                     be written by this address
 | 
						||
*/
 | 
						||
 | 
						||
static void digits_bounds(decimal_t *from, int *start_result, int *end_result)
 | 
						||
{
 | 
						||
  int start, stop, i;
 | 
						||
  dec1 *buf_beg= from->buf;
 | 
						||
  dec1 *end= from->buf + ROUND_UP(from->intg) + ROUND_UP(from->frac);
 | 
						||
  dec1 *buf_end= end - 1;
 | 
						||
 | 
						||
  /* find non-zero digit from number begining */
 | 
						||
  while (buf_beg < end && *buf_beg == 0)
 | 
						||
    buf_beg++;
 | 
						||
 | 
						||
  if (buf_beg >= end)
 | 
						||
  {
 | 
						||
    /* it is zero */
 | 
						||
    *start_result= *end_result= 0;
 | 
						||
    return;
 | 
						||
  }
 | 
						||
 | 
						||
  /* find non-zero decimal digit from number begining */
 | 
						||
  if (buf_beg == from->buf && from->intg)
 | 
						||
  {
 | 
						||
    start= DIG_PER_DEC1 - (i= ((from->intg-1) % DIG_PER_DEC1 + 1));
 | 
						||
    i--;
 | 
						||
  }
 | 
						||
  else
 | 
						||
  {
 | 
						||
    i= DIG_PER_DEC1 - 1;
 | 
						||
    start= (int) ((buf_beg - from->buf) * DIG_PER_DEC1);
 | 
						||
  }
 | 
						||
  if (buf_beg < end)
 | 
						||
    for (; *buf_beg < powers10[i--]; start++) ;
 | 
						||
  *start_result= start; /* index of first decimal digit (from 0) */
 | 
						||
 | 
						||
  /* find non-zero digit at the end */
 | 
						||
  while (buf_end > buf_beg  && *buf_end == 0)
 | 
						||
    buf_end--;
 | 
						||
  /* find non-zero decimal digit from the end */
 | 
						||
  if (buf_end == end - 1 && from->frac)
 | 
						||
  {
 | 
						||
    stop= (int) (((buf_end - from->buf) * DIG_PER_DEC1 +
 | 
						||
           (i= ((from->frac - 1) % DIG_PER_DEC1 + 1))));
 | 
						||
    i= DIG_PER_DEC1 - i + 1;
 | 
						||
  }
 | 
						||
  else
 | 
						||
  {
 | 
						||
    stop= (int) ((buf_end - from->buf + 1) * DIG_PER_DEC1);
 | 
						||
    i= 1;
 | 
						||
  }
 | 
						||
  for (; *buf_end % powers10[i++] == 0; stop--);
 | 
						||
  *end_result= stop; /* index of position after last decimal digit (from 0) */
 | 
						||
}
 | 
						||
 | 
						||
 | 
						||
/*
 | 
						||
  Left shift for alignment of data in buffer
 | 
						||
 | 
						||
  SYNOPSIS
 | 
						||
    do_mini_left_shift()
 | 
						||
    dec     pointer to decimal number which have to be shifted
 | 
						||
    shift   number of decimal digits on which it should be shifted
 | 
						||
    beg/end bounds of decimal digits (see digits_bounds())
 | 
						||
 | 
						||
  NOTE
 | 
						||
    Result fitting in the buffer should be garanted.
 | 
						||
    'shift' have to be from 1 to DIG_PER_DEC1-1 (inclusive)
 | 
						||
*/
 | 
						||
 | 
						||
void do_mini_left_shift(decimal_t *dec, int shift, int beg, int last)
 | 
						||
{
 | 
						||
  dec1 *from= dec->buf + ROUND_UP(beg + 1) - 1;
 | 
						||
  dec1 *end= dec->buf + ROUND_UP(last) - 1;
 | 
						||
  int c_shift= DIG_PER_DEC1 - shift;
 | 
						||
  DBUG_ASSERT(from >= dec->buf);
 | 
						||
  DBUG_ASSERT(end < dec->buf + dec->len);
 | 
						||
  if (beg % DIG_PER_DEC1 < shift)
 | 
						||
    *(from - 1)= (*from) / powers10[c_shift];
 | 
						||
  for(; from < end; from++)
 | 
						||
    *from= ((*from % powers10[c_shift]) * powers10[shift] +
 | 
						||
            (*(from + 1)) / powers10[c_shift]);
 | 
						||
  *from= (*from % powers10[c_shift]) * powers10[shift];
 | 
						||
}
 | 
						||
 | 
						||
 | 
						||
/*
 | 
						||
  Right shift for alignment of data in buffer
 | 
						||
 | 
						||
  SYNOPSIS
 | 
						||
    do_mini_left_shift()
 | 
						||
    dec     pointer to decimal number which have to be shifted
 | 
						||
    shift   number of decimal digits on which it should be shifted
 | 
						||
    beg/end bounds of decimal digits (see digits_bounds())
 | 
						||
 | 
						||
  NOTE
 | 
						||
    Result fitting in the buffer should be garanted.
 | 
						||
    'shift' have to be from 1 to DIG_PER_DEC1-1 (inclusive)
 | 
						||
*/
 | 
						||
 | 
						||
void do_mini_right_shift(decimal_t *dec, int shift, int beg, int last)
 | 
						||
{
 | 
						||
  dec1 *from= dec->buf + ROUND_UP(last) - 1;
 | 
						||
  dec1 *end= dec->buf + ROUND_UP(beg + 1) - 1;
 | 
						||
  int c_shift= DIG_PER_DEC1 - shift;
 | 
						||
  DBUG_ASSERT(from < dec->buf + dec->len);
 | 
						||
  DBUG_ASSERT(end >= dec->buf);
 | 
						||
  if (DIG_PER_DEC1 - ((last - 1) % DIG_PER_DEC1 + 1) < shift)
 | 
						||
    *(from + 1)= (*from % powers10[shift]) * powers10[c_shift];
 | 
						||
  for(; from > end; from--)
 | 
						||
    *from= (*from / powers10[shift] +
 | 
						||
            (*(from - 1) % powers10[shift]) * powers10[c_shift]);
 | 
						||
  *from= *from / powers10[shift];
 | 
						||
}
 | 
						||
 | 
						||
 | 
						||
/*
 | 
						||
  Shift of decimal digits in given number (with rounding if it need)
 | 
						||
 | 
						||
  SYNOPSIS
 | 
						||
    decimal_shift()
 | 
						||
    dec       number to be shifted
 | 
						||
    shift     number of decimal positions
 | 
						||
              shift > 0 means shift to left shift
 | 
						||
              shift < 0 meand right shift
 | 
						||
  NOTE
 | 
						||
    In fact it is multipling on 10^shift.
 | 
						||
  RETURN
 | 
						||
    E_DEC_OK          OK
 | 
						||
    E_DEC_OVERFLOW    operation lead to overflow, number is untoched
 | 
						||
    E_DEC_TRUNCATED   number was rounded to fit into buffer
 | 
						||
*/
 | 
						||
 | 
						||
int decimal_shift(decimal_t *dec, int shift)
 | 
						||
{
 | 
						||
  /* index of first non zero digit (all indexes from 0) */
 | 
						||
  int beg;
 | 
						||
  /* index of position after last decimal digit */
 | 
						||
  int end;
 | 
						||
  /* index of digit position just after point */
 | 
						||
  int point= ROUND_UP(dec->intg) * DIG_PER_DEC1;
 | 
						||
  /* new point position */
 | 
						||
  int new_point= point + shift;
 | 
						||
  /* number of digits in result */
 | 
						||
  int digits_int, digits_frac;
 | 
						||
  /* length of result and new fraction in big digits*/
 | 
						||
  int new_len, new_frac_len;
 | 
						||
  /* return code */
 | 
						||
  int err= E_DEC_OK;
 | 
						||
  int new_front;
 | 
						||
 | 
						||
  if (shift == 0)
 | 
						||
    return E_DEC_OK;
 | 
						||
 | 
						||
  digits_bounds(dec, &beg, &end);
 | 
						||
 | 
						||
  if (beg == end)
 | 
						||
  {
 | 
						||
    decimal_make_zero(dec);
 | 
						||
    return E_DEC_OK;
 | 
						||
  }
 | 
						||
 | 
						||
  digits_int= new_point - beg;
 | 
						||
  set_if_bigger(digits_int, 0);
 | 
						||
  digits_frac= end - new_point;
 | 
						||
  set_if_bigger(digits_frac, 0);
 | 
						||
 | 
						||
  if ((new_len= ROUND_UP(digits_int) + (new_frac_len= ROUND_UP(digits_frac))) >
 | 
						||
      dec->len)
 | 
						||
  {
 | 
						||
    int lack= new_len - dec->len;
 | 
						||
    int diff;
 | 
						||
 | 
						||
    if (new_frac_len < lack)
 | 
						||
      return E_DEC_OVERFLOW; /* lack more then we have in fraction */
 | 
						||
 | 
						||
    /* cat off fraction part to allow new number to fit in our buffer */
 | 
						||
    err= E_DEC_TRUNCATED;
 | 
						||
    new_frac_len-= lack;
 | 
						||
    diff= digits_frac - (new_frac_len * DIG_PER_DEC1);
 | 
						||
    /* Make rounding method as parameter? */
 | 
						||
    decimal_round(dec, dec, end - point - diff, HALF_UP);
 | 
						||
    end-= diff;
 | 
						||
    digits_frac= new_frac_len * DIG_PER_DEC1;
 | 
						||
 | 
						||
    if (end <= beg)
 | 
						||
    {
 | 
						||
      /*
 | 
						||
        we lost all digits (they will be shifted out of buffer), so we can
 | 
						||
        just return 0
 | 
						||
      */
 | 
						||
      decimal_make_zero(dec);
 | 
						||
      return E_DEC_TRUNCATED;
 | 
						||
    }
 | 
						||
  }
 | 
						||
 | 
						||
  if (shift % DIG_PER_DEC1)
 | 
						||
  {
 | 
						||
    int l_mini_shift, r_mini_shift, mini_shift;
 | 
						||
    int do_left;
 | 
						||
    /*
 | 
						||
      Calculate left/right shift to align decimal digits inside our bug
 | 
						||
      digits correctly
 | 
						||
    */
 | 
						||
    if (shift > 0)
 | 
						||
    {
 | 
						||
      l_mini_shift= shift % DIG_PER_DEC1;
 | 
						||
      r_mini_shift= DIG_PER_DEC1 - l_mini_shift;
 | 
						||
      /*
 | 
						||
        It is left shift so prefer left shift, but if we have not place from
 | 
						||
        left, we have to have it from right, because we checked length of
 | 
						||
        result
 | 
						||
      */
 | 
						||
      do_left= l_mini_shift <= beg;
 | 
						||
      DBUG_ASSERT(do_left || (dec->len * DIG_PER_DEC1 - end) >= r_mini_shift);
 | 
						||
    }
 | 
						||
    else
 | 
						||
    {
 | 
						||
      r_mini_shift= (-shift) % DIG_PER_DEC1;
 | 
						||
      l_mini_shift= DIG_PER_DEC1 - r_mini_shift;
 | 
						||
      /* see comment above */
 | 
						||
      do_left= !((dec->len * DIG_PER_DEC1 - end) >= r_mini_shift);
 | 
						||
      DBUG_ASSERT(!do_left || l_mini_shift <= beg);
 | 
						||
    }
 | 
						||
    if (do_left)
 | 
						||
    {
 | 
						||
      do_mini_left_shift(dec, l_mini_shift, beg, end);
 | 
						||
      mini_shift=- l_mini_shift;
 | 
						||
    }
 | 
						||
    else
 | 
						||
    {
 | 
						||
      do_mini_right_shift(dec, r_mini_shift, beg, end);
 | 
						||
      mini_shift= r_mini_shift;
 | 
						||
    }
 | 
						||
    new_point+= mini_shift;
 | 
						||
    /*
 | 
						||
      If number is shifted and correctly aligned in buffer we can
 | 
						||
      finish
 | 
						||
    */
 | 
						||
    if (!(shift+= mini_shift) && (new_point - digits_int) < DIG_PER_DEC1)
 | 
						||
    {
 | 
						||
      dec->intg= digits_int;
 | 
						||
      dec->frac= digits_frac;
 | 
						||
      return err;                 /* already shifted as it should be */
 | 
						||
    }
 | 
						||
    beg+= mini_shift;
 | 
						||
    end+= mini_shift;
 | 
						||
  }
 | 
						||
 | 
						||
  /* if new 'decimal front' is in first digit, we do not need move digits */
 | 
						||
  if ((new_front= (new_point - digits_int)) >= DIG_PER_DEC1 ||
 | 
						||
      new_front < 0)
 | 
						||
  {
 | 
						||
    /* need to move digits */
 | 
						||
    int d_shift;
 | 
						||
    dec1 *to, *barier;
 | 
						||
    if (new_front > 0)
 | 
						||
    {
 | 
						||
      /* move left */
 | 
						||
      d_shift= new_front / DIG_PER_DEC1;
 | 
						||
      to= dec->buf + (ROUND_UP(beg + 1) - 1 - d_shift);
 | 
						||
      barier= dec->buf + (ROUND_UP(end) - 1 - d_shift);
 | 
						||
      DBUG_ASSERT(to >= dec->buf);
 | 
						||
      DBUG_ASSERT(barier + d_shift < dec->buf + dec->len);
 | 
						||
      for(; to <= barier; to++)
 | 
						||
        *to= *(to + d_shift);
 | 
						||
      for(barier+= d_shift; to <= barier; to++)
 | 
						||
        *to= 0;
 | 
						||
      d_shift= -d_shift;
 | 
						||
    }
 | 
						||
    else
 | 
						||
    {
 | 
						||
      /* move right */
 | 
						||
      d_shift= (1 - new_front) / DIG_PER_DEC1;
 | 
						||
      to= dec->buf + ROUND_UP(end) - 1 + d_shift;
 | 
						||
      barier= dec->buf + ROUND_UP(beg + 1) - 1 + d_shift;
 | 
						||
      DBUG_ASSERT(to < dec->buf + dec->len);
 | 
						||
      DBUG_ASSERT(barier - d_shift >= dec->buf);
 | 
						||
      for(; to >= barier; to--)
 | 
						||
        *to= *(to - d_shift);
 | 
						||
      for(barier-= d_shift; to >= barier; to--)
 | 
						||
        *to= 0;
 | 
						||
    }
 | 
						||
    d_shift*= DIG_PER_DEC1;
 | 
						||
    beg+= d_shift;
 | 
						||
    end+= d_shift;
 | 
						||
    new_point+= d_shift;
 | 
						||
  }
 | 
						||
 | 
						||
  /*
 | 
						||
    If there are gaps then fill ren with 0.
 | 
						||
 | 
						||
    Only one of following 'for' loops will work becouse beg <= end
 | 
						||
  */
 | 
						||
  beg= ROUND_UP(beg + 1) - 1;
 | 
						||
  end= ROUND_UP(end) - 1;
 | 
						||
  DBUG_ASSERT(new_point >= 0);
 | 
						||
  
 | 
						||
  /* We don't want negative new_point below */
 | 
						||
  if (new_point != 0)
 | 
						||
    new_point= ROUND_UP(new_point) - 1;
 | 
						||
 | 
						||
  if (new_point > end)
 | 
						||
  {
 | 
						||
    do
 | 
						||
    {
 | 
						||
      dec->buf[new_point]=0;
 | 
						||
    } while (--new_point > end);
 | 
						||
  }
 | 
						||
  else
 | 
						||
  {
 | 
						||
    for (; new_point < beg; new_point++)
 | 
						||
      dec->buf[new_point]= 0;
 | 
						||
  }
 | 
						||
  dec->intg= digits_int;
 | 
						||
  dec->frac= digits_frac;
 | 
						||
  return err;
 | 
						||
}
 | 
						||
 | 
						||
 | 
						||
/*
 | 
						||
  Convert string to decimal
 | 
						||
 | 
						||
  SYNOPSIS
 | 
						||
    internal_str2decl()
 | 
						||
      from    - value to convert. Doesn't have to be \0 terminated!
 | 
						||
      to      - decimal where where the result will be stored
 | 
						||
                to->buf and to->len must be set.
 | 
						||
      end     - Pointer to pointer to end of string. Will on return be
 | 
						||
		set to the char after the last used character
 | 
						||
      fixed   - use to->intg, to->frac as limits for input number
 | 
						||
 | 
						||
  NOTE
 | 
						||
    to->intg and to->frac can be modified even when fixed=1
 | 
						||
    (but only decreased, in this case)
 | 
						||
 | 
						||
  RETURN VALUE
 | 
						||
    E_DEC_OK/E_DEC_TRUNCATED/E_DEC_OVERFLOW/E_DEC_BAD_NUM/E_DEC_OOM
 | 
						||
    In case of E_DEC_FATAL_ERROR *to is set to decimal zero
 | 
						||
    (to make error handling easier)
 | 
						||
*/
 | 
						||
 | 
						||
int
 | 
						||
internal_str2dec(const char *from, decimal_t *to, char **end, my_bool fixed)
 | 
						||
{
 | 
						||
  const char *s= from, *s1, *endp, *end_of_string= *end;
 | 
						||
  int i, intg, frac, error, intg1, frac1;
 | 
						||
  dec1 x,*buf;
 | 
						||
  sanity(to);
 | 
						||
 | 
						||
  error= E_DEC_BAD_NUM;                         /* In case of bad number */
 | 
						||
  while (s < end_of_string && my_isspace(&my_charset_latin1, *s))
 | 
						||
    s++;
 | 
						||
  if (s == end_of_string)
 | 
						||
    goto fatal_error;
 | 
						||
 | 
						||
  if ((to->sign= (*s == '-')))
 | 
						||
    s++;
 | 
						||
  else if (*s == '+')
 | 
						||
    s++;
 | 
						||
 | 
						||
  s1=s;
 | 
						||
  while (s < end_of_string && my_isdigit(&my_charset_latin1, *s))
 | 
						||
    s++;
 | 
						||
  intg= (int) (s-s1);
 | 
						||
  if (s < end_of_string && *s=='.')
 | 
						||
  {
 | 
						||
    endp= s+1;
 | 
						||
    while (endp < end_of_string && my_isdigit(&my_charset_latin1, *endp))
 | 
						||
      endp++;
 | 
						||
    frac= (int) (endp - s - 1);
 | 
						||
  }
 | 
						||
  else
 | 
						||
  {
 | 
						||
    frac= 0;
 | 
						||
    endp= s;
 | 
						||
  }
 | 
						||
 | 
						||
  *end= (char*) endp;
 | 
						||
 | 
						||
  if (frac+intg == 0)
 | 
						||
    goto fatal_error;
 | 
						||
 | 
						||
  error= 0;
 | 
						||
  if (fixed)
 | 
						||
  {
 | 
						||
    if (frac > to->frac)
 | 
						||
    {
 | 
						||
      error=E_DEC_TRUNCATED;
 | 
						||
      frac=to->frac;
 | 
						||
    }
 | 
						||
    if (intg > to->intg)
 | 
						||
    {
 | 
						||
      error=E_DEC_OVERFLOW;
 | 
						||
      intg=to->intg;
 | 
						||
    }
 | 
						||
    intg1=ROUND_UP(intg);
 | 
						||
    frac1=ROUND_UP(frac);
 | 
						||
    if (intg1+frac1 > to->len)
 | 
						||
    {
 | 
						||
      error= E_DEC_OOM;
 | 
						||
      goto fatal_error;
 | 
						||
    }
 | 
						||
  }
 | 
						||
  else
 | 
						||
  {
 | 
						||
    intg1=ROUND_UP(intg);
 | 
						||
    frac1=ROUND_UP(frac);
 | 
						||
    FIX_INTG_FRAC_ERROR(to->len, intg1, frac1, error);
 | 
						||
    if (unlikely(error))
 | 
						||
    {
 | 
						||
      frac=frac1*DIG_PER_DEC1;
 | 
						||
      if (error == E_DEC_OVERFLOW)
 | 
						||
        intg=intg1*DIG_PER_DEC1;
 | 
						||
    }
 | 
						||
  }
 | 
						||
  /* Error is guranteed to be set here */
 | 
						||
  to->intg=intg;
 | 
						||
  to->frac=frac;
 | 
						||
 | 
						||
  buf=to->buf+intg1;
 | 
						||
  s1=s;
 | 
						||
 | 
						||
  for (x=0, i=0; intg; intg--)
 | 
						||
  {
 | 
						||
    x+= (*--s - '0')*powers10[i];
 | 
						||
 | 
						||
    if (unlikely(++i == DIG_PER_DEC1))
 | 
						||
    {
 | 
						||
      *--buf=x;
 | 
						||
      x=0;
 | 
						||
      i=0;
 | 
						||
    }
 | 
						||
  }
 | 
						||
  if (i)
 | 
						||
    *--buf=x;
 | 
						||
 | 
						||
  buf=to->buf+intg1;
 | 
						||
  for (x=0, i=0; frac; frac--)
 | 
						||
  {
 | 
						||
    x= (*++s1 - '0') + x*10;
 | 
						||
 | 
						||
    if (unlikely(++i == DIG_PER_DEC1))
 | 
						||
    {
 | 
						||
      *buf++=x;
 | 
						||
      x=0;
 | 
						||
      i=0;
 | 
						||
    }
 | 
						||
  }
 | 
						||
  if (i)
 | 
						||
    *buf=x*powers10[DIG_PER_DEC1-i];
 | 
						||
 | 
						||
  /* Handle exponent */
 | 
						||
  if (endp+1 < end_of_string && (*endp == 'e' || *endp == 'E'))
 | 
						||
  {
 | 
						||
    int str_error;
 | 
						||
    longlong exp= my_strtoll10(endp+1, (char**) &end_of_string, &str_error);
 | 
						||
 | 
						||
    if (end_of_string != endp +1)               /* If at least one digit */
 | 
						||
    {
 | 
						||
      *end= (char*) end_of_string;
 | 
						||
      if (str_error > 0)
 | 
						||
      {
 | 
						||
        error= E_DEC_BAD_NUM;
 | 
						||
        goto fatal_error;
 | 
						||
      }
 | 
						||
      if (exp > INT_MAX/2 || (str_error == 0 && exp < 0))
 | 
						||
      {
 | 
						||
        error= E_DEC_OVERFLOW;
 | 
						||
        goto fatal_error;
 | 
						||
      }
 | 
						||
      if (exp < INT_MIN/2 && error != E_DEC_OVERFLOW)
 | 
						||
      {
 | 
						||
        error= E_DEC_TRUNCATED;
 | 
						||
        goto fatal_error;
 | 
						||
      }
 | 
						||
      if (error != E_DEC_OVERFLOW)
 | 
						||
        error= decimal_shift(to, (int) exp);
 | 
						||
    }
 | 
						||
  }
 | 
						||
  return error;
 | 
						||
 | 
						||
fatal_error:
 | 
						||
  decimal_make_zero(to);
 | 
						||
  return error;
 | 
						||
}
 | 
						||
 | 
						||
 | 
						||
/*
 | 
						||
  Convert decimal to double
 | 
						||
 | 
						||
  SYNOPSIS
 | 
						||
    decimal2double()
 | 
						||
      from    - value to convert
 | 
						||
      to      - result will be stored there
 | 
						||
 | 
						||
  RETURN VALUE
 | 
						||
    E_DEC_OK
 | 
						||
*/
 | 
						||
 | 
						||
int decimal2double(decimal_t *from, double *to)
 | 
						||
{
 | 
						||
  double result= 0.0;
 | 
						||
  int i, exp= 0;
 | 
						||
  dec1 *buf= from->buf;
 | 
						||
 | 
						||
  for (i= from->intg; i > 0;  i-= DIG_PER_DEC1)
 | 
						||
    result= result * DIG_BASE + *buf++;
 | 
						||
 | 
						||
  for (i= from->frac; i > 0; i-= DIG_PER_DEC1) {
 | 
						||
    result= result * DIG_BASE + *buf++;
 | 
						||
    exp+= DIG_PER_DEC1;
 | 
						||
  }
 | 
						||
 | 
						||
  DBUG_PRINT("info", ("interm.: %f %d %f", result, exp,
 | 
						||
             scaler10[exp / 10] * scaler1[exp % 10]));
 | 
						||
 | 
						||
  result/= scaler10[exp / 10] * scaler1[exp % 10];
 | 
						||
 | 
						||
  *to= from->sign ? -result : result;
 | 
						||
 | 
						||
  DBUG_PRINT("info", ("result: %f (%lx)", *to, *(ulong *)to));
 | 
						||
 | 
						||
  return E_DEC_OK;
 | 
						||
}
 | 
						||
 | 
						||
/*
 | 
						||
  Convert double to decimal
 | 
						||
 | 
						||
  SYNOPSIS
 | 
						||
    double2decimal()
 | 
						||
      from    - value to convert
 | 
						||
      to      - result will be stored there
 | 
						||
 | 
						||
  RETURN VALUE
 | 
						||
    E_DEC_OK/E_DEC_OVERFLOW/E_DEC_TRUNCATED
 | 
						||
*/
 | 
						||
 | 
						||
int double2decimal(double from, decimal_t *to)
 | 
						||
{
 | 
						||
  /* TODO: fix it, when we'll have dtoa */
 | 
						||
  char s[400], *end;
 | 
						||
  sprintf(s, "%.16G", from);
 | 
						||
  end= strend(s);
 | 
						||
  return string2decimal(s, to, &end);
 | 
						||
}
 | 
						||
 | 
						||
static int ull2dec(ulonglong from, decimal_t *to)
 | 
						||
{
 | 
						||
  int intg1, error=E_DEC_OK;
 | 
						||
  ulonglong x=from;
 | 
						||
  dec1 *buf;
 | 
						||
 | 
						||
  sanity(to);
 | 
						||
 | 
						||
  for (intg1=1; from >= DIG_BASE; intg1++, from/=DIG_BASE);
 | 
						||
  if (unlikely(intg1 > to->len))
 | 
						||
  {
 | 
						||
    intg1=to->len;
 | 
						||
    error=E_DEC_OVERFLOW;
 | 
						||
  }
 | 
						||
  to->frac=0;
 | 
						||
  to->intg=intg1*DIG_PER_DEC1;
 | 
						||
 | 
						||
  for (buf=to->buf+intg1; intg1; intg1--)
 | 
						||
  {
 | 
						||
    ulonglong y=x/DIG_BASE;
 | 
						||
    *--buf=(dec1)(x-y*DIG_BASE);
 | 
						||
    x=y;
 | 
						||
  }
 | 
						||
  return error;
 | 
						||
}
 | 
						||
 | 
						||
int ulonglong2decimal(ulonglong from, decimal_t *to)
 | 
						||
{
 | 
						||
  to->sign=0;
 | 
						||
  return ull2dec(from, to);
 | 
						||
}
 | 
						||
 | 
						||
int longlong2decimal(longlong from, decimal_t *to)
 | 
						||
{
 | 
						||
  if ((to->sign= from < 0))
 | 
						||
    return ull2dec(-from, to);
 | 
						||
  return ull2dec(from, to);
 | 
						||
}
 | 
						||
 | 
						||
int decimal2ulonglong(decimal_t *from, ulonglong *to)
 | 
						||
{
 | 
						||
  dec1 *buf=from->buf;
 | 
						||
  ulonglong x=0;
 | 
						||
  int intg, frac;
 | 
						||
 | 
						||
  if (from->sign)
 | 
						||
  {
 | 
						||
      *to=ULL(0);
 | 
						||
      return E_DEC_OVERFLOW;
 | 
						||
  }
 | 
						||
 | 
						||
  for (intg=from->intg; intg > 0; intg-=DIG_PER_DEC1)
 | 
						||
  {
 | 
						||
    ulonglong y=x;
 | 
						||
    x=x*DIG_BASE + *buf++;
 | 
						||
    if (unlikely(y > ((ulonglong) ULONGLONG_MAX/DIG_BASE) || x < y))
 | 
						||
    {
 | 
						||
      *to=ULONGLONG_MAX;
 | 
						||
      return E_DEC_OVERFLOW;
 | 
						||
    }
 | 
						||
  }
 | 
						||
  *to=x;
 | 
						||
  for (frac=from->frac; unlikely(frac > 0); frac-=DIG_PER_DEC1)
 | 
						||
    if (*buf++)
 | 
						||
      return E_DEC_TRUNCATED;
 | 
						||
  return E_DEC_OK;
 | 
						||
}
 | 
						||
 | 
						||
int decimal2longlong(decimal_t *from, longlong *to)
 | 
						||
{
 | 
						||
  dec1 *buf=from->buf;
 | 
						||
  longlong x=0;
 | 
						||
  int intg, frac;
 | 
						||
 | 
						||
  for (intg=from->intg; intg > 0; intg-=DIG_PER_DEC1)
 | 
						||
  {
 | 
						||
    longlong y=x;
 | 
						||
    /*
 | 
						||
      Attention: trick!
 | 
						||
      we're calculating -|from| instead of |from| here
 | 
						||
      because |LONGLONG_MIN| > LONGLONG_MAX
 | 
						||
      so we can convert -9223372036854775808 correctly
 | 
						||
    */
 | 
						||
    x=x*DIG_BASE - *buf++;
 | 
						||
    if (unlikely(y < (LONGLONG_MIN/DIG_BASE) || x > y))
 | 
						||
    {
 | 
						||
      *to= from->sign ? y : -y;
 | 
						||
      return E_DEC_OVERFLOW;
 | 
						||
    }
 | 
						||
  }
 | 
						||
  /* boundary case: 9223372036854775808 */
 | 
						||
  if (unlikely(from->sign==0 && x == LONGLONG_MIN))
 | 
						||
  {
 | 
						||
    *to= LONGLONG_MAX;
 | 
						||
    return E_DEC_OVERFLOW;
 | 
						||
  }
 | 
						||
 | 
						||
  *to=from->sign ? x : -x;
 | 
						||
  for (frac=from->frac; unlikely(frac > 0); frac-=DIG_PER_DEC1)
 | 
						||
    if (*buf++)
 | 
						||
      return E_DEC_TRUNCATED;
 | 
						||
  return E_DEC_OK;
 | 
						||
}
 | 
						||
 | 
						||
/*
 | 
						||
  Convert decimal to its binary fixed-length representation
 | 
						||
  two representations of the same length can be compared with memcmp
 | 
						||
  with the correct -1/0/+1 result
 | 
						||
 | 
						||
  SYNOPSIS
 | 
						||
    decimal2bin()
 | 
						||
      from    - value to convert
 | 
						||
      to      - points to buffer where string representation should be stored
 | 
						||
      precision/scale - see decimal_bin_size() below
 | 
						||
 | 
						||
  NOTE
 | 
						||
    the buffer is assumed to be of the size decimal_bin_size(precision, scale)
 | 
						||
 | 
						||
  RETURN VALUE
 | 
						||
    E_DEC_OK/E_DEC_TRUNCATED/E_DEC_OVERFLOW
 | 
						||
 | 
						||
  DESCRIPTION
 | 
						||
    for storage decimal numbers are converted to the "binary" format.
 | 
						||
 | 
						||
    This format has the following properties:
 | 
						||
      1. length of the binary representation depends on the {precision, scale}
 | 
						||
      as provided by the caller and NOT on the intg/frac of the decimal to
 | 
						||
      convert.
 | 
						||
      2. binary representations of the same {precision, scale} can be compared
 | 
						||
      with memcmp - with the same result as decimal_cmp() of the original
 | 
						||
      decimals (not taking into account possible precision loss during
 | 
						||
      conversion).
 | 
						||
 | 
						||
    This binary format is as follows:
 | 
						||
      1. First the number is converted to have a requested precision and scale.
 | 
						||
      2. Every full DIG_PER_DEC1 digits of intg part are stored in 4 bytes
 | 
						||
         as is
 | 
						||
      3. The first intg % DIG_PER_DEC1 digits are stored in the reduced
 | 
						||
         number of bytes (enough bytes to store this number of digits -
 | 
						||
         see dig2bytes)
 | 
						||
      4. same for frac - full decimal_digit_t's are stored as is,
 | 
						||
         the last frac % DIG_PER_DEC1 digits - in the reduced number of bytes.
 | 
						||
      5. If the number is negative - every byte is inversed.
 | 
						||
      5. The very first bit of the resulting byte array is inverted (because
 | 
						||
         memcmp compares unsigned bytes, see property 2 above)
 | 
						||
 | 
						||
    Example:
 | 
						||
 | 
						||
      1234567890.1234
 | 
						||
 | 
						||
    internally is represented as 3 decimal_digit_t's
 | 
						||
 | 
						||
      1 234567890 123400000
 | 
						||
 | 
						||
    (assuming we want a binary representation with precision=14, scale=4)
 | 
						||
    in hex it's
 | 
						||
 | 
						||
      00-00-00-01  0D-FB-38-D2  07-5A-EF-40
 | 
						||
 | 
						||
    now, middle decimal_digit_t is full - it stores 9 decimal digits. It goes
 | 
						||
    into binary representation as is:
 | 
						||
 | 
						||
 | 
						||
      ...........  0D-FB-38-D2 ............
 | 
						||
 | 
						||
    First decimal_digit_t has only one decimal digit. We can store one digit in
 | 
						||
    one byte, no need to waste four:
 | 
						||
 | 
						||
                01 0D-FB-38-D2 ............
 | 
						||
 | 
						||
    now, last digit. It's 123400000. We can store 1234 in two bytes:
 | 
						||
 | 
						||
                01 0D-FB-38-D2 04-D2
 | 
						||
 | 
						||
    So, we've packed 12 bytes number in 7 bytes.
 | 
						||
    And now we invert the highest bit to get the final result:
 | 
						||
 | 
						||
                81 0D FB 38 D2 04 D2
 | 
						||
 | 
						||
    And for -1234567890.1234 it would be
 | 
						||
 | 
						||
                7E F2 04 37 2D FB 2D
 | 
						||
*/
 | 
						||
int decimal2bin(decimal_t *from, char *to, int precision, int frac)
 | 
						||
{
 | 
						||
  dec1 mask=from->sign ? -1 : 0, *buf1=from->buf, *stop1;
 | 
						||
  int error=E_DEC_OK, intg=precision-frac,
 | 
						||
      isize1, intg1, intg1x, from_intg,
 | 
						||
      intg0=intg/DIG_PER_DEC1,
 | 
						||
      frac0=frac/DIG_PER_DEC1,
 | 
						||
      intg0x=intg-intg0*DIG_PER_DEC1,
 | 
						||
      frac0x=frac-frac0*DIG_PER_DEC1,
 | 
						||
      frac1=from->frac/DIG_PER_DEC1,
 | 
						||
      frac1x=from->frac-frac1*DIG_PER_DEC1,
 | 
						||
      isize0=intg0*sizeof(dec1)+dig2bytes[intg0x],
 | 
						||
      fsize0=frac0*sizeof(dec1)+dig2bytes[frac0x],
 | 
						||
      fsize1=frac1*sizeof(dec1)+dig2bytes[frac1x];
 | 
						||
  const int orig_isize0= isize0;
 | 
						||
  const int orig_fsize0= fsize0;
 | 
						||
  char *orig_to= to;
 | 
						||
 | 
						||
  buf1= remove_leading_zeroes(from, &from_intg);
 | 
						||
 | 
						||
  if (unlikely(from_intg+fsize1==0))
 | 
						||
  {
 | 
						||
    mask=0; /* just in case */
 | 
						||
    intg=1;
 | 
						||
    buf1=&mask;
 | 
						||
  }
 | 
						||
 | 
						||
  intg1=from_intg/DIG_PER_DEC1;
 | 
						||
  intg1x=from_intg-intg1*DIG_PER_DEC1;
 | 
						||
  isize1=intg1*sizeof(dec1)+dig2bytes[intg1x];
 | 
						||
 | 
						||
  if (intg < from_intg)
 | 
						||
  {
 | 
						||
    buf1+=intg1-intg0+(intg1x>0)-(intg0x>0);
 | 
						||
    intg1=intg0; intg1x=intg0x;
 | 
						||
    error=E_DEC_OVERFLOW;
 | 
						||
  }
 | 
						||
  else if (isize0 > isize1)
 | 
						||
  {
 | 
						||
    while (isize0-- > isize1)
 | 
						||
      *to++= (char)mask;
 | 
						||
  }
 | 
						||
  if (fsize0 < fsize1)
 | 
						||
  {
 | 
						||
    frac1=frac0; frac1x=frac0x;
 | 
						||
    error=E_DEC_TRUNCATED;
 | 
						||
  }
 | 
						||
  else if (fsize0 > fsize1 && frac1x)
 | 
						||
  {
 | 
						||
    if (frac0 == frac1)
 | 
						||
    {
 | 
						||
      frac1x=frac0x;
 | 
						||
      fsize0= fsize1;
 | 
						||
    }
 | 
						||
    else
 | 
						||
    {
 | 
						||
      frac1++;
 | 
						||
      frac1x=0;
 | 
						||
    }
 | 
						||
  }
 | 
						||
 | 
						||
  /* intg1x part */
 | 
						||
  if (intg1x)
 | 
						||
  {
 | 
						||
    int i=dig2bytes[intg1x];
 | 
						||
    dec1 x=(*buf1++ % powers10[intg1x]) ^ mask;
 | 
						||
    switch (i)
 | 
						||
    {
 | 
						||
      case 1: mi_int1store(to, x); break;
 | 
						||
      case 2: mi_int2store(to, x); break;
 | 
						||
      case 3: mi_int3store(to, x); break;
 | 
						||
      case 4: mi_int4store(to, x); break;
 | 
						||
      default: DBUG_ASSERT(0);
 | 
						||
    }
 | 
						||
    to+=i;
 | 
						||
  }
 | 
						||
 | 
						||
  /* intg1+frac1 part */
 | 
						||
  for (stop1=buf1+intg1+frac1; buf1 < stop1; to+=sizeof(dec1))
 | 
						||
  {
 | 
						||
    dec1 x=*buf1++ ^ mask;
 | 
						||
    DBUG_ASSERT(sizeof(dec1) == 4);
 | 
						||
    mi_int4store(to, x);
 | 
						||
  }
 | 
						||
 | 
						||
  /* frac1x part */
 | 
						||
  if (frac1x)
 | 
						||
  {
 | 
						||
    dec1 x;
 | 
						||
    int i=dig2bytes[frac1x],
 | 
						||
        lim=(frac1 < frac0 ? DIG_PER_DEC1 : frac0x);
 | 
						||
    while (frac1x < lim && dig2bytes[frac1x] == i)
 | 
						||
      frac1x++;
 | 
						||
    x=(*buf1 / powers10[DIG_PER_DEC1 - frac1x]) ^ mask;
 | 
						||
    switch (i)
 | 
						||
    {
 | 
						||
      case 1: mi_int1store(to, x); break;
 | 
						||
      case 2: mi_int2store(to, x); break;
 | 
						||
      case 3: mi_int3store(to, x); break;
 | 
						||
      case 4: mi_int4store(to, x); break;
 | 
						||
      default: DBUG_ASSERT(0);
 | 
						||
    }
 | 
						||
    to+=i;
 | 
						||
  }
 | 
						||
  if (fsize0 > fsize1)
 | 
						||
  {
 | 
						||
    char *to_end= orig_to + orig_fsize0 + orig_isize0;
 | 
						||
 | 
						||
    while (fsize0-- > fsize1 && to < to_end)
 | 
						||
      *to++=(uchar)mask;
 | 
						||
  }
 | 
						||
  orig_to[0]^= 0x80;
 | 
						||
 | 
						||
  /* Check that we have written the whole decimal and nothing more */
 | 
						||
  DBUG_ASSERT(to == orig_to + orig_fsize0 + orig_isize0);
 | 
						||
  return error;
 | 
						||
}
 | 
						||
 | 
						||
/*
 | 
						||
  Restores decimal from its binary fixed-length representation
 | 
						||
 | 
						||
  SYNOPSIS
 | 
						||
    bin2decimal()
 | 
						||
      from    - value to convert
 | 
						||
      to      - result
 | 
						||
      precision/scale - see decimal_bin_size() below
 | 
						||
 | 
						||
  NOTE
 | 
						||
    see decimal2bin()
 | 
						||
    the buffer is assumed to be of the size decimal_bin_size(precision, scale)
 | 
						||
 | 
						||
  RETURN VALUE
 | 
						||
    E_DEC_OK/E_DEC_TRUNCATED/E_DEC_OVERFLOW
 | 
						||
*/
 | 
						||
 | 
						||
int bin2decimal(char *from, decimal_t *to, int precision, int scale)
 | 
						||
{
 | 
						||
  int error=E_DEC_OK, intg=precision-scale,
 | 
						||
      intg0=intg/DIG_PER_DEC1, frac0=scale/DIG_PER_DEC1,
 | 
						||
      intg0x=intg-intg0*DIG_PER_DEC1, frac0x=scale-frac0*DIG_PER_DEC1,
 | 
						||
      intg1=intg0+(intg0x>0), frac1=frac0+(frac0x>0);
 | 
						||
  dec1 *buf=to->buf, mask=(*from & 0x80) ? 0 : -1;
 | 
						||
  char *stop;
 | 
						||
  char *d_copy;
 | 
						||
  int bin_size= decimal_bin_size(precision, scale);
 | 
						||
 | 
						||
  sanity(to);
 | 
						||
  d_copy= (char *)my_alloca(bin_size);
 | 
						||
  memcpy(d_copy, from, bin_size);
 | 
						||
  d_copy[0]^= 0x80;
 | 
						||
  from= d_copy;
 | 
						||
 | 
						||
  FIX_INTG_FRAC_ERROR(to->len, intg1, frac1, error);
 | 
						||
  if (unlikely(error))
 | 
						||
  {
 | 
						||
    if (intg1 < intg0+(intg0x>0))
 | 
						||
    {
 | 
						||
      from+=dig2bytes[intg0x]+sizeof(dec1)*(intg0-intg1);
 | 
						||
      frac0=frac0x=intg0x=0;
 | 
						||
      intg0=intg1;
 | 
						||
    }
 | 
						||
    else
 | 
						||
    {
 | 
						||
      frac0x=0;
 | 
						||
      frac0=frac1;
 | 
						||
    }
 | 
						||
  }
 | 
						||
 | 
						||
  to->sign=(mask != 0);
 | 
						||
  to->intg=intg0*DIG_PER_DEC1+intg0x;
 | 
						||
  to->frac=frac0*DIG_PER_DEC1+frac0x;
 | 
						||
 | 
						||
  if (intg0x)
 | 
						||
  {
 | 
						||
    int i=dig2bytes[intg0x];
 | 
						||
    dec1 x;
 | 
						||
    switch (i)
 | 
						||
    {
 | 
						||
      case 1: x=mi_sint1korr(from); break;
 | 
						||
      case 2: x=mi_sint2korr(from); break;
 | 
						||
      case 3: x=mi_sint3korr(from); break;
 | 
						||
      case 4: x=mi_sint4korr(from); break;
 | 
						||
      default: DBUG_ASSERT(0);
 | 
						||
    }
 | 
						||
    from+=i;
 | 
						||
    *buf=x ^ mask;
 | 
						||
    if (((ulonglong)*buf) >= (ulonglong) powers10[intg0x+1])
 | 
						||
      goto err;
 | 
						||
    if (buf > to->buf || *buf != 0)
 | 
						||
      buf++;
 | 
						||
    else
 | 
						||
      to->intg-=intg0x;
 | 
						||
  }
 | 
						||
  for (stop=from+intg0*sizeof(dec1); from < stop; from+=sizeof(dec1))
 | 
						||
  {
 | 
						||
    DBUG_ASSERT(sizeof(dec1) == 4);
 | 
						||
    *buf=mi_sint4korr(from) ^ mask;
 | 
						||
    if (((uint32)*buf) > DIG_MAX)
 | 
						||
      goto err;
 | 
						||
    if (buf > to->buf || *buf != 0)
 | 
						||
      buf++;
 | 
						||
    else
 | 
						||
      to->intg-=DIG_PER_DEC1;
 | 
						||
  }
 | 
						||
  DBUG_ASSERT(to->intg >=0);
 | 
						||
  for (stop=from+frac0*sizeof(dec1); from < stop; from+=sizeof(dec1))
 | 
						||
  {
 | 
						||
    DBUG_ASSERT(sizeof(dec1) == 4);
 | 
						||
    *buf=mi_sint4korr(from) ^ mask;
 | 
						||
    if (((uint32)*buf) > DIG_MAX)
 | 
						||
      goto err;
 | 
						||
    buf++;
 | 
						||
  }
 | 
						||
  if (frac0x)
 | 
						||
  {
 | 
						||
    int i=dig2bytes[frac0x];
 | 
						||
    dec1 x;
 | 
						||
    switch (i)
 | 
						||
    {
 | 
						||
      case 1: x=mi_sint1korr(from); break;
 | 
						||
      case 2: x=mi_sint2korr(from); break;
 | 
						||
      case 3: x=mi_sint3korr(from); break;
 | 
						||
      case 4: x=mi_sint4korr(from); break;
 | 
						||
      default: DBUG_ASSERT(0);
 | 
						||
    }
 | 
						||
    *buf=(x ^ mask) * powers10[DIG_PER_DEC1 - frac0x];
 | 
						||
    if (((uint32)*buf) > DIG_MAX)
 | 
						||
      goto err;
 | 
						||
    buf++;
 | 
						||
  }
 | 
						||
  my_afree(d_copy);
 | 
						||
  return error;
 | 
						||
 | 
						||
err:
 | 
						||
  my_afree(d_copy);
 | 
						||
  decimal_make_zero(((decimal_t*) to));
 | 
						||
  return(E_DEC_BAD_NUM);
 | 
						||
}
 | 
						||
 | 
						||
/*
 | 
						||
  Returns the size of array to hold a decimal with given precision and scale
 | 
						||
 | 
						||
  RETURN VALUE
 | 
						||
    size in dec1
 | 
						||
    (multiply by sizeof(dec1) to get the size if bytes)
 | 
						||
*/
 | 
						||
 | 
						||
int decimal_size(int precision, int scale)
 | 
						||
{
 | 
						||
  DBUG_ASSERT(scale >= 0 && precision > 0 && scale <= precision);
 | 
						||
  return ROUND_UP(precision-scale)+ROUND_UP(scale);
 | 
						||
}
 | 
						||
 | 
						||
/*
 | 
						||
  Returns the size of array to hold a binary representation of a decimal
 | 
						||
 | 
						||
  RETURN VALUE
 | 
						||
    size in bytes
 | 
						||
*/
 | 
						||
 | 
						||
int decimal_bin_size(int precision, int scale)
 | 
						||
{
 | 
						||
  int intg=precision-scale,
 | 
						||
      intg0=intg/DIG_PER_DEC1, frac0=scale/DIG_PER_DEC1,
 | 
						||
      intg0x=intg-intg0*DIG_PER_DEC1, frac0x=scale-frac0*DIG_PER_DEC1;
 | 
						||
 | 
						||
  DBUG_ASSERT(scale >= 0 && precision > 0 && scale <= precision);
 | 
						||
  return intg0*sizeof(dec1)+dig2bytes[intg0x]+
 | 
						||
         frac0*sizeof(dec1)+dig2bytes[frac0x];
 | 
						||
}
 | 
						||
 | 
						||
/*
 | 
						||
  Rounds the decimal to "scale" digits
 | 
						||
 | 
						||
  SYNOPSIS
 | 
						||
    decimal_round()
 | 
						||
      from    - decimal to round,
 | 
						||
      to      - result buffer. from==to is allowed
 | 
						||
      scale   - to what position to round. can be negative!
 | 
						||
      mode    - round to nearest even or truncate
 | 
						||
 | 
						||
  NOTES
 | 
						||
    scale can be negative !
 | 
						||
    one TRUNCATED error (line XXX below) isn't treated very logical :(
 | 
						||
 | 
						||
  RETURN VALUE
 | 
						||
    E_DEC_OK/E_DEC_TRUNCATED
 | 
						||
*/
 | 
						||
 | 
						||
int
 | 
						||
decimal_round(decimal_t *from, decimal_t *to, int scale,
 | 
						||
              decimal_round_mode mode)
 | 
						||
{
 | 
						||
  int frac0=scale>0 ? ROUND_UP(scale) : scale/DIG_PER_DEC1,
 | 
						||
      frac1=ROUND_UP(from->frac), round_digit,
 | 
						||
      intg0=ROUND_UP(from->intg), error=E_DEC_OK, len=to->len,
 | 
						||
      intg1=ROUND_UP(from->intg +
 | 
						||
                     (((intg0 + frac0)>0) && (from->buf[0] == DIG_MAX)));
 | 
						||
  dec1 *buf0=from->buf, *buf1=to->buf, x, y, carry=0;
 | 
						||
  int first_dig;
 | 
						||
 | 
						||
  sanity(to);
 | 
						||
 | 
						||
  switch (mode) {
 | 
						||
  case HALF_UP:
 | 
						||
  case HALF_EVEN:       round_digit=5; break;
 | 
						||
  case CEILING:         round_digit= from->sign ? 10 : 0; break;
 | 
						||
  case FLOOR:           round_digit= from->sign ? 0 : 10; break;
 | 
						||
  case TRUNCATE:        round_digit=10; break;
 | 
						||
  default: DBUG_ASSERT(0);
 | 
						||
  }
 | 
						||
 | 
						||
  if (unlikely(frac0+intg0 > len))
 | 
						||
  {
 | 
						||
    frac0=len-intg0;
 | 
						||
    scale=frac0*DIG_PER_DEC1;
 | 
						||
    error=E_DEC_TRUNCATED;
 | 
						||
  }
 | 
						||
 | 
						||
  if (scale+from->intg < 0)
 | 
						||
  {
 | 
						||
    decimal_make_zero(to);
 | 
						||
    return E_DEC_OK;
 | 
						||
  }
 | 
						||
 | 
						||
  if (to != from || intg1>intg0)
 | 
						||
  {
 | 
						||
    dec1 *p0= buf0+intg0+max(frac1, frac0);
 | 
						||
    dec1 *p1= buf1+intg1+max(frac1, frac0);
 | 
						||
 | 
						||
    to->buf[0]= 0;
 | 
						||
    while (buf0 < p0)
 | 
						||
      *(--p1) = *(--p0);
 | 
						||
 | 
						||
    intg0= intg1;
 | 
						||
    buf0=to->buf;
 | 
						||
    buf1=to->buf;
 | 
						||
    to->sign=from->sign;
 | 
						||
    to->intg=min(intg0, len)*DIG_PER_DEC1;
 | 
						||
  }
 | 
						||
 | 
						||
  if (frac0 > frac1)
 | 
						||
  {
 | 
						||
    buf1+=intg0+frac1;
 | 
						||
    while (frac0-- > frac1)
 | 
						||
      *buf1++=0;
 | 
						||
    goto done;
 | 
						||
  }
 | 
						||
 | 
						||
  if (scale >= from->frac)
 | 
						||
    goto done; /* nothing to do */
 | 
						||
 | 
						||
  buf0+=intg0+frac0-1;
 | 
						||
  buf1+=intg0+frac0-1;
 | 
						||
  if (scale == frac0*DIG_PER_DEC1)
 | 
						||
  {
 | 
						||
    int do_inc= FALSE;
 | 
						||
    DBUG_ASSERT(frac0+intg0 >= 0);
 | 
						||
    switch (round_digit) {
 | 
						||
    case 0:
 | 
						||
    {
 | 
						||
      dec1 *p0= buf0 + (frac1-frac0);
 | 
						||
      for (; p0 > buf0; p0--)
 | 
						||
      {
 | 
						||
        if (*p0)
 | 
						||
        {
 | 
						||
          do_inc= TRUE;
 | 
						||
          break;
 | 
						||
        }
 | 
						||
      }
 | 
						||
      break;
 | 
						||
    }
 | 
						||
    case 5:
 | 
						||
    {
 | 
						||
      x= buf0[1]/DIG_MASK;
 | 
						||
      do_inc= (x>5) || ((x == 5) &&
 | 
						||
                        (mode == HALF_UP || (frac0+intg0 > 0 && *buf0 & 1)));
 | 
						||
      break;
 | 
						||
    }
 | 
						||
    default:
 | 
						||
      break;
 | 
						||
    }
 | 
						||
    if (do_inc)
 | 
						||
    {
 | 
						||
      if (frac0+intg0>0)
 | 
						||
        (*buf1)++;
 | 
						||
      else
 | 
						||
        *(++buf1)=DIG_BASE;
 | 
						||
    }
 | 
						||
    else if (frac0+intg0==0)
 | 
						||
    {
 | 
						||
      decimal_make_zero(to);
 | 
						||
      return E_DEC_OK;
 | 
						||
    }
 | 
						||
  }
 | 
						||
  else
 | 
						||
  {
 | 
						||
    /* TODO - fix this code as it won't work for CEILING mode */
 | 
						||
    int pos=frac0*DIG_PER_DEC1-scale-1;
 | 
						||
    DBUG_ASSERT(frac0+intg0 > 0);
 | 
						||
    x=*buf1 / powers10[pos];
 | 
						||
    y=x % 10;
 | 
						||
    if (y > round_digit ||
 | 
						||
        (round_digit == 5 && y == 5 && (mode == HALF_UP || (x/10) & 1)))
 | 
						||
      x+=10;
 | 
						||
    *buf1=powers10[pos]*(x-y);
 | 
						||
  }
 | 
						||
  if (frac0 < 0)
 | 
						||
  {
 | 
						||
    dec1 *end=to->buf+intg0, *buf=buf1+1;
 | 
						||
    while (buf < end)
 | 
						||
      *buf++=0;
 | 
						||
  }
 | 
						||
  if (*buf1 >= DIG_BASE)
 | 
						||
  {
 | 
						||
    carry=1;
 | 
						||
    *buf1-=DIG_BASE;
 | 
						||
    while (carry && --buf1 >= to->buf)
 | 
						||
      ADD(*buf1, *buf1, 0, carry);
 | 
						||
    if (unlikely(carry))
 | 
						||
    {
 | 
						||
      /* shifting the number to create space for new digit */
 | 
						||
      if (frac0+intg0 >= len)
 | 
						||
      {
 | 
						||
        frac0--;
 | 
						||
        scale=frac0*DIG_PER_DEC1;
 | 
						||
        error=E_DEC_TRUNCATED; /* XXX */
 | 
						||
      }
 | 
						||
      for (buf1=to->buf+intg0+max(frac0,0); buf1 > to->buf; buf1--)
 | 
						||
      {
 | 
						||
        buf1[0]=buf1[-1];
 | 
						||
      }
 | 
						||
      *buf1=1;
 | 
						||
      to->intg++;
 | 
						||
    }
 | 
						||
  }
 | 
						||
  else
 | 
						||
  {
 | 
						||
    for (;;)
 | 
						||
    {
 | 
						||
      if (likely(*buf1))
 | 
						||
        break;
 | 
						||
      if (buf1-- == to->buf)
 | 
						||
      {
 | 
						||
        /* making 'zero' with the proper scale */
 | 
						||
        dec1 *p0= to->buf + frac0 + 1;
 | 
						||
        to->intg=1;
 | 
						||
        to->frac= max(scale, 0);
 | 
						||
        to->sign= 0;
 | 
						||
        for (buf1= to->buf; buf1<p0; buf1++)
 | 
						||
          *buf1= 0;
 | 
						||
        return E_DEC_OK;
 | 
						||
      }
 | 
						||
    }
 | 
						||
  }
 | 
						||
 | 
						||
  /* Here we  check 999.9 -> 1000 case when we need to increase intg */
 | 
						||
  first_dig= to->intg % DIG_PER_DEC1;
 | 
						||
  if (first_dig && (*buf1 >= powers10[first_dig]))
 | 
						||
    to->intg++;
 | 
						||
 | 
						||
  if (scale<0)
 | 
						||
    scale=0;
 | 
						||
 | 
						||
done:
 | 
						||
  to->frac=scale;
 | 
						||
  return error;
 | 
						||
}
 | 
						||
 | 
						||
/*
 | 
						||
  Returns the size of the result of the operation
 | 
						||
 | 
						||
  SYNOPSIS
 | 
						||
    decimal_result_size()
 | 
						||
      from1   - operand of the unary operation or first operand of the
 | 
						||
                binary operation
 | 
						||
      from2   - second operand of the binary operation
 | 
						||
      op      - operation. one char '+', '-', '*', '/' are allowed
 | 
						||
                others may be added later
 | 
						||
      param   - extra param to the operation. unused for '+', '-', '*'
 | 
						||
                scale increment for '/'
 | 
						||
 | 
						||
  NOTE
 | 
						||
    returned valued may be larger than the actual buffer requred
 | 
						||
    in the operation, as decimal_result_size, by design, operates on
 | 
						||
    precision/scale values only and not on the actual decimal number
 | 
						||
 | 
						||
  RETURN VALUE
 | 
						||
    size of to->buf array in dec1 elements. to get size in bytes
 | 
						||
    multiply by sizeof(dec1)
 | 
						||
*/
 | 
						||
 | 
						||
int decimal_result_size(decimal_t *from1, decimal_t *from2, char op, int param)
 | 
						||
{
 | 
						||
  switch (op) {
 | 
						||
  case '-':
 | 
						||
    return ROUND_UP(max(from1->intg, from2->intg)) +
 | 
						||
           ROUND_UP(max(from1->frac, from2->frac));
 | 
						||
  case '+':
 | 
						||
    return ROUND_UP(max(from1->intg, from2->intg)+1) +
 | 
						||
           ROUND_UP(max(from1->frac, from2->frac));
 | 
						||
  case '*':
 | 
						||
    return ROUND_UP(from1->intg+from2->intg)+
 | 
						||
           ROUND_UP(from1->frac)+ROUND_UP(from2->frac);
 | 
						||
  case '/':
 | 
						||
    return ROUND_UP(from1->intg+from2->intg+1+from1->frac+from2->frac+param);
 | 
						||
  default: DBUG_ASSERT(0);
 | 
						||
  }
 | 
						||
  return -1; /* shut up the warning */
 | 
						||
}
 | 
						||
 | 
						||
static int do_add(decimal_t *from1, decimal_t *from2, decimal_t *to)
 | 
						||
{
 | 
						||
  int intg1=ROUND_UP(from1->intg), intg2=ROUND_UP(from2->intg),
 | 
						||
      frac1=ROUND_UP(from1->frac), frac2=ROUND_UP(from2->frac),
 | 
						||
      frac0=max(frac1, frac2), intg0=max(intg1, intg2), error;
 | 
						||
  dec1 *buf1, *buf2, *buf0, *stop, *stop2, x, carry;
 | 
						||
 | 
						||
  sanity(to);
 | 
						||
 | 
						||
  /* is there a need for extra word because of carry ? */
 | 
						||
  x=intg1 > intg2 ? from1->buf[0] :
 | 
						||
    intg2 > intg1 ? from2->buf[0] :
 | 
						||
    from1->buf[0] + from2->buf[0] ;
 | 
						||
  if (unlikely(x > DIG_MAX-1)) /* yes, there is */
 | 
						||
  {
 | 
						||
    intg0++;
 | 
						||
    to->buf[0]=0; /* safety */
 | 
						||
  }
 | 
						||
 | 
						||
  FIX_INTG_FRAC_ERROR(to->len, intg0, frac0, error);
 | 
						||
  if (unlikely(error == E_DEC_OVERFLOW))
 | 
						||
  {
 | 
						||
    max_decimal(to->len * DIG_PER_DEC1, 0, to);
 | 
						||
    return error;
 | 
						||
  }
 | 
						||
 | 
						||
  buf0=to->buf+intg0+frac0;
 | 
						||
 | 
						||
  to->sign=from1->sign;
 | 
						||
  to->frac=max(from1->frac, from2->frac);
 | 
						||
  to->intg=intg0*DIG_PER_DEC1;
 | 
						||
  if (unlikely(error))
 | 
						||
  {
 | 
						||
    set_if_smaller(to->frac, frac0*DIG_PER_DEC1);
 | 
						||
    set_if_smaller(frac1, frac0);
 | 
						||
    set_if_smaller(frac2, frac0);
 | 
						||
    set_if_smaller(intg1, intg0);
 | 
						||
    set_if_smaller(intg2, intg0);
 | 
						||
  }
 | 
						||
 | 
						||
  /* part 1 - max(frac) ... min (frac) */
 | 
						||
  if (frac1 > frac2)
 | 
						||
  {
 | 
						||
    buf1=from1->buf+intg1+frac1;
 | 
						||
    stop=from1->buf+intg1+frac2;
 | 
						||
    buf2=from2->buf+intg2+frac2;
 | 
						||
    stop2=from1->buf+(intg1 > intg2 ? intg1-intg2 : 0);
 | 
						||
  }
 | 
						||
  else
 | 
						||
  {
 | 
						||
    buf1=from2->buf+intg2+frac2;
 | 
						||
    stop=from2->buf+intg2+frac1;
 | 
						||
    buf2=from1->buf+intg1+frac1;
 | 
						||
    stop2=from2->buf+(intg2 > intg1 ? intg2-intg1 : 0);
 | 
						||
  }
 | 
						||
  while (buf1 > stop)
 | 
						||
    *--buf0=*--buf1;
 | 
						||
 | 
						||
  /* part 2 - min(frac) ... min(intg) */
 | 
						||
  carry=0;
 | 
						||
  while (buf1 > stop2)
 | 
						||
  {
 | 
						||
    ADD(*--buf0, *--buf1, *--buf2, carry);
 | 
						||
  }
 | 
						||
 | 
						||
  /* part 3 - min(intg) ... max(intg) */
 | 
						||
  buf1= intg1 > intg2 ? ((stop=from1->buf)+intg1-intg2) :
 | 
						||
                        ((stop=from2->buf)+intg2-intg1) ;
 | 
						||
  while (buf1 > stop)
 | 
						||
  {
 | 
						||
    ADD(*--buf0, *--buf1, 0, carry);
 | 
						||
  }
 | 
						||
 | 
						||
  if (unlikely(carry))
 | 
						||
    *--buf0=1;
 | 
						||
  DBUG_ASSERT(buf0 == to->buf || buf0 == to->buf+1);
 | 
						||
 | 
						||
  return error;
 | 
						||
}
 | 
						||
 | 
						||
/* to=from1-from2.
 | 
						||
   if to==0, return -1/0/+1 - the result of the comparison */
 | 
						||
static int do_sub(decimal_t *from1, decimal_t *from2, decimal_t *to)
 | 
						||
{
 | 
						||
  int intg1=ROUND_UP(from1->intg), intg2=ROUND_UP(from2->intg),
 | 
						||
      frac1=ROUND_UP(from1->frac), frac2=ROUND_UP(from2->frac);
 | 
						||
  int frac0=max(frac1, frac2), error;
 | 
						||
  dec1 *buf1, *buf2, *buf0, *stop1, *stop2, *start1, *start2, carry=0;
 | 
						||
 | 
						||
  /* let carry:=1 if from2 > from1 */
 | 
						||
  start1=buf1=from1->buf; stop1=buf1+intg1;
 | 
						||
  start2=buf2=from2->buf; stop2=buf2+intg2;
 | 
						||
  if (unlikely(*buf1 == 0))
 | 
						||
  {
 | 
						||
    while (buf1 < stop1 && *buf1 == 0)
 | 
						||
      buf1++;
 | 
						||
    start1=buf1;
 | 
						||
    intg1= (int) (stop1-buf1);
 | 
						||
  }
 | 
						||
  if (unlikely(*buf2 == 0))
 | 
						||
  {
 | 
						||
    while (buf2 < stop2 && *buf2 == 0)
 | 
						||
      buf2++;
 | 
						||
    start2=buf2;
 | 
						||
    intg2= (int) (stop2-buf2);
 | 
						||
  }
 | 
						||
  if (intg2 > intg1)
 | 
						||
    carry=1;
 | 
						||
  else if (intg2 == intg1)
 | 
						||
  {
 | 
						||
    dec1 *end1= stop1 + (frac1 - 1);
 | 
						||
    dec1 *end2= stop2 + (frac2 - 1);
 | 
						||
    while (unlikely((buf1 <= end1) && (*end1 == 0)))
 | 
						||
      end1--;
 | 
						||
    while (unlikely((buf2 <= end2) && (*end2 == 0)))
 | 
						||
      end2--;
 | 
						||
    frac1= (int) (end1 - stop1) + 1;
 | 
						||
    frac2= (int) (end2 - stop2) + 1;
 | 
						||
    while (buf1 <=end1 && buf2 <= end2 && *buf1 == *buf2)
 | 
						||
      buf1++, buf2++;
 | 
						||
    if (buf1 <= end1)
 | 
						||
    {
 | 
						||
      if (buf2 <= end2)
 | 
						||
        carry= *buf2 > *buf1;
 | 
						||
      else
 | 
						||
        carry= 0;
 | 
						||
    }
 | 
						||
    else
 | 
						||
    {
 | 
						||
      if (buf2 <= end2)
 | 
						||
        carry=1;
 | 
						||
      else /* short-circuit everything: from1 == from2 */
 | 
						||
      {
 | 
						||
        if (to == 0) /* decimal_cmp() */
 | 
						||
          return 0;
 | 
						||
        decimal_make_zero(to);
 | 
						||
        return E_DEC_OK;
 | 
						||
      }
 | 
						||
    }
 | 
						||
  }
 | 
						||
 | 
						||
  if (to == 0) /* decimal_cmp() */
 | 
						||
    return carry == from1->sign ? 1 : -1;
 | 
						||
 | 
						||
  sanity(to);
 | 
						||
 | 
						||
  to->sign=from1->sign;
 | 
						||
 | 
						||
  /* ensure that always from1 > from2 (and intg1 >= intg2) */
 | 
						||
  if (carry)
 | 
						||
  {
 | 
						||
    swap_variables(decimal_t *,from1,from1);
 | 
						||
    swap_variables(dec1 *,start1, start2);
 | 
						||
    swap_variables(int,intg1,intg2);
 | 
						||
    swap_variables(int,frac1,frac2);
 | 
						||
    to->sign= 1 - to->sign;
 | 
						||
  }
 | 
						||
 | 
						||
  FIX_INTG_FRAC_ERROR(to->len, intg1, frac0, error);
 | 
						||
  buf0=to->buf+intg1+frac0;
 | 
						||
 | 
						||
  to->frac=max(from1->frac, from2->frac);
 | 
						||
  to->intg=intg1*DIG_PER_DEC1;
 | 
						||
  if (unlikely(error))
 | 
						||
  {
 | 
						||
    set_if_smaller(to->frac, frac0*DIG_PER_DEC1);
 | 
						||
    set_if_smaller(frac1, frac0);
 | 
						||
    set_if_smaller(frac2, frac0);
 | 
						||
    set_if_smaller(intg2, intg1);
 | 
						||
  }
 | 
						||
  carry=0;
 | 
						||
 | 
						||
  /* part 1 - max(frac) ... min (frac) */
 | 
						||
  if (frac1 > frac2)
 | 
						||
  {
 | 
						||
    buf1=start1+intg1+frac1;
 | 
						||
    stop1=start1+intg1+frac2;
 | 
						||
    buf2=start2+intg2+frac2;
 | 
						||
    while (frac0-- > frac1)
 | 
						||
      *--buf0=0;
 | 
						||
    while (buf1 > stop1)
 | 
						||
      *--buf0=*--buf1;
 | 
						||
  }
 | 
						||
  else
 | 
						||
  {
 | 
						||
    buf1=start1+intg1+frac1;
 | 
						||
    buf2=start2+intg2+frac2;
 | 
						||
    stop2=start2+intg2+frac1;
 | 
						||
    while (frac0-- > frac2)
 | 
						||
      *--buf0=0;
 | 
						||
    while (buf2 > stop2)
 | 
						||
    {
 | 
						||
      SUB(*--buf0, 0, *--buf2, carry);
 | 
						||
    }
 | 
						||
  }
 | 
						||
 | 
						||
  /* part 2 - min(frac) ... intg2 */
 | 
						||
  while (buf2 > start2)
 | 
						||
  {
 | 
						||
    SUB(*--buf0, *--buf1, *--buf2, carry);
 | 
						||
  }
 | 
						||
 | 
						||
  /* part 3 - intg2 ... intg1 */
 | 
						||
  while (carry && buf1 > start1)
 | 
						||
  {
 | 
						||
    SUB(*--buf0, *--buf1, 0, carry);
 | 
						||
  }
 | 
						||
 | 
						||
  while (buf1 > start1)
 | 
						||
    *--buf0=*--buf1;
 | 
						||
 | 
						||
  while (buf0 > to->buf)
 | 
						||
    *--buf0=0;
 | 
						||
 | 
						||
  return error;
 | 
						||
}
 | 
						||
 | 
						||
int decimal_add(decimal_t *from1, decimal_t *from2, decimal_t *to)
 | 
						||
{
 | 
						||
  if (likely(from1->sign == from2->sign))
 | 
						||
    return do_add(from1, from2, to);
 | 
						||
  return do_sub(from1, from2, to);
 | 
						||
}
 | 
						||
 | 
						||
int decimal_sub(decimal_t *from1, decimal_t *from2, decimal_t *to)
 | 
						||
{
 | 
						||
  if (likely(from1->sign == from2->sign))
 | 
						||
    return do_sub(from1, from2, to);
 | 
						||
  return do_add(from1, from2, to);
 | 
						||
}
 | 
						||
 | 
						||
int decimal_cmp(decimal_t *from1, decimal_t *from2)
 | 
						||
{
 | 
						||
  if (likely(from1->sign == from2->sign))
 | 
						||
    return do_sub(from1, from2, 0);
 | 
						||
  return from1->sign > from2->sign ? -1 : 1;
 | 
						||
}
 | 
						||
 | 
						||
int decimal_is_zero(decimal_t *from)
 | 
						||
{
 | 
						||
  dec1 *buf1=from->buf,
 | 
						||
       *end=buf1+ROUND_UP(from->intg)+ROUND_UP(from->frac);
 | 
						||
  while (buf1 < end)
 | 
						||
    if (*buf1++)
 | 
						||
      return 0;
 | 
						||
  return 1;
 | 
						||
}
 | 
						||
 | 
						||
/*
 | 
						||
  multiply two decimals
 | 
						||
 | 
						||
  SYNOPSIS
 | 
						||
    decimal_mul()
 | 
						||
      from1, from2 - factors
 | 
						||
      to      - product
 | 
						||
 | 
						||
  RETURN VALUE
 | 
						||
    E_DEC_OK/E_DEC_TRUNCATED/E_DEC_OVERFLOW;
 | 
						||
 | 
						||
  NOTES
 | 
						||
    in this implementation, with sizeof(dec1)=4 we have DIG_PER_DEC1=9,
 | 
						||
    and 63-digit number will take only 7 dec1 words (basically a 7-digit
 | 
						||
    "base 999999999" number).  Thus there's no need in fast multiplication
 | 
						||
    algorithms, 7-digit numbers can be multiplied with a naive O(n*n)
 | 
						||
    method.
 | 
						||
 | 
						||
    XXX if this library is to be used with huge numbers of thousands of
 | 
						||
    digits, fast multiplication must be implemented.
 | 
						||
*/
 | 
						||
int decimal_mul(decimal_t *from1, decimal_t *from2, decimal_t *to)
 | 
						||
{
 | 
						||
  int intg1=ROUND_UP(from1->intg), intg2=ROUND_UP(from2->intg),
 | 
						||
      frac1=ROUND_UP(from1->frac), frac2=ROUND_UP(from2->frac),
 | 
						||
      intg0=ROUND_UP(from1->intg+from2->intg),
 | 
						||
      frac0=frac1+frac2, error, i, j, d_to_move;
 | 
						||
  dec1 *buf1=from1->buf+intg1, *buf2=from2->buf+intg2, *buf0,
 | 
						||
       *start2, *stop2, *stop1, *start0, carry;
 | 
						||
 | 
						||
  sanity(to);
 | 
						||
 | 
						||
  i=intg0;
 | 
						||
  j=frac0;
 | 
						||
  FIX_INTG_FRAC_ERROR(to->len, intg0, frac0, error);
 | 
						||
  to->sign=from1->sign != from2->sign;
 | 
						||
  to->frac=from1->frac+from2->frac;
 | 
						||
  to->intg=intg0*DIG_PER_DEC1;
 | 
						||
 | 
						||
  if (unlikely(error))
 | 
						||
  {
 | 
						||
    set_if_smaller(to->frac, frac0*DIG_PER_DEC1);
 | 
						||
    set_if_smaller(to->intg, intg0*DIG_PER_DEC1);
 | 
						||
    if (unlikely(i > intg0))
 | 
						||
    {
 | 
						||
      i-=intg0;
 | 
						||
      j=i >> 1;
 | 
						||
      intg1-= j;
 | 
						||
      intg2-=i-j;
 | 
						||
      frac1=frac2=0; /* frac0 is already 0 here */
 | 
						||
    }
 | 
						||
    else
 | 
						||
    {
 | 
						||
      j-=frac0;
 | 
						||
      i=j >> 1;
 | 
						||
      frac1-= i;
 | 
						||
      frac2-=j-i;
 | 
						||
    }
 | 
						||
  }
 | 
						||
  start0=to->buf+intg0+frac0-1;
 | 
						||
  start2=buf2+frac2-1;
 | 
						||
  stop1=buf1-intg1;
 | 
						||
  stop2=buf2-intg2;
 | 
						||
 | 
						||
  bzero(to->buf, (intg0+frac0)*sizeof(dec1));
 | 
						||
 | 
						||
  for (buf1+=frac1-1; buf1 >= stop1; buf1--, start0--)
 | 
						||
  {
 | 
						||
    carry=0;
 | 
						||
    for (buf0=start0, buf2=start2; buf2 >= stop2; buf2--, buf0--)
 | 
						||
    {
 | 
						||
      dec1 hi, lo;
 | 
						||
      dec2 p= ((dec2)*buf1) * ((dec2)*buf2);
 | 
						||
      hi=(dec1)(p/DIG_BASE);
 | 
						||
      lo=(dec1)(p-((dec2)hi)*DIG_BASE);
 | 
						||
      ADD2(*buf0, *buf0, lo, carry);
 | 
						||
      carry+=hi;
 | 
						||
    }
 | 
						||
    if (carry)
 | 
						||
    {
 | 
						||
      if (buf0 < to->buf)
 | 
						||
        return E_DEC_OVERFLOW;
 | 
						||
      ADD2(*buf0, *buf0, 0, carry);
 | 
						||
    }
 | 
						||
    for (buf0--; carry; buf0--)
 | 
						||
    {
 | 
						||
      if (buf0 < to->buf)
 | 
						||
        return E_DEC_OVERFLOW;
 | 
						||
      ADD(*buf0, *buf0, 0, carry);
 | 
						||
    }
 | 
						||
  }
 | 
						||
 | 
						||
  /* Now we have to check for -0.000 case */
 | 
						||
  if (to->sign)
 | 
						||
  {
 | 
						||
    dec1 *buf= to->buf;
 | 
						||
    dec1 *end= to->buf + intg0 + frac0;
 | 
						||
    DBUG_ASSERT(buf != end);
 | 
						||
    for (;;)
 | 
						||
    {
 | 
						||
      if (*buf)
 | 
						||
        break;
 | 
						||
      if (++buf == end)
 | 
						||
      {
 | 
						||
        /* We got decimal zero */
 | 
						||
        decimal_make_zero(to);
 | 
						||
        break;
 | 
						||
      }
 | 
						||
    }
 | 
						||
  }
 | 
						||
  buf1= to->buf;
 | 
						||
  d_to_move= intg0 + ROUND_UP(to->frac);
 | 
						||
  while (!*buf1 && (to->intg > DIG_PER_DEC1))
 | 
						||
  {
 | 
						||
    buf1++;
 | 
						||
    to->intg-= DIG_PER_DEC1;
 | 
						||
    d_to_move--;
 | 
						||
  }
 | 
						||
  if (to->buf < buf1)
 | 
						||
  {
 | 
						||
    dec1 *cur_d= to->buf;
 | 
						||
    for (; d_to_move--; cur_d++, buf1++)
 | 
						||
      *cur_d= *buf1;
 | 
						||
  }
 | 
						||
  return error;
 | 
						||
}
 | 
						||
 | 
						||
/*
 | 
						||
  naive division algorithm (Knuth's Algorithm D in 4.3.1) -
 | 
						||
  it's ok for short numbers
 | 
						||
  also we're using alloca() to allocate a temporary buffer
 | 
						||
 | 
						||
  XXX if this library is to be used with huge numbers of thousands of
 | 
						||
  digits, fast division must be implemented and alloca should be
 | 
						||
  changed to malloc (or at least fallback to malloc if alloca() fails)
 | 
						||
  but then, decimal_mul() should be rewritten too :(
 | 
						||
*/
 | 
						||
static int do_div_mod(decimal_t *from1, decimal_t *from2,
 | 
						||
                       decimal_t *to, decimal_t *mod, int scale_incr)
 | 
						||
{
 | 
						||
  int frac1=ROUND_UP(from1->frac)*DIG_PER_DEC1, prec1=from1->intg+frac1,
 | 
						||
      frac2=ROUND_UP(from2->frac)*DIG_PER_DEC1, prec2=from2->intg+frac2,
 | 
						||
      error, i, intg0, frac0, len1, len2, dintg, div=(!mod);
 | 
						||
  dec1 *buf0, *buf1=from1->buf, *buf2=from2->buf, *tmp1,
 | 
						||
       *start2, *stop2, *stop1, *stop0, norm2, carry, *start1, dcarry;
 | 
						||
  dec2 norm_factor, x, guess, y;
 | 
						||
 | 
						||
  LINT_INIT(error);
 | 
						||
 | 
						||
  if (mod)
 | 
						||
    to=mod;
 | 
						||
 | 
						||
  sanity(to);
 | 
						||
 | 
						||
  /* removing all the leading zeroes */
 | 
						||
  i= ((prec2 - 1) % DIG_PER_DEC1) + 1;
 | 
						||
  while (prec2 > 0 && *buf2 == 0)
 | 
						||
  {
 | 
						||
    prec2-= i;
 | 
						||
    i= DIG_PER_DEC1;
 | 
						||
    buf2++;
 | 
						||
  }
 | 
						||
  if (prec2 <= 0) /* short-circuit everything: from2 == 0 */
 | 
						||
    return E_DEC_DIV_ZERO;
 | 
						||
  for (i= (prec2 - 1) % DIG_PER_DEC1; *buf2 < powers10[i--]; prec2--) ;
 | 
						||
  DBUG_ASSERT(prec2 > 0);
 | 
						||
 | 
						||
  i=((prec1-1) % DIG_PER_DEC1)+1;
 | 
						||
  while (prec1 > 0 && *buf1 == 0)
 | 
						||
  {
 | 
						||
    prec1-=i;
 | 
						||
    i=DIG_PER_DEC1;
 | 
						||
    buf1++;
 | 
						||
  }
 | 
						||
  if (prec1 <= 0)
 | 
						||
  { /* short-circuit everything: from1 == 0 */
 | 
						||
    decimal_make_zero(to);
 | 
						||
    return E_DEC_OK;
 | 
						||
  }
 | 
						||
  for (i=(prec1-1) % DIG_PER_DEC1; *buf1 < powers10[i--]; prec1--) ;
 | 
						||
  DBUG_ASSERT(prec1 > 0);
 | 
						||
 | 
						||
  /* let's fix scale_incr, taking into account frac1,frac2 increase */
 | 
						||
  if ((scale_incr-= frac1 - from1->frac + frac2 - from2->frac) < 0)
 | 
						||
    scale_incr=0;
 | 
						||
 | 
						||
  dintg=(prec1-frac1)-(prec2-frac2)+(*buf1 >= *buf2);
 | 
						||
  if (dintg < 0)
 | 
						||
  {
 | 
						||
    dintg/=DIG_PER_DEC1;
 | 
						||
    intg0=0;
 | 
						||
  }
 | 
						||
  else
 | 
						||
    intg0=ROUND_UP(dintg);
 | 
						||
  if (mod)
 | 
						||
  {
 | 
						||
    /* we're calculating N1 % N2.
 | 
						||
       The result will have
 | 
						||
         frac=max(frac1, frac2), as for subtraction
 | 
						||
         intg=intg2
 | 
						||
    */
 | 
						||
    to->sign=from1->sign;
 | 
						||
    to->frac=max(from1->frac, from2->frac);
 | 
						||
    frac0=0;
 | 
						||
  }
 | 
						||
  else
 | 
						||
  {
 | 
						||
    /*
 | 
						||
      we're calculating N1/N2. N1 is in the buf1, has prec1 digits
 | 
						||
      N2 is in the buf2, has prec2 digits. Scales are frac1 and
 | 
						||
      frac2 accordingly.
 | 
						||
      Thus, the result will have
 | 
						||
         frac = ROUND_UP(frac1+frac2+scale_incr)
 | 
						||
      and
 | 
						||
         intg = (prec1-frac1) - (prec2-frac2) + 1
 | 
						||
         prec = intg+frac
 | 
						||
    */
 | 
						||
    frac0=ROUND_UP(frac1+frac2+scale_incr);
 | 
						||
    FIX_INTG_FRAC_ERROR(to->len, intg0, frac0, error);
 | 
						||
    to->sign=from1->sign != from2->sign;
 | 
						||
    to->intg=intg0*DIG_PER_DEC1;
 | 
						||
    to->frac=frac0*DIG_PER_DEC1;
 | 
						||
  }
 | 
						||
  buf0=to->buf;
 | 
						||
  stop0=buf0+intg0+frac0;
 | 
						||
  if (likely(div))
 | 
						||
    while (dintg++ < 0)
 | 
						||
      *buf0++=0;
 | 
						||
 | 
						||
  len1=(i=ROUND_UP(prec1))+ROUND_UP(2*frac2+scale_incr+1) + 1;
 | 
						||
  set_if_bigger(len1, 3);
 | 
						||
  if (!(tmp1=(dec1 *)my_alloca(len1*sizeof(dec1))))
 | 
						||
    return E_DEC_OOM;
 | 
						||
  memcpy(tmp1, buf1, i*sizeof(dec1));
 | 
						||
  bzero(tmp1+i, (len1-i)*sizeof(dec1));
 | 
						||
 | 
						||
  start1=tmp1;
 | 
						||
  stop1=start1+len1;
 | 
						||
  start2=buf2;
 | 
						||
  stop2=buf2+ROUND_UP(prec2)-1;
 | 
						||
 | 
						||
  /* removing end zeroes */
 | 
						||
  while (*stop2 == 0 && stop2 >= start2)
 | 
						||
    stop2--;
 | 
						||
  len2= (int) (stop2++ - start2);
 | 
						||
 | 
						||
  /*
 | 
						||
    calculating norm2 (normalized *start2) - we need *start2 to be large
 | 
						||
    (at least > DIG_BASE/2), but unlike Knuth's Alg. D we don't want to
 | 
						||
    normalize input numbers (as we don't make a copy of the divisor).
 | 
						||
    Thus we normalize first dec1 of buf2 only, and we'll normalize *start1
 | 
						||
    on the fly for the purpose of guesstimation only.
 | 
						||
    It's also faster, as we're saving on normalization of buf2
 | 
						||
  */
 | 
						||
  norm_factor=DIG_BASE/(*start2+1);
 | 
						||
  norm2=(dec1)(norm_factor*start2[0]);
 | 
						||
  if (likely(len2>0))
 | 
						||
    norm2+=(dec1)(norm_factor*start2[1]/DIG_BASE);
 | 
						||
 | 
						||
  if (*start1 < *start2)
 | 
						||
    dcarry=*start1++;
 | 
						||
  else
 | 
						||
    dcarry=0;
 | 
						||
 | 
						||
  /* main loop */
 | 
						||
  for (; buf0 < stop0; buf0++)
 | 
						||
  {
 | 
						||
    /* short-circuit, if possible */
 | 
						||
    if (unlikely(dcarry == 0 && *start1 < *start2))
 | 
						||
      guess=0;
 | 
						||
    else
 | 
						||
    {
 | 
						||
      /* D3: make a guess */
 | 
						||
      x=start1[0]+((dec2)dcarry)*DIG_BASE;
 | 
						||
      y=start1[1];
 | 
						||
      guess=(norm_factor*x+norm_factor*y/DIG_BASE)/norm2;
 | 
						||
      if (unlikely(guess >= DIG_BASE))
 | 
						||
        guess=DIG_BASE-1;
 | 
						||
      if (likely(len2>0))
 | 
						||
      {
 | 
						||
        /* hmm, this is a suspicious trick - I removed normalization here */
 | 
						||
        if (start2[1]*guess > (x-guess*start2[0])*DIG_BASE+y)
 | 
						||
          guess--;
 | 
						||
        if (unlikely(start2[1]*guess > (x-guess*start2[0])*DIG_BASE+y))
 | 
						||
          guess--;
 | 
						||
        DBUG_ASSERT(start2[1]*guess <= (x-guess*start2[0])*DIG_BASE+y);
 | 
						||
      }
 | 
						||
 | 
						||
      /* D4: multiply and subtract */
 | 
						||
      buf2=stop2;
 | 
						||
      buf1=start1+len2;
 | 
						||
      DBUG_ASSERT(buf1 < stop1);
 | 
						||
      for (carry=0; buf2 > start2; buf1--)
 | 
						||
      {
 | 
						||
        dec1 hi, lo;
 | 
						||
        x=guess * (*--buf2);
 | 
						||
        hi=(dec1)(x/DIG_BASE);
 | 
						||
        lo=(dec1)(x-((dec2)hi)*DIG_BASE);
 | 
						||
        SUB2(*buf1, *buf1, lo, carry);
 | 
						||
        carry+=hi;
 | 
						||
      }
 | 
						||
      carry= dcarry < carry;
 | 
						||
 | 
						||
      /* D5: check the remainder */
 | 
						||
      if (unlikely(carry))
 | 
						||
      {
 | 
						||
        /* D6: correct the guess */
 | 
						||
        guess--;
 | 
						||
        buf2=stop2;
 | 
						||
        buf1=start1+len2;
 | 
						||
        for (carry=0; buf2 > start2; buf1--)
 | 
						||
        {
 | 
						||
          ADD(*buf1, *buf1, *--buf2, carry);
 | 
						||
        }
 | 
						||
      }
 | 
						||
    }
 | 
						||
    if (likely(div))
 | 
						||
      *buf0=(dec1)guess;
 | 
						||
    dcarry= *start1;
 | 
						||
    start1++;
 | 
						||
  }
 | 
						||
  if (mod)
 | 
						||
  {
 | 
						||
    /*
 | 
						||
      now the result is in tmp1, it has
 | 
						||
        intg=prec1-frac1
 | 
						||
        frac=max(frac1, frac2)=to->frac
 | 
						||
    */
 | 
						||
    if (dcarry)
 | 
						||
      *--start1=dcarry;
 | 
						||
    buf0=to->buf;
 | 
						||
    intg0=(int) (ROUND_UP(prec1-frac1)-(start1-tmp1));
 | 
						||
    frac0=ROUND_UP(to->frac);
 | 
						||
    error=E_DEC_OK;
 | 
						||
    if (unlikely(frac0==0 && intg0==0))
 | 
						||
    {
 | 
						||
      decimal_make_zero(to);
 | 
						||
      goto done;
 | 
						||
    }
 | 
						||
    if (intg0<=0)
 | 
						||
    {
 | 
						||
      if (unlikely(-intg0 >= to->len))
 | 
						||
      {
 | 
						||
        decimal_make_zero(to);
 | 
						||
        error=E_DEC_TRUNCATED;
 | 
						||
        goto done;
 | 
						||
      }
 | 
						||
      stop1=start1+frac0;
 | 
						||
      frac0+=intg0;
 | 
						||
      to->intg=0;
 | 
						||
      while (intg0++ < 0)
 | 
						||
        *buf0++=0;
 | 
						||
    }
 | 
						||
    else
 | 
						||
    {
 | 
						||
      if (unlikely(intg0 > to->len))
 | 
						||
      {
 | 
						||
        frac0=0;
 | 
						||
        intg0=to->len;
 | 
						||
        error=E_DEC_OVERFLOW;
 | 
						||
        goto done;
 | 
						||
      }
 | 
						||
      DBUG_ASSERT(intg0 <= ROUND_UP(from2->intg));
 | 
						||
      stop1=start1+frac0+intg0;
 | 
						||
      to->intg=min(intg0*DIG_PER_DEC1, from2->intg);
 | 
						||
    }
 | 
						||
    if (unlikely(intg0+frac0 > to->len))
 | 
						||
    {
 | 
						||
      stop1-=to->len-frac0-intg0;
 | 
						||
      frac0=to->len-intg0;
 | 
						||
      to->frac=frac0*DIG_PER_DEC1;
 | 
						||
        error=E_DEC_TRUNCATED;
 | 
						||
    }
 | 
						||
    while (start1 < stop1)
 | 
						||
        *buf0++=*start1++;
 | 
						||
  }
 | 
						||
done:
 | 
						||
  my_afree(tmp1);
 | 
						||
  return error;
 | 
						||
}
 | 
						||
 | 
						||
/*
 | 
						||
  division of two decimals
 | 
						||
 | 
						||
  SYNOPSIS
 | 
						||
    decimal_div()
 | 
						||
      from1   - dividend
 | 
						||
      from2   - divisor
 | 
						||
      to      - quotient
 | 
						||
 | 
						||
  RETURN VALUE
 | 
						||
    E_DEC_OK/E_DEC_TRUNCATED/E_DEC_OVERFLOW/E_DEC_DIV_ZERO;
 | 
						||
 | 
						||
  NOTES
 | 
						||
    see do_div_mod()
 | 
						||
*/
 | 
						||
 | 
						||
int
 | 
						||
decimal_div(decimal_t *from1, decimal_t *from2, decimal_t *to, int scale_incr)
 | 
						||
{
 | 
						||
  return do_div_mod(from1, from2, to, 0, scale_incr);
 | 
						||
}
 | 
						||
 | 
						||
/*
 | 
						||
  modulus
 | 
						||
 | 
						||
  SYNOPSIS
 | 
						||
    decimal_mod()
 | 
						||
      from1   - dividend
 | 
						||
      from2   - divisor
 | 
						||
      to      - modulus
 | 
						||
 | 
						||
  RETURN VALUE
 | 
						||
    E_DEC_OK/E_DEC_TRUNCATED/E_DEC_OVERFLOW/E_DEC_DIV_ZERO;
 | 
						||
 | 
						||
  NOTES
 | 
						||
    see do_div_mod()
 | 
						||
 | 
						||
  DESCRIPTION
 | 
						||
    the modulus R in    R = M mod N
 | 
						||
 | 
						||
   is defined as
 | 
						||
 | 
						||
     0 <= |R| < |M|
 | 
						||
     sign R == sign M
 | 
						||
     R = M - k*N, where k is integer
 | 
						||
 | 
						||
   thus, there's no requirement for M or N to be integers
 | 
						||
*/
 | 
						||
 | 
						||
int decimal_mod(decimal_t *from1, decimal_t *from2, decimal_t *to)
 | 
						||
{
 | 
						||
  return do_div_mod(from1, from2, 0, to, 0);
 | 
						||
}
 | 
						||
 | 
						||
#ifdef MAIN
 | 
						||
 | 
						||
int full= 0;
 | 
						||
decimal_t a, b, c;
 | 
						||
char buf1[100], buf2[100], buf3[100];
 | 
						||
 | 
						||
void dump_decimal(decimal_t *d)
 | 
						||
{
 | 
						||
  int i;
 | 
						||
  printf("/* intg=%d, frac=%d, sign=%d, buf[]={", d->intg, d->frac, d->sign);
 | 
						||
  for (i=0; i < ROUND_UP(d->frac)+ROUND_UP(d->intg)-1; i++)
 | 
						||
    printf("%09d, ", d->buf[i]);
 | 
						||
  printf("%09d} */ ", d->buf[i]);
 | 
						||
}
 | 
						||
 | 
						||
 | 
						||
void check_result_code(int actual, int want)
 | 
						||
{
 | 
						||
  if (actual != want)
 | 
						||
  {
 | 
						||
    printf("\n^^^^^^^^^^^^^ must return %d\n", want);
 | 
						||
    exit(1);
 | 
						||
  }
 | 
						||
}
 | 
						||
 | 
						||
 | 
						||
void print_decimal(decimal_t *d, const char *orig, int actual, int want)
 | 
						||
{
 | 
						||
  char s[100];
 | 
						||
  int slen=sizeof(s);
 | 
						||
 | 
						||
  if (full) dump_decimal(d);
 | 
						||
  decimal2string(d, s, &slen, 0, 0, 0);
 | 
						||
  printf("'%s'", s);
 | 
						||
  check_result_code(actual, want);
 | 
						||
  if (orig && strcmp(orig, s))
 | 
						||
  {
 | 
						||
    printf("\n^^^^^^^^^^^^^ must've been '%s'\n", orig);
 | 
						||
    exit(1);
 | 
						||
  }
 | 
						||
}
 | 
						||
 | 
						||
void test_d2s()
 | 
						||
{
 | 
						||
  char s[100];
 | 
						||
  int slen, res;
 | 
						||
 | 
						||
  /***********************************/
 | 
						||
  printf("==== decimal2string ====\n");
 | 
						||
  a.buf[0]=12345; a.intg=5; a.frac=0; a.sign=0;
 | 
						||
  slen=sizeof(s);
 | 
						||
  res=decimal2string(&a, s, &slen, 0, 0, 0);
 | 
						||
  dump_decimal(&a); printf("  -->  res=%d str='%s' len=%d\n", res, s, slen);
 | 
						||
 | 
						||
  a.buf[1]=987000000; a.frac=3;
 | 
						||
  slen=sizeof(s);
 | 
						||
  res=decimal2string(&a, s, &slen, 0, 0, 0);
 | 
						||
  dump_decimal(&a); printf("  -->  res=%d str='%s' len=%d\n", res, s, slen);
 | 
						||
 | 
						||
  a.sign=1;
 | 
						||
  slen=sizeof(s);
 | 
						||
  res=decimal2string(&a, s, &slen, 0, 0, 0);
 | 
						||
  dump_decimal(&a); printf("  -->  res=%d str='%s' len=%d\n", res, s, slen);
 | 
						||
 | 
						||
  slen=8;
 | 
						||
  res=decimal2string(&a, s, &slen, 0, 0, 0);
 | 
						||
  dump_decimal(&a); printf("  -->  res=%d str='%s' len=%d\n", res, s, slen);
 | 
						||
 | 
						||
  slen=5;
 | 
						||
  res=decimal2string(&a, s, &slen, 0, 0, 0);
 | 
						||
  dump_decimal(&a); printf("  -->  res=%d str='%s' len=%d\n", res, s, slen);
 | 
						||
 | 
						||
  a.buf[0]=987000000; a.frac=3; a.intg=0;
 | 
						||
  slen=sizeof(s);
 | 
						||
  res=decimal2string(&a, s, &slen, 0, 0, 0);
 | 
						||
  dump_decimal(&a); printf("  -->  res=%d str='%s' len=%d\n", res, s, slen);
 | 
						||
}
 | 
						||
 | 
						||
void test_s2d(const char *s, const char *orig, int ex)
 | 
						||
{
 | 
						||
  char s1[100], *end;
 | 
						||
  int res;
 | 
						||
  sprintf(s1, "'%s'", s);
 | 
						||
  end= strend(s);
 | 
						||
  printf("len=%2d %-30s => res=%d    ", a.len, s1,
 | 
						||
         (res= string2decimal(s, &a, &end)));
 | 
						||
  print_decimal(&a, orig, res, ex);
 | 
						||
  printf("\n");
 | 
						||
}
 | 
						||
 | 
						||
void test_d2f(const char *s, int ex)
 | 
						||
{
 | 
						||
  char s1[100], *end;
 | 
						||
  double x;
 | 
						||
  int res;
 | 
						||
 | 
						||
  sprintf(s1, "'%s'", s);
 | 
						||
  end= strend(s);
 | 
						||
  string2decimal(s, &a, &end);
 | 
						||
  res=decimal2double(&a, &x);
 | 
						||
  if (full) dump_decimal(&a);
 | 
						||
  printf("%-40s => res=%d    %.*g\n", s1, res, a.intg+a.frac, x);
 | 
						||
  check_result_code(res, ex);
 | 
						||
}
 | 
						||
 | 
						||
void test_d2b2d(const char *str, int p, int s, const char *orig, int ex)
 | 
						||
{
 | 
						||
  char s1[100], buf[100], *end;
 | 
						||
  int res, i, size=decimal_bin_size(p, s);
 | 
						||
 | 
						||
  sprintf(s1, "'%s'", str);
 | 
						||
  end= strend(str);
 | 
						||
  string2decimal(str, &a, &end);
 | 
						||
  res=decimal2bin(&a, buf, p, s);
 | 
						||
  printf("%-31s {%2d, %2d} => res=%d size=%-2d ", s1, p, s, res, size);
 | 
						||
  if (full)
 | 
						||
  {
 | 
						||
    printf("0x");
 | 
						||
    for (i=0; i < size; i++)
 | 
						||
      printf("%02x", ((uchar *)buf)[i]);
 | 
						||
  }
 | 
						||
  res=bin2decimal(buf, &a, p, s);
 | 
						||
  printf(" => res=%d ", res);
 | 
						||
  print_decimal(&a, orig, res, ex);
 | 
						||
  printf("\n");
 | 
						||
}
 | 
						||
 | 
						||
void test_f2d(double from, int ex)
 | 
						||
{
 | 
						||
  int res;
 | 
						||
 | 
						||
  res=double2decimal(from, &a);
 | 
						||
  printf("%-40.*f => res=%d    ", DBL_DIG-2, from, res);
 | 
						||
  print_decimal(&a, 0, res, ex);
 | 
						||
  printf("\n");
 | 
						||
}
 | 
						||
 | 
						||
void test_ull2d(ulonglong from, const char *orig, int ex)
 | 
						||
{
 | 
						||
  char s[100];
 | 
						||
  int res;
 | 
						||
 | 
						||
  res=ulonglong2decimal(from, &a);
 | 
						||
  longlong10_to_str(from,s,10);
 | 
						||
  printf("%-40s => res=%d    ", s, res);
 | 
						||
  print_decimal(&a, orig, res, ex);
 | 
						||
  printf("\n");
 | 
						||
}
 | 
						||
 | 
						||
void test_ll2d(longlong from, const char *orig, int ex)
 | 
						||
{
 | 
						||
  char s[100];
 | 
						||
  int res;
 | 
						||
 | 
						||
  res=longlong2decimal(from, &a);
 | 
						||
  longlong10_to_str(from,s,-10);
 | 
						||
  printf("%-40s => res=%d    ", s, res);
 | 
						||
  print_decimal(&a, orig, res, ex);
 | 
						||
  printf("\n");
 | 
						||
}
 | 
						||
 | 
						||
void test_d2ull(const char *s, const char *orig, int ex)
 | 
						||
{
 | 
						||
  char s1[100], *end;
 | 
						||
  ulonglong x;
 | 
						||
  int res;
 | 
						||
 | 
						||
  end= strend(s);
 | 
						||
  string2decimal(s, &a, &end);
 | 
						||
  res=decimal2ulonglong(&a, &x);
 | 
						||
  if (full) dump_decimal(&a);
 | 
						||
  longlong10_to_str(x,s1,10);
 | 
						||
  printf("%-40s => res=%d    %s\n", s, res, s1);
 | 
						||
  check_result_code(res, ex);
 | 
						||
  if (orig && strcmp(orig, s1))
 | 
						||
  {
 | 
						||
    printf("\n^^^^^^^^^^^^^ must've been '%s'\n", orig);
 | 
						||
    exit(1);
 | 
						||
  }
 | 
						||
}
 | 
						||
 | 
						||
void test_d2ll(const char *s, const char *orig, int ex)
 | 
						||
{
 | 
						||
  char s1[100], *end;
 | 
						||
  longlong x;
 | 
						||
  int res;
 | 
						||
 | 
						||
  end= strend(s);
 | 
						||
  string2decimal(s, &a, &end);
 | 
						||
  res=decimal2longlong(&a, &x);
 | 
						||
  if (full) dump_decimal(&a);
 | 
						||
  longlong10_to_str(x,s1,-10);
 | 
						||
  printf("%-40s => res=%d    %s\n", s, res, s1);
 | 
						||
  check_result_code(res, ex);
 | 
						||
  if (orig && strcmp(orig, s1))
 | 
						||
  {
 | 
						||
    printf("\n^^^^^^^^^^^^^ must've been '%s'\n", orig);
 | 
						||
    exit(1);
 | 
						||
  }
 | 
						||
}
 | 
						||
 | 
						||
void test_da(const char *s1, const char *s2, const char *orig, int ex)
 | 
						||
{
 | 
						||
  char s[100], *end;
 | 
						||
  int res;
 | 
						||
  sprintf(s, "'%s' + '%s'", s1, s2);
 | 
						||
  end= strend(s1);
 | 
						||
  string2decimal(s1, &a, &end);
 | 
						||
  end= strend(s2);
 | 
						||
  string2decimal(s2, &b, &end);
 | 
						||
  res=decimal_add(&a, &b, &c);
 | 
						||
  printf("%-40s => res=%d    ", s, res);
 | 
						||
  print_decimal(&c, orig, res, ex);
 | 
						||
  printf("\n");
 | 
						||
}
 | 
						||
 | 
						||
void test_ds(const char *s1, const char *s2, const char *orig, int ex)
 | 
						||
{
 | 
						||
  char s[100], *end;
 | 
						||
  int res;
 | 
						||
  sprintf(s, "'%s' - '%s'", s1, s2);
 | 
						||
  end= strend(s1);
 | 
						||
  string2decimal(s1, &a, &end);
 | 
						||
  end= strend(s2);
 | 
						||
  string2decimal(s2, &b, &end);
 | 
						||
  res=decimal_sub(&a, &b, &c);
 | 
						||
  printf("%-40s => res=%d    ", s, res);
 | 
						||
  print_decimal(&c, orig, res, ex);
 | 
						||
  printf("\n");
 | 
						||
}
 | 
						||
 | 
						||
void test_dc(const char *s1, const char *s2, int orig)
 | 
						||
{
 | 
						||
  char s[100], *end;
 | 
						||
  int res;
 | 
						||
  sprintf(s, "'%s' <=> '%s'", s1, s2);
 | 
						||
  end= strend(s1);
 | 
						||
  string2decimal(s1, &a, &end);
 | 
						||
  end= strend(s2);
 | 
						||
  string2decimal(s2, &b, &end);
 | 
						||
  res=decimal_cmp(&a, &b);
 | 
						||
  printf("%-40s => res=%d\n", s, res);
 | 
						||
  if (orig != res)
 | 
						||
  {
 | 
						||
    printf("\n^^^^^^^^^^^^^ must've been %d\n", orig);
 | 
						||
    exit(1);
 | 
						||
  }
 | 
						||
}
 | 
						||
 | 
						||
void test_dm(const char *s1, const char *s2, const char *orig, int ex)
 | 
						||
{
 | 
						||
  char s[100], *end;
 | 
						||
  int res;
 | 
						||
  sprintf(s, "'%s' * '%s'", s1, s2);
 | 
						||
  end= strend(s1);
 | 
						||
  string2decimal(s1, &a, &end);
 | 
						||
  end= strend(s2);
 | 
						||
  string2decimal(s2, &b, &end);
 | 
						||
  res=decimal_mul(&a, &b, &c);
 | 
						||
  printf("%-40s => res=%d    ", s, res);
 | 
						||
  print_decimal(&c, orig, res, ex);
 | 
						||
  printf("\n");
 | 
						||
}
 | 
						||
 | 
						||
void test_dv(const char *s1, const char *s2, const char *orig, int ex)
 | 
						||
{
 | 
						||
  char s[100], *end;
 | 
						||
  int res;
 | 
						||
  sprintf(s, "'%s' / '%s'", s1, s2);
 | 
						||
  end= strend(s1);
 | 
						||
  string2decimal(s1, &a, &end);
 | 
						||
  end= strend(s2);
 | 
						||
  string2decimal(s2, &b, &end);
 | 
						||
  res=decimal_div(&a, &b, &c, 5);
 | 
						||
  printf("%-40s => res=%d    ", s, res);
 | 
						||
  check_result_code(res, ex);
 | 
						||
  if (res == E_DEC_DIV_ZERO)
 | 
						||
    printf("E_DEC_DIV_ZERO");
 | 
						||
  else
 | 
						||
    print_decimal(&c, orig, res, ex);
 | 
						||
  printf("\n");
 | 
						||
}
 | 
						||
 | 
						||
void test_md(const char *s1, const char *s2, const char *orig, int ex)
 | 
						||
{
 | 
						||
  char s[100], *end;
 | 
						||
  int res;
 | 
						||
  sprintf(s, "'%s' %% '%s'", s1, s2);
 | 
						||
  end= strend(s1);
 | 
						||
  string2decimal(s1, &a, &end);
 | 
						||
  end= strend(s2);
 | 
						||
  string2decimal(s2, &b, &end);
 | 
						||
  res=decimal_mod(&a, &b, &c);
 | 
						||
  printf("%-40s => res=%d    ", s, res);
 | 
						||
  check_result_code(res, ex);
 | 
						||
  if (res == E_DEC_DIV_ZERO)
 | 
						||
    printf("E_DEC_DIV_ZERO");
 | 
						||
  else
 | 
						||
    print_decimal(&c, orig, res, ex);
 | 
						||
  printf("\n");
 | 
						||
}
 | 
						||
 | 
						||
const char *round_mode[]=
 | 
						||
{"TRUNCATE", "HALF_EVEN", "HALF_UP", "CEILING", "FLOOR"};
 | 
						||
 | 
						||
void test_ro(const char *s1, int n, decimal_round_mode mode, const char *orig,
 | 
						||
             int ex)
 | 
						||
{
 | 
						||
  char s[100], *end;
 | 
						||
  int res;
 | 
						||
  sprintf(s, "'%s', %d, %s", s1, n, round_mode[mode]);
 | 
						||
  end= strend(s1);
 | 
						||
  string2decimal(s1, &a, &end);
 | 
						||
  res=decimal_round(&a, &b, n, mode);
 | 
						||
  printf("%-40s => res=%d    ", s, res);
 | 
						||
  print_decimal(&b, orig, res, ex);
 | 
						||
  printf("\n");
 | 
						||
}
 | 
						||
 | 
						||
 | 
						||
void test_mx(int precision, int frac, const char *orig)
 | 
						||
{
 | 
						||
  char s[100];
 | 
						||
  sprintf(s, "%d, %d", precision, frac);
 | 
						||
  max_decimal(precision, frac, &a);
 | 
						||
  printf("%-40s =>          ", s);
 | 
						||
  print_decimal(&a, orig, 0, 0);
 | 
						||
  printf("\n");
 | 
						||
}
 | 
						||
 | 
						||
 | 
						||
void test_pr(const char *s1, int prec, int dec, char filler, const char *orig,
 | 
						||
             int ex)
 | 
						||
{
 | 
						||
  char s[100], *end;
 | 
						||
  char s2[100];
 | 
						||
  int slen= sizeof(s2);
 | 
						||
  int res;
 | 
						||
 | 
						||
  sprintf(s, filler ? "'%s', %d, %d, '%c'" : "'%s', %d, %d, '\\0'",
 | 
						||
          s1, prec, dec, filler);
 | 
						||
  end= strend(s1);
 | 
						||
  string2decimal(s1, &a, &end);
 | 
						||
  res= decimal2string(&a, s2, &slen, prec, dec, filler);
 | 
						||
  printf("%-40s => res=%d    '%s'", s, res, s2);
 | 
						||
  check_result_code(res, ex);
 | 
						||
  if (orig && strcmp(orig, s2))
 | 
						||
  {
 | 
						||
    printf("\n^^^^^^^^^^^^^ must've been '%s'\n", orig);
 | 
						||
    exit(1);
 | 
						||
  }
 | 
						||
  printf("\n");
 | 
						||
}
 | 
						||
 | 
						||
 | 
						||
void test_sh(const char *s1, int shift, const char *orig, int ex)
 | 
						||
{
 | 
						||
  char s[100], *end;
 | 
						||
  int res;
 | 
						||
  sprintf(s, "'%s' %s %d", s1, ((shift < 0) ? ">>" : "<<"), abs(shift));
 | 
						||
  end= strend(s1);
 | 
						||
  string2decimal(s1, &a, &end);
 | 
						||
  res= decimal_shift(&a, shift);
 | 
						||
  printf("%-40s => res=%d    ", s, res);
 | 
						||
  print_decimal(&a, orig, res, ex);
 | 
						||
  printf("\n");
 | 
						||
}
 | 
						||
 | 
						||
 | 
						||
void test_fr(const char *s1, const char *orig)
 | 
						||
{
 | 
						||
  char s[100], *end;
 | 
						||
  sprintf(s, "'%s'", s1);
 | 
						||
  printf("%-40s =>          ", s);
 | 
						||
  end= strend(s1);
 | 
						||
  string2decimal(s1, &a, &end);
 | 
						||
  a.frac= decimal_actual_fraction(&a);
 | 
						||
  print_decimal(&a, orig, 0, 0);
 | 
						||
  printf("\n");
 | 
						||
}
 | 
						||
 | 
						||
 | 
						||
int main()
 | 
						||
{
 | 
						||
  a.buf=(void*)buf1;
 | 
						||
  a.len=sizeof(buf1)/sizeof(dec1);
 | 
						||
  b.buf=(void*)buf2;
 | 
						||
  b.len=sizeof(buf2)/sizeof(dec1);
 | 
						||
  c.buf=(void*)buf3;
 | 
						||
  c.len=sizeof(buf3)/sizeof(dec1);
 | 
						||
 | 
						||
  if (full)
 | 
						||
    test_d2s();
 | 
						||
 | 
						||
  printf("==== string2decimal ====\n");
 | 
						||
  test_s2d("12345", "12345", 0);
 | 
						||
  test_s2d("12345.", "12345", 0);
 | 
						||
  test_s2d("123.45", "123.45", 0);
 | 
						||
  test_s2d("-123.45", "-123.45", 0);
 | 
						||
  test_s2d(".00012345000098765", "0.00012345000098765", 0);
 | 
						||
  test_s2d(".12345000098765", "0.12345000098765", 0);
 | 
						||
  test_s2d("-.000000012345000098765", "-0.000000012345000098765", 0);
 | 
						||
  test_s2d("1234500009876.5", "1234500009876.5", 0);
 | 
						||
  a.len=1;
 | 
						||
  test_s2d("123450000098765", "98765", 2);
 | 
						||
  test_s2d("123450.000098765", "123450", 1);
 | 
						||
  a.len=sizeof(buf1)/sizeof(dec1);
 | 
						||
  test_s2d("123E5", "12300000", 0);
 | 
						||
  test_s2d("123E-2", "1.23", 0);
 | 
						||
 | 
						||
  printf("==== decimal2double ====\n");
 | 
						||
  test_d2f("12345", 0);
 | 
						||
  test_d2f("123.45", 0);
 | 
						||
  test_d2f("-123.45", 0);
 | 
						||
  test_d2f("0.00012345000098765", 0);
 | 
						||
  test_d2f("1234500009876.5", 0);
 | 
						||
 | 
						||
  printf("==== double2decimal ====\n");
 | 
						||
  test_f2d(12345, 0);
 | 
						||
  test_f2d(1.0/3, 0);
 | 
						||
  test_f2d(-123.45, 0);
 | 
						||
  test_f2d(0.00012345000098765, 0);
 | 
						||
  test_f2d(1234500009876.5, 0);
 | 
						||
 | 
						||
  printf("==== ulonglong2decimal ====\n");
 | 
						||
  test_ull2d(ULL(12345), "12345", 0);
 | 
						||
  test_ull2d(ULL(0), "0", 0);
 | 
						||
  test_ull2d(ULL(18446744073709551615), "18446744073709551615", 0);
 | 
						||
 | 
						||
  printf("==== decimal2ulonglong ====\n");
 | 
						||
  test_d2ull("12345", "12345", 0);
 | 
						||
  test_d2ull("0", "0", 0);
 | 
						||
  test_d2ull("18446744073709551615", "18446744073709551615", 0);
 | 
						||
  test_d2ull("18446744073709551616", "18446744073", 2);
 | 
						||
  test_d2ull("-1", "0", 2);
 | 
						||
  test_d2ull("1.23", "1", 1);
 | 
						||
  test_d2ull("9999999999999999999999999.000", "9999999999999999", 2);
 | 
						||
 | 
						||
  printf("==== longlong2decimal ====\n");
 | 
						||
  test_ll2d(LL(-12345), "-12345", 0);
 | 
						||
  test_ll2d(LL(-1), "-1", 0);
 | 
						||
  test_ll2d(LL(-9223372036854775807), "-9223372036854775807", 0);
 | 
						||
  test_ll2d(ULL(9223372036854775808), "-9223372036854775808", 0);
 | 
						||
 | 
						||
  printf("==== decimal2longlong ====\n");
 | 
						||
  test_d2ll("18446744073709551615", "18446744073", 2);
 | 
						||
  test_d2ll("-1", "-1", 0);
 | 
						||
  test_d2ll("-1.23", "-1", 1);
 | 
						||
  test_d2ll("-9223372036854775807", "-9223372036854775807", 0);
 | 
						||
  test_d2ll("-9223372036854775808", "-9223372036854775808", 0);
 | 
						||
  test_d2ll("9223372036854775808", "9223372036854775807", 2);
 | 
						||
 | 
						||
  printf("==== do_add ====\n");
 | 
						||
  test_da(".00012345000098765" ,"123.45", "123.45012345000098765", 0);
 | 
						||
  test_da(".1" ,".45", "0.55", 0);
 | 
						||
  test_da("1234500009876.5" ,".00012345000098765", "1234500009876.50012345000098765", 0);
 | 
						||
  test_da("9999909999999.5" ,".555", "9999910000000.055", 0);
 | 
						||
  test_da("99999999" ,"1", "100000000", 0);
 | 
						||
  test_da("989999999" ,"1", "990000000", 0);
 | 
						||
  test_da("999999999" ,"1", "1000000000", 0);
 | 
						||
  test_da("12345" ,"123.45", "12468.45", 0);
 | 
						||
  test_da("-12345" ,"-123.45", "-12468.45", 0);
 | 
						||
  test_ds("-12345" ,"123.45", "-12468.45", 0);
 | 
						||
  test_ds("12345" ,"-123.45", "12468.45", 0);
 | 
						||
 | 
						||
  printf("==== do_sub ====\n");
 | 
						||
  test_ds(".00012345000098765", "123.45","-123.44987654999901235", 0);
 | 
						||
  test_ds("1234500009876.5", ".00012345000098765","1234500009876.49987654999901235", 0);
 | 
						||
  test_ds("9999900000000.5", ".555","9999899999999.945", 0);
 | 
						||
  test_ds("1111.5551", "1111.555","0.0001", 0);
 | 
						||
  test_ds(".555", ".555","0", 0);
 | 
						||
  test_ds("10000000", "1","9999999", 0);
 | 
						||
  test_ds("1000001000", ".1","1000000999.9", 0);
 | 
						||
  test_ds("1000000000", ".1","999999999.9", 0);
 | 
						||
  test_ds("12345", "123.45","12221.55", 0);
 | 
						||
  test_ds("-12345", "-123.45","-12221.55", 0);
 | 
						||
  test_da("-12345", "123.45","-12221.55", 0);
 | 
						||
  test_da("12345", "-123.45","12221.55", 0);
 | 
						||
  test_ds("123.45", "12345","-12221.55", 0);
 | 
						||
  test_ds("-123.45", "-12345","12221.55", 0);
 | 
						||
  test_da("123.45", "-12345","-12221.55", 0);
 | 
						||
  test_da("-123.45", "12345","12221.55", 0);
 | 
						||
  test_da("5", "-6.0","-1.0", 0);
 | 
						||
 | 
						||
  printf("==== decimal_mul ====\n");
 | 
						||
  test_dm("12", "10","120", 0);
 | 
						||
  test_dm("-123.456", "98765.4321","-12193185.1853376", 0);
 | 
						||
  test_dm("-123456000000", "98765432100000","-12193185185337600000000000", 0);
 | 
						||
  test_dm("123456", "987654321","121931851853376", 0);
 | 
						||
  test_dm("123456", "9876543210","1219318518533760", 0);
 | 
						||
  test_dm("123", "0.01","1.23", 0);
 | 
						||
  test_dm("123", "0","0", 0);
 | 
						||
 | 
						||
  printf("==== decimal_div ====\n");
 | 
						||
  test_dv("120", "10","12.000000000", 0);
 | 
						||
  test_dv("123", "0.01","12300.000000000", 0);
 | 
						||
  test_dv("120", "100000000000.00000","0.000000001200000000", 0);
 | 
						||
  test_dv("123", "0","", 4);
 | 
						||
  test_dv("0", "0", "", 4);
 | 
						||
  test_dv("-12193185.1853376", "98765.4321","-123.456000000000000000", 0);
 | 
						||
  test_dv("121931851853376", "987654321","123456.000000000", 0);
 | 
						||
  test_dv("0", "987","0", 0);
 | 
						||
  test_dv("1", "3","0.333333333", 0);
 | 
						||
  test_dv("1.000000000000", "3","0.333333333333333333", 0);
 | 
						||
  test_dv("1", "1","1.000000000", 0);
 | 
						||
  test_dv("0.0123456789012345678912345", "9999999999","0.000000000001234567890246913578148141", 0);
 | 
						||
  test_dv("10.333000000", "12.34500","0.837019036046982584042122316", 0);
 | 
						||
  test_dv("10.000000000060", "2","5.000000000030000000", 0);
 | 
						||
 | 
						||
  printf("==== decimal_mod ====\n");
 | 
						||
  test_md("234","10","4", 0);
 | 
						||
  test_md("234.567","10.555","2.357", 0);
 | 
						||
  test_md("-234.567","10.555","-2.357", 0);
 | 
						||
  test_md("234.567","-10.555","2.357", 0);
 | 
						||
  c.buf[1]=0x3ABECA;
 | 
						||
  test_md("99999999999999999999999999999999999999","3","0", 0);
 | 
						||
  if (c.buf[1] != 0x3ABECA)
 | 
						||
  {
 | 
						||
    printf("%X - overflow\n", c.buf[1]);
 | 
						||
    exit(1);
 | 
						||
  }
 | 
						||
 | 
						||
  printf("==== decimal2bin/bin2decimal ====\n");
 | 
						||
  test_d2b2d("-10.55", 4, 2,"-10.55", 0);
 | 
						||
  test_d2b2d("0.0123456789012345678912345", 30, 25,"0.0123456789012345678912345", 0);
 | 
						||
  test_d2b2d("12345", 5, 0,"12345", 0);
 | 
						||
  test_d2b2d("12345", 10, 3,"12345.000", 0);
 | 
						||
  test_d2b2d("123.45", 10, 3,"123.450", 0);
 | 
						||
  test_d2b2d("-123.45", 20, 10,"-123.4500000000", 0);
 | 
						||
  test_d2b2d(".00012345000098765", 15, 14,"0.00012345000098", 0);
 | 
						||
  test_d2b2d(".00012345000098765", 22, 20,"0.00012345000098765000", 0);
 | 
						||
  test_d2b2d(".12345000098765", 30, 20,"0.12345000098765000000", 0);
 | 
						||
  test_d2b2d("-.000000012345000098765", 30, 20,"-0.00000001234500009876", 0);
 | 
						||
  test_d2b2d("1234500009876.5", 30, 5,"1234500009876.50000", 0);
 | 
						||
  test_d2b2d("111111111.11", 10, 2,"11111111.11", 0);
 | 
						||
  test_d2b2d("000000000.01", 7, 3,"0.010", 0);
 | 
						||
  test_d2b2d("123.4", 10, 2, "123.40", 0);
 | 
						||
 | 
						||
 | 
						||
  printf("==== decimal_cmp ====\n");
 | 
						||
  test_dc("12","13",-1);
 | 
						||
  test_dc("13","12",1);
 | 
						||
  test_dc("-10","10",-1);
 | 
						||
  test_dc("10","-10",1);
 | 
						||
  test_dc("-12","-13",1);
 | 
						||
  test_dc("0","12",-1);
 | 
						||
  test_dc("-10","0",-1);
 | 
						||
  test_dc("4","4",0);
 | 
						||
 | 
						||
  printf("==== decimal_round ====\n");
 | 
						||
  test_ro("5678.123451",-4,TRUNCATE,"0", 0);
 | 
						||
  test_ro("5678.123451",-3,TRUNCATE,"5000", 0);
 | 
						||
  test_ro("5678.123451",-2,TRUNCATE,"5600", 0);
 | 
						||
  test_ro("5678.123451",-1,TRUNCATE,"5670", 0);
 | 
						||
  test_ro("5678.123451",0,TRUNCATE,"5678", 0);
 | 
						||
  test_ro("5678.123451",1,TRUNCATE,"5678.1", 0);
 | 
						||
  test_ro("5678.123451",2,TRUNCATE,"5678.12", 0);
 | 
						||
  test_ro("5678.123451",3,TRUNCATE,"5678.123", 0);
 | 
						||
  test_ro("5678.123451",4,TRUNCATE,"5678.1234", 0);
 | 
						||
  test_ro("5678.123451",5,TRUNCATE,"5678.12345", 0);
 | 
						||
  test_ro("5678.123451",6,TRUNCATE,"5678.123451", 0);
 | 
						||
  test_ro("-5678.123451",-4,TRUNCATE,"0", 0);
 | 
						||
  memset(buf2, 33, sizeof(buf2));
 | 
						||
  test_ro("99999999999999999999999999999999999999",-31,TRUNCATE,"99999990000000000000000000000000000000", 0);
 | 
						||
  test_ro("15.1",0,HALF_UP,"15", 0);
 | 
						||
  test_ro("15.5",0,HALF_UP,"16", 0);
 | 
						||
  test_ro("15.9",0,HALF_UP,"16", 0);
 | 
						||
  test_ro("-15.1",0,HALF_UP,"-15", 0);
 | 
						||
  test_ro("-15.5",0,HALF_UP,"-16", 0);
 | 
						||
  test_ro("-15.9",0,HALF_UP,"-16", 0);
 | 
						||
  test_ro("15.1",1,HALF_UP,"15.1", 0);
 | 
						||
  test_ro("-15.1",1,HALF_UP,"-15.1", 0);
 | 
						||
  test_ro("15.17",1,HALF_UP,"15.2", 0);
 | 
						||
  test_ro("15.4",-1,HALF_UP,"20", 0);
 | 
						||
  test_ro("-15.4",-1,HALF_UP,"-20", 0);
 | 
						||
  test_ro("5.4",-1,HALF_UP,"10", 0);
 | 
						||
  test_ro(".999", 0, HALF_UP, "1", 0);
 | 
						||
  memset(buf2, 33, sizeof(buf2));
 | 
						||
  test_ro("999999999", -9, HALF_UP, "1000000000", 0);
 | 
						||
  test_ro("15.1",0,HALF_EVEN,"15", 0);
 | 
						||
  test_ro("15.5",0,HALF_EVEN,"16", 0);
 | 
						||
  test_ro("14.5",0,HALF_EVEN,"14", 0);
 | 
						||
  test_ro("15.9",0,HALF_EVEN,"16", 0);
 | 
						||
  test_ro("15.1",0,CEILING,"16", 0);
 | 
						||
  test_ro("-15.1",0,CEILING,"-15", 0);
 | 
						||
  test_ro("15.1",0,FLOOR,"15", 0);
 | 
						||
  test_ro("-15.1",0,FLOOR,"-16", 0);
 | 
						||
  test_ro("999999999999999999999.999", 0, CEILING,"1000000000000000000000", 0);
 | 
						||
  test_ro("-999999999999999999999.999", 0, FLOOR,"-1000000000000000000000", 0);
 | 
						||
 | 
						||
  b.buf[0]=DIG_BASE+1;
 | 
						||
  b.buf++;
 | 
						||
  test_ro(".3", 0, HALF_UP, "0", 0);
 | 
						||
  b.buf--;
 | 
						||
  if (b.buf[0] != DIG_BASE+1)
 | 
						||
  {
 | 
						||
    printf("%d - underflow\n", b.buf[0]);
 | 
						||
    exit(1);
 | 
						||
  }
 | 
						||
 | 
						||
  printf("==== max_decimal ====\n");
 | 
						||
  test_mx(1,1,"0.9");
 | 
						||
  test_mx(1,0,"9");
 | 
						||
  test_mx(2,1,"9.9");
 | 
						||
  test_mx(4,2,"99.99");
 | 
						||
  test_mx(6,3,"999.999");
 | 
						||
  test_mx(8,4,"9999.9999");
 | 
						||
  test_mx(10,5,"99999.99999");
 | 
						||
  test_mx(12,6,"999999.999999");
 | 
						||
  test_mx(14,7,"9999999.9999999");
 | 
						||
  test_mx(16,8,"99999999.99999999");
 | 
						||
  test_mx(18,9,"999999999.999999999");
 | 
						||
  test_mx(20,10,"9999999999.9999999999");
 | 
						||
  test_mx(20,20,"0.99999999999999999999");
 | 
						||
  test_mx(20,0,"99999999999999999999");
 | 
						||
  test_mx(40,20,"99999999999999999999.99999999999999999999");
 | 
						||
 | 
						||
  printf("==== decimal2string ====\n");
 | 
						||
  test_pr("123.123", 0, 0, 0, "123.123", 0);
 | 
						||
  test_pr("123.123", 7, 3, '0', "123.123", 0);
 | 
						||
  test_pr("123.123", 9, 3, '0', "00123.123", 0);
 | 
						||
  test_pr("123.123", 9, 4, '0', "0123.1230", 0);
 | 
						||
  test_pr("123.123", 9, 5, '0', "123.12300", 0);
 | 
						||
  test_pr("123.123", 9, 2, '0', "000123.12", 1);
 | 
						||
  test_pr("123.123", 9, 6, '0', "23.123000", 2);
 | 
						||
 | 
						||
  printf("==== decimal_shift ====\n");
 | 
						||
  test_sh("123.123", 1, "1231.23", 0);
 | 
						||
  test_sh("123457189.123123456789000", 1, "1234571891.23123456789", 0);
 | 
						||
  test_sh("123457189.123123456789000", 4, "1234571891231.23456789", 0);
 | 
						||
  test_sh("123457189.123123456789000", 8, "12345718912312345.6789", 0);
 | 
						||
  test_sh("123457189.123123456789000", 9, "123457189123123456.789", 0);
 | 
						||
  test_sh("123457189.123123456789000", 10, "1234571891231234567.89", 0);
 | 
						||
  test_sh("123457189.123123456789000", 17, "12345718912312345678900000", 0);
 | 
						||
  test_sh("123457189.123123456789000", 18, "123457189123123456789000000", 0);
 | 
						||
  test_sh("123457189.123123456789000", 19, "1234571891231234567890000000", 0);
 | 
						||
  test_sh("123457189.123123456789000", 26, "12345718912312345678900000000000000", 0);
 | 
						||
  test_sh("123457189.123123456789000", 27, "123457189123123456789000000000000000", 0);
 | 
						||
  test_sh("123457189.123123456789000", 28, "1234571891231234567890000000000000000", 0);
 | 
						||
  test_sh("000000000000000000000000123457189.123123456789000", 26, "12345718912312345678900000000000000", 0);
 | 
						||
  test_sh("00000000123457189.123123456789000", 27, "123457189123123456789000000000000000", 0);
 | 
						||
  test_sh("00000000000000000123457189.123123456789000", 28, "1234571891231234567890000000000000000", 0);
 | 
						||
  test_sh("123", 1, "1230", 0);
 | 
						||
  test_sh("123", 10, "1230000000000", 0);
 | 
						||
  test_sh(".123", 1, "1.23", 0);
 | 
						||
  test_sh(".123", 10, "1230000000", 0);
 | 
						||
  test_sh(".123", 14, "12300000000000", 0);
 | 
						||
  test_sh("000.000", 1000, "0", 0);
 | 
						||
  test_sh("000.", 1000, "0", 0);
 | 
						||
  test_sh(".000", 1000, "0", 0);
 | 
						||
  test_sh("1", 1000, "1", 2);
 | 
						||
  test_sh("123.123", -1, "12.3123", 0);
 | 
						||
  test_sh("123987654321.123456789000", -1, "12398765432.1123456789", 0);
 | 
						||
  test_sh("123987654321.123456789000", -2, "1239876543.21123456789", 0);
 | 
						||
  test_sh("123987654321.123456789000", -3, "123987654.321123456789", 0);
 | 
						||
  test_sh("123987654321.123456789000", -8, "1239.87654321123456789", 0);
 | 
						||
  test_sh("123987654321.123456789000", -9, "123.987654321123456789", 0);
 | 
						||
  test_sh("123987654321.123456789000", -10, "12.3987654321123456789", 0);
 | 
						||
  test_sh("123987654321.123456789000", -11, "1.23987654321123456789", 0);
 | 
						||
  test_sh("123987654321.123456789000", -12, "0.123987654321123456789", 0);
 | 
						||
  test_sh("123987654321.123456789000", -13, "0.0123987654321123456789", 0);
 | 
						||
  test_sh("123987654321.123456789000", -14, "0.00123987654321123456789", 0);
 | 
						||
  test_sh("00000087654321.123456789000", -14, "0.00000087654321123456789", 0);
 | 
						||
  a.len= 2;
 | 
						||
  test_sh("123.123", -2, "1.23123", 0);
 | 
						||
  test_sh("123.123", -3, "0.123123", 0);
 | 
						||
  test_sh("123.123", -6, "0.000123123", 0);
 | 
						||
  test_sh("123.123", -7, "0.0000123123", 0);
 | 
						||
  test_sh("123.123", -15, "0.000000000000123123", 0);
 | 
						||
  test_sh("123.123", -16, "0.000000000000012312", 1);
 | 
						||
  test_sh("123.123", -17, "0.000000000000001231", 1);
 | 
						||
  test_sh("123.123", -18, "0.000000000000000123", 1);
 | 
						||
  test_sh("123.123", -19, "0.000000000000000012", 1);
 | 
						||
  test_sh("123.123", -20, "0.000000000000000001", 1);
 | 
						||
  test_sh("123.123", -21, "0", 1);
 | 
						||
  test_sh(".000000000123", -1, "0.0000000000123", 0);
 | 
						||
  test_sh(".000000000123", -6, "0.000000000000000123", 0);
 | 
						||
  test_sh(".000000000123", -7, "0.000000000000000012", 1);
 | 
						||
  test_sh(".000000000123", -8, "0.000000000000000001", 1);
 | 
						||
  test_sh(".000000000123", -9, "0", 1);
 | 
						||
  test_sh(".000000000123", 1, "0.00000000123", 0);
 | 
						||
  test_sh(".000000000123", 8, "0.0123", 0);
 | 
						||
  test_sh(".000000000123", 9, "0.123", 0);
 | 
						||
  test_sh(".000000000123", 10, "1.23", 0);
 | 
						||
  test_sh(".000000000123", 17, "12300000", 0);
 | 
						||
  test_sh(".000000000123", 18, "123000000", 0);
 | 
						||
  test_sh(".000000000123", 19, "1230000000", 0);
 | 
						||
  test_sh(".000000000123", 20, "12300000000", 0);
 | 
						||
  test_sh(".000000000123", 21, "123000000000", 0);
 | 
						||
  test_sh(".000000000123", 22, "1230000000000", 0);
 | 
						||
  test_sh(".000000000123", 23, "12300000000000", 0);
 | 
						||
  test_sh(".000000000123", 24, "123000000000000", 0);
 | 
						||
  test_sh(".000000000123", 25, "1230000000000000", 0);
 | 
						||
  test_sh(".000000000123", 26, "12300000000000000", 0);
 | 
						||
  test_sh(".000000000123", 27, "123000000000000000", 0);
 | 
						||
  test_sh(".000000000123", 28, "0.000000000123", 2);
 | 
						||
  test_sh("123456789.987654321", -1, "12345678.998765432", 1);
 | 
						||
  test_sh("123456789.987654321", -2, "1234567.899876543", 1);
 | 
						||
  test_sh("123456789.987654321", -8, "1.234567900", 1);
 | 
						||
  test_sh("123456789.987654321", -9, "0.123456789987654321", 0);
 | 
						||
  test_sh("123456789.987654321", -10, "0.012345678998765432", 1);
 | 
						||
  test_sh("123456789.987654321", -17, "0.000000001234567900", 1);
 | 
						||
  test_sh("123456789.987654321", -18, "0.000000000123456790", 1);
 | 
						||
  test_sh("123456789.987654321", -19, "0.000000000012345679", 1);
 | 
						||
  test_sh("123456789.987654321", -26, "0.000000000000000001", 1);
 | 
						||
  test_sh("123456789.987654321", -27, "0", 1);
 | 
						||
  test_sh("123456789.987654321", 1, "1234567900", 1);
 | 
						||
  test_sh("123456789.987654321", 2, "12345678999", 1);
 | 
						||
  test_sh("123456789.987654321", 4, "1234567899877", 1);
 | 
						||
  test_sh("123456789.987654321", 8, "12345678998765432", 1);
 | 
						||
  test_sh("123456789.987654321", 9, "123456789987654321", 0);
 | 
						||
  test_sh("123456789.987654321", 10, "123456789.987654321", 2);
 | 
						||
  test_sh("123456789.987654321", 0, "123456789.987654321", 0);
 | 
						||
  a.len= sizeof(buf1)/sizeof(dec1);
 | 
						||
 | 
						||
  printf("==== decimal_actual_fraction ====\n");
 | 
						||
  test_fr("1.123456789000000000", "1.123456789");
 | 
						||
  test_fr("1.12345678000000000", "1.12345678");
 | 
						||
  test_fr("1.1234567000000000", "1.1234567");
 | 
						||
  test_fr("1.123456000000000", "1.123456");
 | 
						||
  test_fr("1.12345000000000", "1.12345");
 | 
						||
  test_fr("1.1234000000000", "1.1234");
 | 
						||
  test_fr("1.123000000000", "1.123");
 | 
						||
  test_fr("1.12000000000", "1.12");
 | 
						||
  test_fr("1.1000000000", "1.1");
 | 
						||
  test_fr("1.000000000", "1");
 | 
						||
  test_fr("1.0", "1");
 | 
						||
  test_fr("10000000000000000000.0", "10000000000000000000");
 | 
						||
 | 
						||
  return 0;
 | 
						||
}
 | 
						||
#endif
 |