summarylogtreecommitdiffstats
path: root/mozc.patch
blob: 421a75e83d281e5aaefc32c18b091cb3be56eba8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
--- src.orig/unix/uim/key_translator.h
+++ src/unix/uim/key_translator.h
@@ -38,8 +38,13 @@
 using __gnu_cxx::hash_map;
 
 #include "base/port.h"
+#include "base/vlog.h"
 #include "protocol/commands.pb.h"
 
+using std::string;
+typedef uint64_t uint64;
+typedef int32_t int32;
+
 namespace mozc {
 namespace uim {
 
@@ -49,6 +54,8 @@
 class KeyTranslator {
  public:
   KeyTranslator();
+  KeyTranslator(const KeyTranslator&) = delete;
+  KeyTranslator& operator=(const KeyTranslator&) = delete;
   virtual ~KeyTranslator();
 
   // Converts ibus keycode to Mozc key code and stores them on |out_event|.
@@ -101,8 +108,6 @@
   // 'Hiragana Letter Small U' (with Shift modifier).
   KanaMap kana_map_jp_;  // mapping for JP keyboard.
   KanaMap kana_map_us_;  // mapping for US keyboard.
-
-  DISALLOW_COPY_AND_ASSIGN(KeyTranslator);
 };
 
 }  // namespace uim
--- src.orig/unix/uim/key_translator.cc
+++ src/unix/uim/key_translator.cc
@@ -32,7 +32,9 @@
 
 #include <uim.h>
 
-#include "base/logging.h"
+#include "absl/log/log.h"
+#include "absl/log/check.h"
+#include "base/log_file.h"
 
 namespace {
 
@@ -344,7 +346,7 @@
     /* regards yen key as backslash */
     out_event->set_key_code('\\');
   } else {
-    VLOG(1) << "Unknown keyval: " << keyval;
+    MOZC_VLOG(1) << "Unknown keyval: " << keyval;
     return false;
   }
 
@@ -367,28 +369,28 @@
 }
 
 void KeyTranslator::Init() {
-  for (int i = 0; i < arraysize(special_key_map); ++i) {
+  for (int i = 0; i < std::size(special_key_map); ++i) {
     CHECK(special_key_map_.insert(
         std::make_pair(special_key_map[i].from,
                        special_key_map[i].to)).second);
   }
-  for (int i = 0; i < arraysize(modifier_key_map); ++i) {
+  for (int i = 0; i < std::size(modifier_key_map); ++i) {
     CHECK(modifier_key_map_.insert(
         std::make_pair(modifier_key_map[i].from,
                        modifier_key_map[i].to)).second);
   }
-  for (int i = 0; i < arraysize(modifier_mask_map); ++i) {
+  for (int i = 0; i < std::size(modifier_mask_map); ++i) {
     CHECK(modifier_mask_map_.insert(
         std::make_pair(modifier_mask_map[i].from,
                        modifier_mask_map[i].to)).second);
   }
-  for (int i = 0; i < arraysize(kana_map_jp); ++i) {
+  for (int i = 0; i < std::size(kana_map_jp); ++i) {
     CHECK(kana_map_jp_.insert(
         std::make_pair(kana_map_jp[i].code,
                        std::make_pair(kana_map_jp[i].no_shift,    
                                       kana_map_jp[i].shift))).second);
   }
-  for (int i = 0; i < arraysize(kana_map_us); ++i) {
+  for (int i = 0; i < std::size(kana_map_us); ++i) {
     CHECK(kana_map_us_.insert(
         std::make_pair(kana_map_us[i].code,
                        std::make_pair(kana_map_us[i].no_shift,
--- src.orig/unix/uim/mozc.cc
+++ src/unix/uim/mozc.cc
@@ -280,14 +280,14 @@
 {
   commands::Output *output = context_slot[id].output;
 
-  if (!output->has_candidates()) {
+  if (!output->has_candidate_window()) {
     uim_scm_callf("im-deactivate-candidate-selector", "o", mc_);
     context_slot[id].cand_nr_before = 0;
 
     return;
   }
 
-  const commands::Candidates &candidates = output->candidates();
+  const commands::CandidateWindow &candidates = output->candidate_window();
   bool first_time = false;
   bool has_focused_index = candidates.has_focused_index();
   int current_page = has_focused_index ? candidates.focused_index() / 9 : 0;
@@ -568,7 +568,7 @@
   int id = C_INT(id_);
   commands::Output *output = context_slot[id].output;
 
-  return MAKE_INT(output->candidates().size());
+  return MAKE_INT(output->candidate_window().size());
 }
 
 static uim_lisp
@@ -576,7 +576,7 @@
 {
   int id = C_INT(id_);
   commands::Output *output = context_slot[id].output;
-  const commands::Candidates &candidates = output->candidates();
+  const commands::CandidateWindow &candidates = output->candidate_window();
   const char *cand, *prefix, *suffix;
   char *s;
 
@@ -612,7 +612,7 @@
 {
   int id = C_INT(id_);
   commands::Output *output = context_slot[id].output;
-  const commands::Candidates &candidates = output->candidates();
+  const commands::CandidateWindow &candidates = output->candidate_window();
   const char *label;
 
   int nth;
@@ -641,7 +641,7 @@
 {
   int id = C_INT(id_);
   commands::Output *output = context_slot[id].output;
-  const commands::Candidates &candidates = output->candidates();
+  const commands::CandidateWindow &candidates = output->candidate_window();
   const char *annotation;
 
   int nth;
@@ -1032,7 +1032,7 @@
 #if USE_CASCADING_CANDIDATES
   if (idx >= context_slot[id].unique_candidate_ids->size())
 #else
-  if (idx >= context_slot[id].output->candidates().candidate_size())
+  if (idx >= context_slot[id].output->candidate_window().candidate_size())
 #endif
     return uim_scm_f();
 
@@ -1041,7 +1041,7 @@
   if (cand_id == kBadCandidateId)
     return uim_scm_f();
 #else
-  const int32 cand_id = context_slot[id].output->candidates().candidate(idx).id();
+  const int32 cand_id = context_slot[id].output->candidate_window().candidate(idx).id();
 #endif
 
   commands::SessionCommand command;