Move SystemUtil::IsLittleEndian to Util
This CL removes the dependency on system_util from some build tools.
BUG=
TEST=
REF_BUG=31945229
REF_CL=136122387
REF_TIME=2016-10-14T13:24:52+09:00
REF_TIME_RAW=1476419092 +0900
Noriyuki Takahashi
7 years ago
33 | 33 |
#include "base/file_stream.h"
|
34 | 34 |
#include "base/logging.h"
|
35 | 35 |
#include "base/port.h"
|
36 | |
#include "base/system_util.h"
|
|
36 |
#include "base/util.h"
|
37 | 37 |
|
38 | 38 |
namespace mozc {
|
39 | 39 |
namespace {
|
|
43 | 43 |
} // namespace
|
44 | 44 |
|
45 | 45 |
SerializedStringArray::SerializedStringArray() {
|
46 | |
DCHECK(SystemUtil::IsLittleEndian()) << "Little endian is assumed";
|
|
46 |
DCHECK(Util::IsLittleEndian()) << "Little endian is assumed";
|
47 | 47 |
clear();
|
48 | 48 |
}
|
49 | 49 |
|
864 | 864 |
#endif // OS_WIN, OS_MACOSX, OS_LINUX
|
865 | 865 |
}
|
866 | 866 |
|
867 | |
bool SystemUtil::IsLittleEndian() {
|
868 | |
#ifndef OS_WIN
|
869 | |
union {
|
870 | |
unsigned char c[4];
|
871 | |
unsigned int i;
|
872 | |
} u;
|
873 | |
static_assert(sizeof(u.c) == sizeof(u.i),
|
874 | |
"Expecting (unsigned) int is 32-bit integer.");
|
875 | |
static_assert(sizeof(u) == sizeof(u.i),
|
876 | |
"Checking alignment.");
|
877 | |
u.i = 0x12345678U;
|
878 | |
return u.c[0] == 0x78U;
|
879 | |
#else // OS_WIN
|
880 | |
return true;
|
881 | |
#endif // OS_WIN
|
882 | |
}
|
883 | |
|
884 | 867 |
} // namespace mozc
|
166 | 166 |
// retrieve total physical memory. returns 0 if any error occurs.
|
167 | 167 |
static uint64 GetTotalPhysicalMemory();
|
168 | 168 |
|
169 | |
// check endian-ness at runtime.
|
170 | |
static bool IsLittleEndian();
|
171 | |
|
172 | 169 |
private:
|
173 | 170 |
DISALLOW_IMPLICIT_CONSTRUCTORS(SystemUtil);
|
174 | 171 |
};
|
459 | 459 |
// length of s is not eight or s is in an invalid format.
|
460 | 460 |
static bool DeserializeUint64(StringPiece s, uint64 *x);
|
461 | 461 |
|
|
462 |
// Checks endian-ness at runtime.
|
|
463 |
static bool IsLittleEndian();
|
|
464 |
|
462 | 465 |
private:
|
463 | 466 |
DISALLOW_IMPLICIT_CONSTRUCTORS(Util);
|
464 | 467 |
};
|
41 | 41 |
#include "base/file_stream.h"
|
42 | 42 |
#include "base/logging.h"
|
43 | 43 |
#include "base/port.h"
|
44 | |
#include "base/system_util.h"
|
|
44 |
#include "base/util.h"
|
45 | 45 |
#include "protocol/segmenter_data.pb.h"
|
46 | 46 |
|
47 | 47 |
namespace mozc {
|
|
188 | 188 |
CHECK(barray.array());
|
189 | 189 |
CHECK_GT(barray.size(), 0);
|
190 | 190 |
|
191 | |
CHECK(SystemUtil::IsLittleEndian())
|
|
191 |
CHECK(Util::IsLittleEndian())
|
192 | 192 |
<< "Architecture must be little endian";
|
193 | 193 |
{
|
194 | 194 |
mozc::converter::SegmenterDataSizeInfo pb;
|
29 | 29 |
|
30 | 30 |
MAJOR=2
|
31 | 31 |
MINOR=19
|
32 | |
BUILD=2640
|
|
32 |
BUILD=2641
|
33 | 33 |
REVISION=102
|
34 | 34 |
# This version represents the version of Mozc IME engine (converter, predictor,
|
35 | 35 |
# etc.). This version info is included both in the Mozc server and in the Mozc
|
42 | 42 |
#include "base/port.h"
|
43 | 43 |
#include "base/serialized_string_array.h"
|
44 | 44 |
#include "base/string_piece.h"
|
45 | |
#include "base/system_util.h"
|
46 | 45 |
#include "base/util.h"
|
47 | 46 |
|
48 | 47 |
namespace mozc {
|
|
113 | 112 |
const std::map<string, TokenList> &dic,
|
114 | 113 |
std::unique_ptr<uint32[]> *output_token_array_buf,
|
115 | 114 |
std::unique_ptr<uint32[]> *output_string_array_buf) {
|
116 | |
CHECK(SystemUtil::IsLittleEndian());
|
|
115 |
CHECK(Util::IsLittleEndian());
|
117 | 116 |
|
118 | 117 |
// Build a mapping from string to its index in a serialized string array.
|
119 | 118 |
// Note that duplicate keys share the same index, so data is slightly
|
103 | 103 |
#include "base/init_mozc.h"
|
104 | 104 |
#include "base/logging.h"
|
105 | 105 |
#include "base/serialized_string_array.h"
|
106 | |
#include "base/system_util.h"
|
107 | 106 |
#include "base/util.h"
|
108 | 107 |
|
109 | 108 |
DEFINE_string(usage_data_file, "", "usage data file");
|
|
248 | 247 |
}
|
249 | 248 |
|
250 | 249 |
void Convert() {
|
251 | |
CHECK(SystemUtil::IsLittleEndian());
|
|
250 |
CHECK(Util::IsLittleEndian());
|
252 | 251 |
|
253 | 252 |
// Load cforms_file
|
254 | 253 |
std::map<string, std::vector<ConjugationType>> inflection_map;
|
44 | 44 |
#include "base/run_level.h"
|
45 | 45 |
#include "base/singleton.h"
|
46 | 46 |
#include "base/system_util.h"
|
|
47 |
#include "base/util.h"
|
47 | 48 |
#include "config/stats_config_util.h"
|
48 | 49 |
#include "session/session_server.h"
|
49 | 50 |
|
|
65 | 66 |
// Big endian is not supported. The storage for user history is endian
|
66 | 67 |
// dependent. If we want to sync the data via network sync feature, we
|
67 | 68 |
// will see some problems.
|
68 | |
CHECK(mozc::SystemUtil::IsLittleEndian()) << "Big endian is not supported.";
|
|
69 |
CHECK(mozc::Util::IsLittleEndian()) << "Big endian is not supported.";
|
69 | 70 |
#ifdef OS_WIN
|
70 | 71 |
// http://msdn.microsoft.com/en-us/library/ms686227.aspx
|
71 | 72 |
// Make sure that mozc_server exits all after other processes.
|