summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar River City Ransomware2018-01-19 18:01:41 -0500
committerGravatar bunnei2018-01-19 18:01:41 -0500
commitdd62f125c359b37d71be6ccf873177c1a108d015 (patch)
tree0d543402a25f4ba701dc547808b289daa0fc325b
parentMerge pull request #112 from Rozelette/master (diff)
downloadyuzu-dd62f125c359b37d71be6ccf873177c1a108d015.tar.gz
yuzu-dd62f125c359b37d71be6ccf873177c1a108d015.tar.xz
yuzu-dd62f125c359b37d71be6ccf873177c1a108d015.zip
Fixes some cast warnings, partial port of citra #3064 (#106)
* Fixes some cast warnings, partially fixes citra #3064 * Converted casts to uint32_t to u32 * Ran clang-format
Diffstat (limited to '')
-rw-r--r--src/core/arm/dynarmic/arm_dynarmic.cpp6
-rw-r--r--src/core/core_timing.cpp4
-rw-r--r--src/core/gdbstub/gdbstub.cpp27
-rw-r--r--src/core/hle/kernel/condition_variable.cpp2
-rw-r--r--src/core/hle/kernel/hle_ipc.cpp2
-rw-r--r--src/core/hle/service/vi/vi.cpp2
6 files changed, 22 insertions, 21 deletions
diff --git a/src/core/arm/dynarmic/arm_dynarmic.cpp b/src/core/arm/dynarmic/arm_dynarmic.cpp
index 2ad48dcc7..72c54f984 100644
--- a/src/core/arm/dynarmic/arm_dynarmic.cpp
+++ b/src/core/arm/dynarmic/arm_dynarmic.cpp
@@ -46,7 +46,7 @@ public:
46 ARM_Interface::ThreadContext ctx; 46 ARM_Interface::ThreadContext ctx;
47 parent.SaveContext(ctx); 47 parent.SaveContext(ctx);
48 parent.inner_unicorn.LoadContext(ctx); 48 parent.inner_unicorn.LoadContext(ctx);
49 parent.inner_unicorn.ExecuteInstructions(num_instructions); 49 parent.inner_unicorn.ExecuteInstructions(static_cast<int>(num_instructions));
50 parent.inner_unicorn.SaveContext(ctx); 50 parent.inner_unicorn.SaveContext(ctx);
51 parent.LoadContext(ctx); 51 parent.LoadContext(ctx);
52 num_interpreted_instructions += num_instructions; 52 num_interpreted_instructions += num_instructions;
@@ -163,9 +163,9 @@ void ARM_Dynarmic::LoadContext(const ARM_Interface::ThreadContext& ctx) {
163 jit.SetRegisters(ctx.cpu_registers); 163 jit.SetRegisters(ctx.cpu_registers);
164 jit.SetSP(ctx.sp); 164 jit.SetSP(ctx.sp);
165 jit.SetPC(ctx.pc); 165 jit.SetPC(ctx.pc);
166 jit.SetPstate(ctx.cpsr); 166 jit.SetPstate(static_cast<u32>(ctx.cpsr));
167 jit.SetVectors(ctx.fpu_registers); 167 jit.SetVectors(ctx.fpu_registers);
168 jit.SetFpcr(ctx.fpscr); 168 jit.SetFpcr(static_cast<u32>(ctx.fpscr));
169 cb->tpidrr0_el0 = ctx.tls_address; 169 cb->tpidrr0_el0 = ctx.tls_address;
170} 170}
171 171
diff --git a/src/core/core_timing.cpp b/src/core/core_timing.cpp
index a0656f0a8..9e1bf2d0e 100644
--- a/src/core/core_timing.cpp
+++ b/src/core/core_timing.cpp
@@ -122,7 +122,7 @@ u64 GetTicks() {
122} 122}
123 123
124void AddTicks(u64 ticks) { 124void AddTicks(u64 ticks) {
125 downcount -= ticks; 125 downcount -= static_cast<int>(ticks);
126} 126}
127 127
128u64 GetIdleTicks() { 128u64 GetIdleTicks() {
@@ -208,7 +208,7 @@ void Advance() {
208 Event evt = std::move(event_queue.front()); 208 Event evt = std::move(event_queue.front());
209 std::pop_heap(event_queue.begin(), event_queue.end(), std::greater<Event>()); 209 std::pop_heap(event_queue.begin(), event_queue.end(), std::greater<Event>());
210 event_queue.pop_back(); 210 event_queue.pop_back();
211 evt.type->callback(evt.userdata, global_timer - evt.time); 211 evt.type->callback(evt.userdata, static_cast<int>(global_timer - evt.time));
212 } 212 }
213 213
214 is_global_timer_sane = false; 214 is_global_timer_sane = false;
diff --git a/src/core/gdbstub/gdbstub.cpp b/src/core/gdbstub/gdbstub.cpp
index 05c872d89..2f3ccb689 100644
--- a/src/core/gdbstub/gdbstub.cpp
+++ b/src/core/gdbstub/gdbstub.cpp
@@ -183,11 +183,11 @@ static u8 NibbleToHex(u8 n) {
183} 183}
184 184
185/** 185/**
186* Converts input hex string characters into an array of equivalent of u8 bytes. 186 * Converts input hex string characters into an array of equivalent of u8 bytes.
187* 187 *
188* @param src Pointer to array of output hex string characters. 188 * @param src Pointer to array of output hex string characters.
189* @param len Length of src array. 189 * @param len Length of src array.
190*/ 190 */
191static u32 HexToInt(const u8* src, size_t len) { 191static u32 HexToInt(const u8* src, size_t len) {
192 u32 output = 0; 192 u32 output = 0;
193 while (len-- > 0) { 193 while (len-- > 0) {
@@ -299,17 +299,17 @@ static std::map<u32, Breakpoint>& GetBreakpointList(BreakpointType type) {
299static void RemoveBreakpoint(BreakpointType type, PAddr addr) { 299static void RemoveBreakpoint(BreakpointType type, PAddr addr) {
300 std::map<u32, Breakpoint>& p = GetBreakpointList(type); 300 std::map<u32, Breakpoint>& p = GetBreakpointList(type);
301 301
302 auto bp = p.find(addr); 302 auto bp = p.find(static_cast<u32>(addr));
303 if (bp != p.end()) { 303 if (bp != p.end()) {
304 LOG_DEBUG(Debug_GDBStub, "gdb: removed a breakpoint: %08x bytes at %08x of type %d\n", 304 LOG_DEBUG(Debug_GDBStub, "gdb: removed a breakpoint: %08x bytes at %08x of type %d\n",
305 bp->second.len, bp->second.addr, type); 305 bp->second.len, bp->second.addr, type);
306 p.erase(addr); 306 p.erase(static_cast<u32>(addr));
307 } 307 }
308} 308}
309 309
310BreakpointAddress GetNextBreakpointFromAddress(PAddr addr, BreakpointType type) { 310BreakpointAddress GetNextBreakpointFromAddress(PAddr addr, BreakpointType type) {
311 std::map<u32, Breakpoint>& p = GetBreakpointList(type); 311 std::map<u32, Breakpoint>& p = GetBreakpointList(type);
312 auto next_breakpoint = p.lower_bound(addr); 312 auto next_breakpoint = p.lower_bound(static_cast<u32>(addr));
313 BreakpointAddress breakpoint; 313 BreakpointAddress breakpoint;
314 314
315 if (next_breakpoint != p.end()) { 315 if (next_breakpoint != p.end()) {
@@ -330,7 +330,7 @@ bool CheckBreakpoint(PAddr addr, BreakpointType type) {
330 330
331 std::map<u32, Breakpoint>& p = GetBreakpointList(type); 331 std::map<u32, Breakpoint>& p = GetBreakpointList(type);
332 332
333 auto bp = p.find(addr); 333 auto bp = p.find(static_cast<u32>(addr));
334 if (bp != p.end()) { 334 if (bp != p.end()) {
335 u32 len = bp->second.len; 335 u32 len = bp->second.len;
336 336
@@ -452,7 +452,8 @@ static void SendSignal(u32 signal) {
452 452
453 std::string buffer = 453 std::string buffer =
454 Common::StringFromFormat("T%02x%02x:%08x;%02x:%08x;", latest_signal, 15, 454 Common::StringFromFormat("T%02x%02x:%08x;%02x:%08x;", latest_signal, 15,
455 htonl(Core::CPU().GetPC()), 13, htonl(Core::CPU().GetReg(13))); 455 htonl(static_cast<u_long>(Core::CPU().GetPC())), 13,
456 htonl(static_cast<u_long>(Core::CPU().GetReg(13))));
456 LOG_DEBUG(Debug_GDBStub, "Response: %s", buffer.c_str()); 457 LOG_DEBUG(Debug_GDBStub, "Response: %s", buffer.c_str());
457 SendReply(buffer.c_str()); 458 SendReply(buffer.c_str());
458} 459}
@@ -539,7 +540,7 @@ static void ReadRegister() {
539 } 540 }
540 541
541 if (id <= R15_REGISTER) { 542 if (id <= R15_REGISTER) {
542 IntToGdbHex(reply, Core::CPU().GetReg(id)); 543 IntToGdbHex(reply, static_cast<u32>(Core::CPU().GetReg(static_cast<u64>(id))));
543 } else if (id == CPSR_REGISTER) { 544 } else if (id == CPSR_REGISTER) {
544 IntToGdbHex(reply, Core::CPU().GetCPSR()); 545 IntToGdbHex(reply, Core::CPU().GetCPSR());
545 } else if (id > CPSR_REGISTER && id < FPSCR_REGISTER) { 546 } else if (id > CPSR_REGISTER && id < FPSCR_REGISTER) {
@@ -563,7 +564,7 @@ static void ReadRegisters() {
563 u8* bufptr = buffer; 564 u8* bufptr = buffer;
564 565
565 for (int reg = 0; reg <= R15_REGISTER; reg++) { 566 for (int reg = 0; reg <= R15_REGISTER; reg++) {
566 IntToGdbHex(bufptr + reg * CHAR_BIT, Core::CPU().GetReg(reg)); 567 IntToGdbHex(bufptr + reg * CHAR_BIT, static_cast<u32>(Core::CPU().GetReg(reg)));
567 } 568 }
568 569
569 bufptr += (16 * CHAR_BIT); 570 bufptr += (16 * CHAR_BIT);
@@ -1034,4 +1035,4 @@ bool GetCpuStepFlag() {
1034void SetCpuStepFlag(bool is_step) { 1035void SetCpuStepFlag(bool is_step) {
1035 step_loop = is_step; 1036 step_loop = is_step;
1036} 1037}
1037}; 1038}; // namespace GDBStub
diff --git a/src/core/hle/kernel/condition_variable.cpp b/src/core/hle/kernel/condition_variable.cpp
index 5942eae61..561666384 100644
--- a/src/core/hle/kernel/condition_variable.cpp
+++ b/src/core/hle/kernel/condition_variable.cpp
@@ -43,7 +43,7 @@ void ConditionVariable::Acquire(Thread* thread) {
43ResultCode ConditionVariable::Release(s32 target) { 43ResultCode ConditionVariable::Release(s32 target) {
44 if (target == -1) { 44 if (target == -1) {
45 // When -1, wake up all waiting threads 45 // When -1, wake up all waiting threads
46 SetAvailableCount(GetWaitingThreads().size()); 46 SetAvailableCount(static_cast<s32>(GetWaitingThreads().size()));
47 WakeupAllWaitingThreads(); 47 WakeupAllWaitingThreads();
48 } else { 48 } else {
49 // Otherwise, wake up just a single thread 49 // Otherwise, wake up just a single thread
diff --git a/src/core/hle/kernel/hle_ipc.cpp b/src/core/hle/kernel/hle_ipc.cpp
index 73bb6a8be..3899dad09 100644
--- a/src/core/hle/kernel/hle_ipc.cpp
+++ b/src/core/hle/kernel/hle_ipc.cpp
@@ -210,7 +210,7 @@ ResultCode HLERequestContext::WriteToOutgoingCommandBuffer(u32_le* dst_cmdbuf, P
210 210
211 for (auto& object : domain_objects) { 211 for (auto& object : domain_objects) {
212 request_handlers.emplace_back(object); 212 request_handlers.emplace_back(object);
213 dst_cmdbuf[domain_offset++] = request_handlers.size(); 213 dst_cmdbuf[domain_offset++] = static_cast<u32_le>(request_handlers.size());
214 } 214 }
215 } 215 }
216 return RESULT_SUCCESS; 216 return RESULT_SUCCESS;
diff --git a/src/core/hle/service/vi/vi.cpp b/src/core/hle/service/vi/vi.cpp
index 015fb164e..c624e734e 100644
--- a/src/core/hle/service/vi/vi.cpp
+++ b/src/core/hle/service/vi/vi.cpp
@@ -95,7 +95,7 @@ public:
95 95
96 Header header{}; 96 Header header{};
97 header.data_offset = sizeof(Header); 97 header.data_offset = sizeof(Header);
98 header.data_size = write_index - sizeof(Header); 98 header.data_size = static_cast<u32_le>(write_index - sizeof(Header));
99 std::memcpy(buffer.data(), &header, sizeof(Header)); 99 std::memcpy(buffer.data(), &header, sizeof(Header));
100 100
101 return buffer; 101 return buffer;