@@ -17,7 +17,7 @@ int32_t getEmptyWatchSlot()
17
17
int32_t Size = sizeof (MemoryWatch) / sizeof (MemoryWatch[0 ]);
18
18
for (int32_t i = 0 ; i < Size; i++)
19
19
{
20
- if (MemoryWatch[i].Address == 0 )
20
+ if (! MemoryWatch[i].Address )
21
21
{
22
22
return i;
23
23
}
@@ -112,6 +112,7 @@ const char *getValueString(int32_t slot)
112
112
bool ShowAsHex = MemoryWatch[slot].ShowAsHex ;
113
113
char *tempDisplayBuffer = DisplayBuffer;
114
114
115
+ const char *Format;
115
116
switch (MemoryWatch[slot].Type )
116
117
{
117
118
case string:
@@ -139,165 +140,171 @@ const char *getValueString(int32_t slot)
139
140
// Handle the value as unsigned
140
141
uint64_t CurrentTimeUnsigned = static_cast <uint64_t >(CurrentTime);
141
142
142
- uint32_t hour = CurrentTimeUnsigned / 3600 / FPS;
143
- uint32_t minute = (CurrentTimeUnsigned / 60 / FPS) % 60 ;
144
- uint32_t second = (CurrentTimeUnsigned / FPS) % 60 ;
145
- uint32_t frame = CurrentTimeUnsigned % FPS;
143
+ uint32_t Hour = CurrentTimeUnsigned / 3600 / FPS;
144
+ uint32_t Minute = (CurrentTimeUnsigned / 60 / FPS) % 60 ;
145
+ uint32_t Second = (CurrentTimeUnsigned / FPS) % 60 ;
146
+ uint32_t Frame = CurrentTimeUnsigned % FPS;
146
147
147
148
if (ValueIsPositive)
148
149
{
149
- sprintf (tempDisplayBuffer,
150
- " %02" PRIu32 " :%02" PRIu32 " :%02" PRIu32 " .%02" PRIu32,
151
- hour,
152
- minute,
153
- second,
154
- frame);
150
+ Format = " %02" PRIu32 " :%02" PRIu32 " :%02" PRIu32 " .%02" PRIu32;
155
151
}
156
152
else
157
153
{
158
- sprintf (tempDisplayBuffer,
159
- " -%02" PRIu32 " :%02" PRIu32 " :%02" PRIu32 " .%02" PRIu32,
160
- hour,
161
- minute,
162
- second,
163
- frame);
154
+ Format = " -%02" PRIu32 " :%02" PRIu32 " :%02" PRIu32 " .%02" PRIu32;
164
155
}
156
+
157
+ sprintf (tempDisplayBuffer,
158
+ Format,
159
+ Hour,
160
+ Minute,
161
+ Second,
162
+ Frame);
163
+
165
164
return tempDisplayBuffer;
166
165
}
167
166
case s8:
168
167
{
169
168
int8_t Value = *reinterpret_cast <int8_t *>(Address);
170
169
if (ShowAsHex)
171
170
{
172
- sprintf (tempDisplayBuffer,
173
- " 0x%02" PRIX8,
174
- Value);
171
+ Format = " 0x%02" PRIX8;
175
172
}
176
173
else
177
174
{
178
- sprintf (tempDisplayBuffer,
179
- " %" PRId8,
180
- Value);
175
+ Format = " %" PRId8;
181
176
}
177
+
178
+ sprintf (tempDisplayBuffer,
179
+ Format,
180
+ Value);
181
+
182
182
return tempDisplayBuffer;
183
183
}
184
184
case s16:
185
185
{
186
186
int16_t Value = *reinterpret_cast <int16_t *>(Address);
187
187
if (ShowAsHex)
188
188
{
189
- sprintf (tempDisplayBuffer,
190
- " 0x%04" PRIX16,
191
- Value);
189
+ Format = " 0x%04" PRIX16;
192
190
}
193
191
else
194
192
{
195
- sprintf (tempDisplayBuffer,
196
- " %" PRId16,
197
- Value);
193
+ Format = " %" PRId16;
198
194
}
195
+
196
+ sprintf (tempDisplayBuffer,
197
+ Format,
198
+ Value);
199
+
199
200
return tempDisplayBuffer;
200
201
}
201
202
case s32:
202
203
{
203
204
int32_t Value = *reinterpret_cast <int32_t *>(Address);
204
205
if (ShowAsHex)
205
206
{
206
- sprintf (tempDisplayBuffer,
207
- " 0x%08" PRIX32,
208
- Value);
207
+ Format = " 0x%08" PRIX32;
209
208
}
210
209
else
211
210
{
212
- sprintf (tempDisplayBuffer,
213
- " %" PRId32,
214
- Value);
211
+ Format = " %" PRId32;
215
212
}
213
+
214
+ sprintf (tempDisplayBuffer,
215
+ Format,
216
+ Value);
217
+
216
218
return tempDisplayBuffer;
217
219
}
218
220
case s64:
219
221
{
220
222
int64_t Value = *reinterpret_cast <int64_t *>(Address);
221
223
if (ShowAsHex)
222
224
{
223
- sprintf (tempDisplayBuffer,
224
- " 0x%016" PRIX64,
225
- Value);
225
+ Format = " 0x%016" PRIX64;
226
226
}
227
227
else
228
228
{
229
- sprintf (tempDisplayBuffer,
230
- " %" PRId64,
231
- Value);
229
+ Format = " %" PRId64;
232
230
}
231
+
232
+ sprintf (tempDisplayBuffer,
233
+ Format,
234
+ Value);
235
+
233
236
return tempDisplayBuffer;
234
237
}
235
238
case u8 :
236
239
{
237
240
uint8_t Value = *reinterpret_cast <uint8_t *>(Address);
238
241
if (ShowAsHex)
239
242
{
240
- sprintf (tempDisplayBuffer,
241
- " 0x%02" PRIX8,
242
- Value);
243
+ Format = " 0x%02" PRIX8;
243
244
}
244
245
else
245
246
{
246
- sprintf (tempDisplayBuffer,
247
- " %" PRIu8,
248
- Value);
247
+ Format = " %" PRIu8;
249
248
}
249
+
250
+ sprintf (tempDisplayBuffer,
251
+ Format,
252
+ Value);
253
+
250
254
return tempDisplayBuffer;
251
255
}
252
256
case u16 :
253
257
{
254
258
uint16_t Value = *reinterpret_cast <uint16_t *>(Address);
255
259
if (ShowAsHex)
256
260
{
257
- sprintf (tempDisplayBuffer,
258
- " 0x%04" PRIX16,
259
- Value);
261
+ Format = " 0x%04" PRIX16;
260
262
}
261
263
else
262
264
{
263
- sprintf (tempDisplayBuffer,
264
- " %" PRIu16,
265
- Value);
265
+ Format = " %" PRIu16;
266
266
}
267
+
268
+ sprintf (tempDisplayBuffer,
269
+ Format,
270
+ Value);
271
+
267
272
return tempDisplayBuffer;
268
273
}
269
274
case u32 :
270
275
{
271
276
uint32_t Value = *reinterpret_cast <uint32_t *>(Address);
272
277
if (ShowAsHex)
273
278
{
274
- sprintf (tempDisplayBuffer,
275
- " 0x%08" PRIX32,
276
- Value);
279
+ Format = " 0x%08" PRIX32;
277
280
}
278
281
else
279
282
{
280
- sprintf (tempDisplayBuffer,
281
- " %" PRIu32,
282
- Value);
283
+ Format = " %" PRIu32;
283
284
}
285
+
286
+ sprintf (tempDisplayBuffer,
287
+ Format,
288
+ Value);
289
+
284
290
return tempDisplayBuffer;
285
291
}
286
292
case u64 :
287
293
{
288
294
uint64_t Value = *reinterpret_cast <uint64_t *>(Address);
289
295
if (ShowAsHex)
290
296
{
291
- sprintf (tempDisplayBuffer,
292
- " 0x%016" PRIX64,
293
- Value);
297
+ Format = " 0x%016" PRIX64;
294
298
}
295
299
else
296
300
{
297
- sprintf (tempDisplayBuffer,
298
- " %" PRIu64,
299
- Value);
301
+ Format = " %" PRIu64;
300
302
}
303
+
304
+ sprintf (tempDisplayBuffer,
305
+ Format,
306
+ Value);
307
+
301
308
return tempDisplayBuffer;
302
309
}
303
310
case f32 :
0 commit comments