95
96
my_strntoll(res->charset(), res->ptr(), res->length(), 10, NULL,
102
String *Item_func_md5::val_str(String *str)
105
String * sptr= args[0]->val_str(str);
106
str->set_charset(&my_charset_bin);
113
my_MD5Init (&context);
114
my_MD5Update (&context,(uchar *) sptr->ptr(), sptr->length());
115
my_MD5Final (digest, &context);
116
if (str->alloc(32)) // Ensure that memory is free
121
sprintf((char *) str->ptr(),
122
"%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x",
123
digest[0], digest[1], digest[2], digest[3],
124
digest[4], digest[5], digest[6], digest[7],
125
digest[8], digest[9], digest[10], digest[11],
126
digest[12], digest[13], digest[14], digest[15]);
127
str->length((uint) 32);
135
void Item_func_md5::fix_length_and_dec()
139
The MD5() function treats its parameter as being a case sensitive. Thus
140
we set binary collation on it so different instances of MD5() will be
143
args[0]->collation.set(
144
get_charset_by_csname(args[0]->collation.collation->csname,
145
MY_CS_BINSORT,MYF(0)), DERIVATION_COERCIBLE);
344
392
now work in place in tmp_value to set it to res | sep_str | res2
346
394
/* Chop the last characters in tmp_value that isn't in res2 */
347
tmp_value.length((uint32_t) (res2->ptr() - tmp_value.ptr()) +
395
tmp_value.length((uint32) (res2->ptr() - tmp_value.ptr()) +
349
397
/* Place res2 at start of tmp_value, remove chars before res2 */
350
if (tmp_value.replace(0,(uint32_t) (res2->ptr() - tmp_value.ptr()),
398
if (tmp_value.replace(0,(uint32) (res2->ptr() - tmp_value.ptr()),
352
400
tmp_value.replace(res->length(),0, *sep_str))
654
702
if (length > res->length() - start)
655
703
length= res->length() - start;
657
if ((uint64_t) (res->length() - length + res2->length()) >
658
(uint64_t) current_thd->variables.max_allowed_packet)
705
if ((ulonglong) (res->length() - length + res2->length()) >
706
(ulonglong) current_thd->variables.max_allowed_packet)
660
push_warning_printf(current_thd, DRIZZLE_ERROR::WARN_LEVEL_WARN,
708
push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
661
709
ER_WARN_ALLOWED_PACKET_OVERFLOWED,
662
710
ER(ER_WARN_ALLOWED_PACKET_OVERFLOWED),
663
711
func_name(), current_thd->variables.max_allowed_packet);
666
714
res=copy_if_not_alloced(str,res,res->length());
667
res->replace((uint32_t) start,(uint32_t) length,*res2);
715
res->replace((uint32) start,(uint32) length,*res2);
675
723
void Item_func_insert::fix_length_and_dec()
677
uint64_t max_result_length;
725
ulonglong max_result_length;
679
727
// Handle character set for args[0] and args[3].
680
728
if (agg_arg_charsets(collation, &args[0], 2, MY_COLL_ALLOW_CONV, 3))
682
max_result_length= ((uint64_t) args[0]->max_length+
683
(uint64_t) args[3]->max_length);
730
max_result_length= ((ulonglong) args[0]->max_length+
731
(ulonglong) args[3]->max_length);
684
732
if (max_result_length >= MAX_BLOB_WIDTH)
686
734
max_result_length= MAX_BLOB_WIDTH;
824
872
assert(fixed == 1);
825
873
String *res = args[0]->val_str(str);
826
/* must be int64_t to avoid truncation */
827
int64_t start= args[1]->val_int();
828
/* Assumes that the maximum length of a String is < INT32_MAX. */
874
/* must be longlong to avoid truncation */
875
longlong start= args[1]->val_int();
876
/* Assumes that the maximum length of a String is < INT_MAX32. */
829
877
/* Limit so that code sees out-of-bound value properly. */
830
int64_t length= arg_count == 3 ? args[2]->val_int() : INT32_MAX;
878
longlong length= arg_count == 3 ? args[2]->val_int() : INT_MAX32;
833
881
if ((null_value=(args[0]->null_value || args[1]->null_value ||
834
882
(arg_count == 3 && args[2]->null_value))))
839
887
(length == 0 || !args[2]->unsigned_flag))
840
888
return &my_empty_string;
842
/* Assumes that the maximum length of a String is < INT32_MAX. */
890
/* Assumes that the maximum length of a String is < INT_MAX32. */
843
891
/* Set here so that rest of code sees out-of-bound value as such. */
844
if ((length <= 0) || (length > INT32_MAX))
892
if ((length <= 0) || (length > INT_MAX32))
847
895
/* if "unsigned_flag" is set, we have a *huge* positive number. */
848
/* Assumes that the maximum length of a String is < INT32_MAX. */
849
if ((!args[1]->unsigned_flag && (start < INT32_MIN || start > INT32_MAX)) ||
850
(args[1]->unsigned_flag && ((uint64_t) start > INT32_MAX)))
896
/* Assumes that the maximum length of a String is < INT_MAX32. */
897
if ((!args[1]->unsigned_flag && (start < INT_MIN32 || start > INT_MAX32)) ||
898
(args[1]->unsigned_flag && ((ulonglong) start > INT_MAX32)))
851
899
return &my_empty_string;
853
901
start= ((start < 0) ? res->numchars() + start : start - 1);
855
903
if ((start < 0) || ((uint) start + 1 > res->length()))
856
904
return &my_empty_string;
858
length= res->charpos((int) length, (uint32_t) start);
906
length= res->charpos((int) length, (uint32) start);
859
907
tmp_length= res->length() - start;
860
length= cmin(length, tmp_length);
908
length= min(length, tmp_length);
862
if (!start && (int64_t) res->length() == length)
910
if (!start && (longlong) res->length() == length)
864
tmp_value.set(*res, (uint32_t) start, (uint32_t) length);
912
tmp_value.set(*res, (uint32) start, (uint32) length);
865
913
return &tmp_value;
873
921
collation.set(args[0]->collation);
874
922
if (args[1]->const_item())
876
int32_t start= (int32_t) args[1]->val_int();
924
int32 start= (int32) args[1]->val_int();
878
926
max_length= ((uint)(-start) > max_length) ? 0 : (uint)(-start);
880
max_length-= cmin((uint)(start - 1), max_length);
928
max_length-= min((uint)(start - 1), max_length);
882
930
if (arg_count == 3 && args[2]->const_item())
884
int32_t length= (int32_t) args[2]->val_int();
932
int32 length= (int32) args[2]->val_int();
886
934
max_length=0; /* purecov: inspected */
1256
Item *Item_func_sysconst::safe_charset_converter(const CHARSET_INFO * const tocs)
1304
/* Item_func_password */
1306
String *Item_func_password::val_str(String *str)
1309
String *res= args[0]->val_str(str);
1310
if ((null_value=args[0]->null_value))
1312
if (res->length() == 0)
1313
return &my_empty_string;
1314
make_scrambled_password(tmp_value, res->c_ptr());
1315
str->set(tmp_value, SCRAMBLED_PASSWORD_CHAR_LENGTH, res->charset());
1319
char *Item_func_password::alloc(THD *thd, const char *password)
1321
char *buff= (char *) thd->alloc(SCRAMBLED_PASSWORD_CHAR_LENGTH+1);
1323
make_scrambled_password(buff, password);
1327
#define bin_to_ascii(c) ((c)>=38?((c)-38+'a'):(c)>=12?((c)-12+'A'):(c)+'.')
1329
String *Item_func_encrypt::val_str(String *str)
1332
String *res =args[0]->val_str(str);
1335
char salt[3],*salt_ptr;
1336
if ((null_value=args[0]->null_value))
1338
if (res->length() == 0)
1339
return &my_empty_string;
1342
{ // generate random salt
1343
time_t timestamp=current_thd->query_start();
1344
salt[0] = bin_to_ascii( (ulong) timestamp & 0x3f);
1345
salt[1] = bin_to_ascii(( (ulong) timestamp >> 5) & 0x3f);
1350
{ // obtain salt from the first two bytes
1351
String *salt_str=args[1]->val_str(&tmp_value);
1352
if ((null_value= (args[1]->null_value || salt_str->length() < 2)))
1354
salt_ptr= salt_str->c_ptr();
1356
pthread_mutex_lock(&LOCK_crypt);
1357
char *tmp= crypt(res->c_ptr(),salt_ptr);
1360
pthread_mutex_unlock(&LOCK_crypt);
1364
str->set(tmp, (uint) strlen(tmp), &my_charset_bin);
1366
pthread_mutex_unlock(&LOCK_crypt);
1371
#endif /* HAVE_CRYPT */
1374
void Item_func_encode::fix_length_and_dec()
1376
max_length=args[0]->max_length;
1377
maybe_null=args[0]->maybe_null || args[1]->maybe_null;
1378
collation.set(&my_charset_bin);
1381
String *Item_func_encode::val_str(String *str)
1385
String tmp_pw_value(pw_buff, sizeof(pw_buff), system_charset_info);
1389
if (!(res=args[0]->val_str(str)))
1391
null_value=1; /* purecov: inspected */
1392
return 0; /* purecov: inspected */
1395
if (!(password=args[1]->val_str(& tmp_pw_value)))
1402
res=copy_if_not_alloced(str,res,res->length());
1403
SQL_CRYPT sql_crypt(password->ptr());
1405
sql_crypt.encode((char*) res->ptr(),res->length());
1406
res->set_charset(&my_charset_bin);
1410
String *Item_func_decode::val_str(String *str)
1414
String tmp_pw_value(pw_buff, sizeof(pw_buff), system_charset_info);
1418
if (!(res=args[0]->val_str(str)))
1420
null_value=1; /* purecov: inspected */
1421
return 0; /* purecov: inspected */
1424
if (!(password=args[1]->val_str(& tmp_pw_value)))
1431
res=copy_if_not_alloced(str,res,res->length());
1432
SQL_CRYPT sql_crypt(password->ptr());
1434
sql_crypt.decode((char*) res->ptr(),res->length());
1439
Item *Item_func_sysconst::safe_charset_converter(CHARSET_INFO *tocs)
1258
1441
Item_string *conv;
1259
uint32_t conv_errors;
1260
1443
String tmp, cstr, *ostr= val_str(&tmp);
1261
1444
cstr.copy(ostr->ptr(), ostr->length(), ostr->charset(), tocs, &conv_errors);
1262
1445
if (conv_errors ||
1404
1587
double nr= args[0]->val_real();
1405
1588
if ((null_value=args[0]->null_value))
1406
1589
return 0; /* purecov: inspected */
1407
nr= my_double_round(nr, (int64_t) dec, false, false);
1590
nr= my_double_round(nr, (longlong) dec, false, false);
1408
1591
/* Here default_charset() is right as this is not an automatic conversion */
1409
1592
str->set_real(nr, dec, default_charset());
1412
1595
str_length=str->length();
1682
1865
collation.set(args[0]->collation);
1683
1866
if (args[1]->const_item())
1685
/* must be int64_t to avoid truncation */
1686
int64_t count= args[1]->val_int();
1868
/* must be longlong to avoid truncation */
1869
longlong count= args[1]->val_int();
1688
/* Assumes that the maximum length of a String is < INT32_MAX. */
1871
/* Assumes that the maximum length of a String is < INT_MAX32. */
1689
1872
/* Set here so that rest of code sees out-of-bound value as such. */
1690
if (count > INT32_MAX)
1873
if (count > INT_MAX32)
1693
uint64_t max_result_length= (uint64_t) args[0]->max_length * count;
1876
ulonglong max_result_length= (ulonglong) args[0]->max_length * count;
1694
1877
if (max_result_length >= MAX_BLOB_WIDTH)
1696
1879
max_result_length= MAX_BLOB_WIDTH;
1726
1909
if (count <= 0 && (count == 0 || !args[1]->unsigned_flag))
1727
1910
return &my_empty_string;
1729
/* Assumes that the maximum length of a String is < INT32_MAX. */
1912
/* Assumes that the maximum length of a String is < INT_MAX32. */
1730
1913
/* Bounds check on count: If this is triggered, we will error. */
1731
if ((uint64_t) count > INT32_MAX)
1914
if ((ulonglong) count > INT_MAX32)
1733
1916
if (count == 1) // To avoid reallocs
1735
1918
length=res->length();
1736
1919
// Safe length check
1737
1920
if (length > current_thd->variables.max_allowed_packet / (uint) count)
1739
push_warning_printf(current_thd, DRIZZLE_ERROR::WARN_LEVEL_WARN,
1922
push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
1740
1923
ER_WARN_ALLOWED_PACKET_OVERFLOWED,
1741
1924
ER(ER_WARN_ALLOWED_PACKET_OVERFLOWED),
1742
1925
func_name(), current_thd->variables.max_allowed_packet);
1799
1982
String *Item_func_rpad::val_str(String *str)
1801
1984
assert(fixed == 1);
1802
uint32_t res_byte_length,res_char_length,pad_char_length,pad_byte_length;
1985
uint32 res_byte_length,res_char_length,pad_char_length,pad_byte_length;
1804
1987
const char *ptr_pad;
1805
/* must be int64_t to avoid truncation */
1806
int64_t count= args[1]->val_int();
1988
/* must be longlong to avoid truncation */
1989
longlong count= args[1]->val_int();
1990
longlong byte_count;
1808
1991
String *res= args[0]->val_str(str);
1809
1992
String *rpad= args[2]->val_str(&rpad_str);
1824
2007
pad_char_length= rpad->numchars();
1826
2009
byte_count= count * collation.collation->mbmaxlen;
1827
if ((uint64_t) byte_count > current_thd->variables.max_allowed_packet)
2010
if ((ulonglong) byte_count > current_thd->variables.max_allowed_packet)
1829
push_warning_printf(current_thd, DRIZZLE_ERROR::WARN_LEVEL_WARN,
2012
push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
1830
2013
ER_WARN_ALLOWED_PACKET_OVERFLOWED,
1831
2014
ER(ER_WARN_ALLOWED_PACKET_OVERFLOWED),
1832
2015
func_name(), current_thd->variables.max_allowed_packet);
1929
2112
pad_char_length= pad->numchars();
1930
2113
byte_count= count * collation.collation->mbmaxlen;
1932
if ((uint64_t) byte_count > current_thd->variables.max_allowed_packet)
2115
if ((ulonglong) byte_count > current_thd->variables.max_allowed_packet)
1934
push_warning_printf(current_thd, DRIZZLE_ERROR::WARN_LEVEL_WARN,
2117
push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
1935
2118
ER_WARN_ALLOWED_PACKET_OVERFLOWED,
1936
2119
ER(ER_WARN_ALLOWED_PACKET_OVERFLOWED),
1937
2120
func_name(), current_thd->variables.max_allowed_packet);
1987
2170
dec= my_strntoll(res->charset(), res->ptr(), res->length(),
1988
2171
-from_base, &endptr, &err);
1990
dec= (int64_t) my_strntoull(res->charset(), res->ptr(), res->length(),
2173
dec= (longlong) my_strntoull(res->charset(), res->ptr(), res->length(),
1991
2174
from_base, &endptr, &err);
1993
ptr= int64_t2str(dec, ans, to_base);
1994
if (str->copy(ans, (uint32_t) (ptr-ans), default_charset()))
2176
ptr= longlong2str(dec, ans, to_base);
2177
if (str->copy(ans, (uint32) (ptr-ans), default_charset()))
1995
2178
return &my_empty_string;
2105
2288
String *Item_func_charset::val_str(String *str)
2107
2290
assert(fixed == 1);
2108
uint32_t dummy_errors;
2110
const CHARSET_INFO * const cs= args[0]->collation.collation;
2293
CHARSET_INFO *cs= args[0]->collation.collation;
2112
2295
str->copy(cs->csname, strlen(cs->csname),
2113
&my_charset_utf8_general_ci, collation.collation, &dummy_errors);
2296
&my_charset_latin1, collation.collation, &dummy_errors);
2117
2300
String *Item_func_collation::val_str(String *str)
2119
2302
assert(fixed == 1);
2120
uint32_t dummy_errors;
2121
const CHARSET_INFO * const cs= args[0]->collation.collation;
2304
CHARSET_INFO *cs= args[0]->collation.collation;
2124
2307
str->copy(cs->name, strlen(cs->name),
2125
&my_charset_utf8_general_ci, collation.collation, &dummy_errors);
2308
&my_charset_latin1, collation.collation, &dummy_errors);
2130
2313
void Item_func_weight_string::fix_length_and_dec()
2132
const CHARSET_INFO * const cs= args[0]->collation.collation;
2315
CHARSET_INFO *cs= args[0]->collation.collation;
2133
2316
collation.set(&my_charset_bin, args[0]->collation.derivation);
2134
2317
flags= my_strxfrm_flag_normalize(flags, cs->levels_for_order);
2135
max_length= cs->mbmaxlen * cmax(args[0]->max_length, nweights);
2318
max_length= cs->mbmaxlen * max(args[0]->max_length, nweights);
2152
2335
tmp_length= cs->coll->strnxfrmlen(cs, cs->mbmaxlen *
2153
cmax(res->length(), nweights));
2336
max(res->length(), nweights));
2155
2338
if (tmp_value.alloc(tmp_length))
2158
2341
frm_length= cs->coll->strnxfrm(cs,
2159
(unsigned char*) tmp_value.ptr(), tmp_length,
2342
(uchar*) tmp_value.ptr(), tmp_length,
2160
2343
nweights ? nweights : tmp_length,
2161
(const unsigned char*) res->ptr(), res->length(),
2344
(const uchar*) res->ptr(), res->length(),
2163
2346
tmp_value.length(frm_length);
2176
2359
assert(fixed == 1);
2177
2360
if (args[0]->result_type() != STRING_RESULT)
2180
2363
char ans[65],*ptr;
2181
/* Return hex of unsigned int64_t value */
2364
/* Return hex of unsigned longlong value */
2182
2365
if (args[0]->result_type() == REAL_RESULT ||
2183
2366
args[0]->result_type() == DECIMAL_RESULT)
2185
2368
double val= args[0]->val_real();
2186
if ((val <= (double) INT64_MIN) ||
2187
(val >= (double) (uint64_t) UINT64_MAX))
2369
if ((val <= (double) LONGLONG_MIN) ||
2370
(val >= (double) (ulonglong) ULONGLONG_MAX))
2190
dec= (uint64_t) (val + (val > 0 ? 0.5 : -0.5));
2373
dec= (ulonglong) (val + (val > 0 ? 0.5 : -0.5));
2193
dec= (uint64_t) args[0]->val_int();
2376
dec= (ulonglong) args[0]->val_int();
2195
2378
if ((null_value= args[0]->null_value))
2197
ptr= int64_t2str(dec,ans,16);
2198
if (str->copy(ans,(uint32_t) (ptr-ans),default_charset()))
2380
ptr= longlong2str(dec,ans,16);
2381
if (str->copy(ans,(uint32) (ptr-ans),default_charset()))
2199
2382
return &my_empty_string; // End of memory
2390
2575
void Item_func_export_set::fix_length_and_dec()
2392
uint32_t length=cmax(args[1]->max_length,args[2]->max_length);
2393
uint32_t sep_length=(arg_count > 3 ? args[3]->max_length : 1);
2577
uint length=max(args[1]->max_length,args[2]->max_length);
2578
uint sep_length=(arg_count > 3 ? args[3]->max_length : 1);
2394
2579
max_length=length*64+sep_length*63;
2396
if (agg_arg_charsets(collation, args+1, cmin((uint)4,arg_count)-1,
2581
if (agg_arg_charsets(collation, args+1, min(4,arg_count)-1,
2397
2582
MY_COLL_ALLOW_CONV, 1))
2431
static unsigned char escmask[32]=
2616
static uchar escmask[32]=
2433
2618
0x01, 0x00, 0x00, 0x04, 0x80, 0x00, 0x00, 0x00,
2434
2619
0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00,
2685
longlong Item_func_uncompressed_length::val_int()
2688
String *res= args[0]->val_str(&value);
2692
return 0; /* purecov: inspected */
2695
if (res->is_empty()) return 0;
2698
res->ptr() using is safe because we have tested that string is not empty,
2699
res->c_ptr() is not used because:
2700
- we do not need \0 terminated string to get first 4 bytes
2701
- c_ptr() tests simbol after string end (uninitialiozed memory) which
2704
return uint4korr(res->ptr()) & 0x3FFFFFFF;
2707
longlong Item_func_crc32::val_int()
2710
String *res=args[0]->val_str(&value);
2714
return 0; /* purecov: inspected */
2717
return (longlong) crc32(0L, (uchar*)res->ptr(), res->length());
2720
#ifdef HAVE_COMPRESS
2723
String *Item_func_compress::val_str(String *str)
2725
int err= Z_OK, code;
2729
char *tmp, *last_char;
2732
if (!(res= args[0]->val_str(str)))
2738
if (res->is_empty()) return res;
2741
Citation from zlib.h (comment for compress function):
2743
Compresses the source buffer into the destination buffer. sourceLen is
2744
the byte length of the source buffer. Upon entry, destLen is the total
2745
size of the destination buffer, which must be at least 0.1% larger than
2746
sourceLen plus 12 bytes.
2747
We assume here that the buffer can't grow more than .25 %.
2749
new_size= res->length() + res->length() / 5 + 12;
2751
// Check new_size overflow: new_size <= res->length()
2752
if (((uint32) (new_size+5) <= res->length()) ||
2753
buffer.realloc((uint32) new_size + 4 + 1))
2759
body= ((Byte*)buffer.ptr()) + 4;
2761
// As far as we have checked res->is_empty() we can use ptr()
2762
if ((err= compress(body, &new_size,
2763
(const Bytef*)res->ptr(), res->length())) != Z_OK)
2765
code= err==Z_MEM_ERROR ? ER_ZLIB_Z_MEM_ERROR : ER_ZLIB_Z_BUF_ERROR;
2766
push_warning(current_thd,MYSQL_ERROR::WARN_LEVEL_ERROR,code,ER(code));
2771
tmp= (char*)buffer.ptr(); // int4store is a macro; avoid side effects
2772
int4store(tmp, res->length() & 0x3FFFFFFF);
2774
/* This is to ensure that things works for CHAR fields, which trim ' ': */
2775
last_char= ((char*)body)+new_size-1;
2776
if (*last_char == ' ')
2782
buffer.length((uint32)new_size + 4);
2787
String *Item_func_uncompress::val_str(String *str)
2790
String *res= args[0]->val_str(str);
2798
if (res->is_empty())
2801
/* If length is less than 4 bytes, data is corrupt */
2802
if (res->length() <= 4)
2804
push_warning_printf(current_thd,MYSQL_ERROR::WARN_LEVEL_ERROR,
2805
ER_ZLIB_Z_DATA_ERROR,
2806
ER(ER_ZLIB_Z_DATA_ERROR));
2810
/* Size of uncompressed data is stored as first 4 bytes of field */
2811
new_size= uint4korr(res->ptr()) & 0x3FFFFFFF;
2812
if (new_size > current_thd->variables.max_allowed_packet)
2814
push_warning_printf(current_thd,MYSQL_ERROR::WARN_LEVEL_ERROR,
2815
ER_TOO_BIG_FOR_UNCOMPRESS,
2816
ER(ER_TOO_BIG_FOR_UNCOMPRESS),
2817
current_thd->variables.max_allowed_packet);
2820
if (buffer.realloc((uint32)new_size))
2823
if ((err= uncompress((Byte*)buffer.ptr(), &new_size,
2824
((const Bytef*)res->ptr())+4,res->length())) == Z_OK)
2826
buffer.length((uint32) new_size);
2830
code= ((err == Z_BUF_ERROR) ? ER_ZLIB_Z_BUF_ERROR :
2831
((err == Z_MEM_ERROR) ? ER_ZLIB_Z_MEM_ERROR : ER_ZLIB_Z_DATA_ERROR));
2832
push_warning(current_thd,MYSQL_ERROR::WARN_LEVEL_ERROR,code,ER(code));
2502
2842
DCE 1.1: Remote Procedure Call,
2508
2848
static struct rand_struct uuid_rand;
2509
static uint32_t nanoseq;
2510
static uint64_t uuid_time=0;
2849
static uint nanoseq;
2850
static ulonglong uuid_time=0;
2511
2851
static char clock_seq_and_node_str[]="-0000-000000000000";
2514
2854
number of 100-nanosecond intervals between
2515
2855
1582-10-15 00:00:00.00 and 1970-01-01 00:00:00.00.
2517
#define UUID_TIME_OFFSET ((uint64_t) 141427 * 24 * 60 * 60 * 1000 * 10 )
2857
#define UUID_TIME_OFFSET ((ulonglong) 141427 * 24 * 60 * 60 * 1000 * 10 )
2519
2859
#define UUID_VERSION 0x1000
2520
2860
#define UUID_VARIANT 0x8000
2522
static void tohex(char *to, uint32_t from, uint32_t len)
2862
static void tohex(char *to, uint from, uint len)