Skip to content

Commit 1e0c8d3

Browse files
author
Alex Cole
committed
More original SA:MP parameters were const than I thought.
1 parent 79a3a1b commit 1e0c8d3

File tree

19 files changed

+62
-66
lines changed

19 files changed

+62
-66
lines changed

YSI_Coding/y_inline/y_inline_impl.inc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ stock Inline_EBC__(owner, tag)
295295
return
296296
++timerID,
297297
//// Set a timer to kill this inline eventually.
298-
SetTimerEx(&Inline_TBC__, owner, false, __const(YSI_gcI), timerID),
298+
SetTimerEx(&Inline_TBC__, owner, false, YSI_gcI, timerID),
299299
(timerID | (0x1FF << 22)) & cellmax;
300300
}
301301
else
@@ -1227,7 +1227,7 @@ stock Function:GetRemoteFunction(const func[], const spec[], tag = 0)
12271227
mset(closure, _:E_INDIRECTION_HANDER, _:addressof (Callback_RemoteHandler_<x>));
12281228
mset(closure, _:E_INDIRECTION_CLAIM, _:addressof (Callback_Claim_));
12291229
mset(closure, _:E_INDIRECTION_RELEASE, _:addressof (Callback_Release_<tResolvedAlloc:>));
1230-
mset(closure, _:E_PUBLIC_CALL_TIMER, SetTimerEx(&Inline_MaybeFree_<tAlloc:>, 0, false, __const(YSI_gcI), _:closure));
1230+
mset(closure, _:E_PUBLIC_CALL_TIMER, SetTimerEx(&Inline_MaybeFree_<tAlloc:>, 0, false, YSI_gcI, _:closure));
12311231
mset(closure, _:E_PUBLIC_CALL_FLAGS, e_INLINE_FLAG_PUBLIC);
12321232
mset(closure, _:E_INDIRECTION_METADATA, 0);
12331233
if (tag)
@@ -1285,7 +1285,7 @@ stock Function:GetLocalFunction(const func[], const spec[], tag = 0)
12851285
mset(closure, _:E_INDIRECTION_HANDER, _:addressof (Callback_LocalHandler_<x>));
12861286
mset(closure, _:E_INDIRECTION_CLAIM, _:addressof (Callback_Claim_));
12871287
mset(closure, _:E_INDIRECTION_RELEASE, _:addressof (Callback_Release_<tResolvedAlloc:>));
1288-
mset(closure, _:E_PUBLIC_CALL_TIMER, SetTimerEx(&Inline_MaybeFree_<tAlloc:>, 0, false, __const(YSI_gcI), _:closure));
1288+
mset(closure, _:E_PUBLIC_CALL_TIMER, SetTimerEx(&Inline_MaybeFree_<tAlloc:>, 0, false, YSI_gcI, _:closure));
12891289
mset(closure, _:E_PUBLIC_CALL_FLAGS, e_INLINE_FLAG_PUBLIC);
12901290
mset(closure, _:E_INDIRECTION_METADATA, 0);
12911291
if (tag)
@@ -1404,7 +1404,7 @@ static stock Callback_InlineByName(const name[], tag)
14041404
mset(closure, _:E_INDIRECTION_HANDER, _:addressof (Callback_CallHandler_<x>));
14051405
mset(closure, _:E_INDIRECTION_CLAIM, _:addressof (Callback_Claim_));
14061406
mset(closure, _:E_INDIRECTION_RELEASE, _:addressof (Callback_Release_<tResolvedAlloc:>));
1407-
mset(closure, _:E_INLINE_CALL_TIMER, SetTimerEx(&Inline_MaybeFree_<tAlloc:>, 0, false, __const(YSI_gcI), _:closure));
1407+
mset(closure, _:E_INLINE_CALL_TIMER, SetTimerEx(&Inline_MaybeFree_<tAlloc:>, 0, false, YSI_gcI, _:closure));
14081408
mset(closure, _:E_INLINE_CALL_FLAGS, e_INLINE_FLAG_CONST);
14091409
mset(closure, _:E_INDIRECTION_METADATA, 0);
14101410
mset(closure, _:E_INDIRECTION_TAG, tag);
@@ -1670,7 +1670,7 @@ stock Callback_Release(const input[E_CALLBACK_DATA])
16701670
static stock Callback_Claim_(func[E_INLINE_CALL])
16711671
{
16721672
KillTimer(func[E_INLINE_CALL_TIMER]);
1673-
func[E_INLINE_CALL_TIMER] = SetTimerEx(&Inline_MaybeConst_<tResolvedAlloc:>, 0, false, __const(YSI_gcI), AMX_Ref(func[E_INLINE_CALL:E_INDIRECTION_ALWAYS_NULL]));
1673+
func[E_INLINE_CALL_TIMER] = SetTimerEx(&Inline_MaybeConst_<tResolvedAlloc:>, 0, false, YSI_gcI, AMX_Ref(func[E_INLINE_CALL:E_INDIRECTION_ALWAYS_NULL]));
16741674
}
16751675

16761676
/*-------------------------------------------------------------------------*//**
@@ -2251,7 +2251,7 @@ stock Inline_UI_(const &header, tag)
22512251
mset(closure, _:E_INDIRECTION_HANDER, _:addressof (Callback_CallHandler_<x>));
22522252
mset(closure, _:E_INDIRECTION_CLAIM, _:addressof (Callback_Claim_));
22532253
mset(closure, _:E_INDIRECTION_RELEASE, _:addressof (Callback_Release_<tResolvedAlloc:>));
2254-
mset(closure, _:E_INLINE_CALL_TIMER, SetTimerEx(&Inline_MaybeFree_<tAlloc:>, 0, false, __const(YSI_gcI), _:closure));
2254+
mset(closure, _:E_INLINE_CALL_TIMER, SetTimerEx(&Inline_MaybeFree_<tAlloc:>, 0, false, YSI_gcI, _:closure));
22552255
mset(closure, _:E_INLINE_CALL_FLAGS, e_INLINE_FLAG_CONST);
22562256
mset(closure, _:E_INDIRECTION_METADATA, 0);
22572257
mset(closure, _:E_INDIRECTION_TAG, tag);

YSI_Coding/y_inline/y_inline_tests.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2037,7 +2037,7 @@ public y_inline_CallLaterPublic()
20372037
static stock y_inline_CallLater(Func:cb<>)
20382038
{
20392039
Indirect_Claim(cb);
2040-
SetTimerEx("Indirect_FromCallback", 100 + random(100), false, "ii", _:cb, true);
2040+
SetTimerEx(__const("Indirect_FromCallback"), 100 + random(100), false, "ii", _:cb, true);
20412041
}
20422042

20432043
@test(.group = "y_inline") y_inline_CallLater()

YSI_Coding/y_malloc/y_malloc_tests.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,6 @@ public y_malloc_Deferred(Alloc:alloc)
319319
{
320320
mset(alloc, i, i * 2);
321321
}
322-
SetTimerEx(__const("y_malloc_Deferred"), 10, false, __const(YSI_gcI), _:alloc);
322+
SetTimerEx(__const("y_malloc_Deferred"), 10, false, YSI_gcI, _:alloc);
323323
}
324324

YSI_Coding/y_timers/y_timers_impl.inc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ public OnCodeInit()
160160
Debug_Print7("Timer_OnYSIInit: %s", Unpack(buffer));
161161
// Get the time offset for the current call. This should mean
162162
// that all the functions are nicely spread out.
163-
SetTimerEx(__const(buffer), time * pre / total, false, __const(YSI_gcII), 1, -1);
163+
SetTimerEx(buffer, time * pre / total, false, YSI_gcII, 1, -1);
164164
}
165165
}
166166
}
@@ -344,13 +344,13 @@ stock _y@T:_Timer_D(const func[], interval, const {_, _yT@}:action, who, results
344344
{
345345
if (!results[who])
346346
{
347-
results[who] = SetTimerEx(__const(func), interval, true, __const(YSI_gcI), who);
347+
results[who] = SetTimerEx(__const(func), interval, true, YSI_gcI, who);
348348
}
349349
}
350350
}
351351
else if (!results[who])
352352
{
353-
results[who] = SetTimerEx(__const(func), interval, true, __const(YSI_gcI), who);
353+
results[who] = SetTimerEx(__const(func), interval, true, YSI_gcI, who);
354354
}
355355
}
356356
}

YSI_Coding/y_va/y_va_entry.inc

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ stock bool:va_SetVehicleNumberPlate(vehicleid, const fmat[], GLOBAL_TAG_TYPES:..
221221
stock bool:va_SendClientMessage(playerid, colour, const fmat[], GLOBAL_TAG_TYPES:...)
222222
{
223223
if (YSI_CheckNumargs__(3))
224-
return bool:SendClientMessage(playerid, colour, __const(fmat));
224+
return bool:SendClientMessage(playerid, colour, fmat);
225225
return
226226
format(YSI_UNSAFE_HUGE_STRING, YSI_UNSAFE_HUGE_LENGTH, fmat, ___(3)),
227227
bool:SendClientMessage(playerid, colour, YSI_UNSAFE_HUGE_STRING);
@@ -230,7 +230,7 @@ stock bool:va_SetVehicleNumberPlate(vehicleid, const fmat[], GLOBAL_TAG_TYPES:..
230230
stock bool:va_SendClientMessageToAll(colour, const fmat[], GLOBAL_TAG_TYPES:...)
231231
{
232232
if (YSI_CheckNumargs__(2))
233-
return bool:SendClientMessageToAll(colour, __const(fmat));
233+
return bool:SendClientMessageToAll(colour, fmat);
234234
return
235235
format(YSI_UNSAFE_HUGE_STRING, YSI_UNSAFE_HUGE_LENGTH, fmat, ___(2)),
236236
bool:SendClientMessageToAll(colour, YSI_UNSAFE_HUGE_STRING);
@@ -239,7 +239,7 @@ stock bool:va_SetVehicleNumberPlate(vehicleid, const fmat[], GLOBAL_TAG_TYPES:..
239239
stock bool:va_SendPlayerMessageToPlayer(playerid, senderid, const fmat[], GLOBAL_TAG_TYPES:...)
240240
{
241241
if (YSI_CheckNumargs__(3))
242-
return bool:SendPlayerMessageToPlayer(playerid, senderid, __const(fmat));
242+
return bool:SendPlayerMessageToPlayer(playerid, senderid, fmat);
243243
return
244244
format(YSI_UNSAFE_HUGE_STRING, YSI_UNSAFE_HUGE_LENGTH, fmat, ___(3)),
245245
bool:SendPlayerMessageToPlayer(playerid, senderid, YSI_UNSAFE_HUGE_STRING);
@@ -248,7 +248,7 @@ stock bool:va_SetVehicleNumberPlate(vehicleid, const fmat[], GLOBAL_TAG_TYPES:..
248248
stock bool:va_SendPlayerMessageToAll(senderid, const fmat[], GLOBAL_TAG_TYPES:...)
249249
{
250250
if (YSI_CheckNumargs__(2))
251-
return bool:SendPlayerMessageToAll(senderid, __const(fmat));
251+
return bool:SendPlayerMessageToAll(senderid, fmat);
252252
return
253253
format(YSI_UNSAFE_HUGE_STRING, YSI_UNSAFE_HUGE_LENGTH, fmat, ___(2)),
254254
bool:SendPlayerMessageToAll(senderid, YSI_UNSAFE_HUGE_STRING);
@@ -257,7 +257,7 @@ stock bool:va_SetVehicleNumberPlate(vehicleid, const fmat[], GLOBAL_TAG_TYPES:..
257257
stock bool:va_GameTextForPlayer(playerid, const fmat[], time, style, GLOBAL_TAG_TYPES:...)
258258
{
259259
if (YSI_CheckNumargs__(4))
260-
return bool:GameTextForPlayer(playerid, __const(fmat), time, style);
260+
return bool:GameTextForPlayer(playerid, fmat, time, style);
261261
return
262262
format(YSI_UNSAFE_HUGE_STRING, YSI_UNSAFE_HUGE_LENGTH, fmat, ___(4)),
263263
bool:GameTextForPlayer(playerid, YSI_UNSAFE_HUGE_STRING, time, style);
@@ -266,7 +266,7 @@ stock bool:va_SetVehicleNumberPlate(vehicleid, const fmat[], GLOBAL_TAG_TYPES:..
266266
stock bool:va_GameTextForAll(const fmat[], time, style, GLOBAL_TAG_TYPES:...)
267267
{
268268
if (YSI_CheckNumargs__(3))
269-
return bool:GameTextForAll(__const(fmat), time, style);
269+
return bool:GameTextForAll(fmat, time, style);
270270
return
271271
format(YSI_UNSAFE_HUGE_STRING, YSI_UNSAFE_HUGE_LENGTH, fmat, ___(3)),
272272
bool:GameTextForAll(YSI_UNSAFE_HUGE_STRING, time, style);
@@ -284,7 +284,7 @@ stock bool:va_SetVehicleNumberPlate(vehicleid, const fmat[], GLOBAL_TAG_TYPES:..
284284
stock bool:va_SetGameModeText(const fmat[], GLOBAL_TAG_TYPES:...)
285285
{
286286
if (YSI_CheckNumargs__(1))
287-
return bool:SetGameModeText(__const(fmat));
287+
return bool:SetGameModeText(fmat);
288288
return
289289
format(YSI_UNSAFE_HUGE_STRING, YSI_UNSAFE_HUGE_LENGTH, fmat, ___(1)),
290290
bool:SetGameModeText(YSI_UNSAFE_HUGE_STRING);
@@ -319,7 +319,7 @@ stock bool:va_SetVehicleNumberPlate(vehicleid, const fmat[], GLOBAL_TAG_TYPES:..
319319
stock Menu:va_CreateMenu(const fmat[], columns, Float:x, Float:y, Float:col1width, Float:col2width = 0.0, GLOBAL_TAG_TYPES:...)
320320
{
321321
if (YSI_CheckNumargs__(6))
322-
return CreateMenu(__const(fmat), columns, x, y, col1width, col2width);
322+
return CreateMenu(fmat, columns, x, y, col1width, col2width);
323323
return
324324
format(YSI_UNSAFE_HUGE_STRING, YSI_UNSAFE_HUGE_LENGTH, fmat, ___(6)),
325325
CreateMenu(YSI_UNSAFE_HUGE_STRING, columns, x, y, col1width, col2width);
@@ -328,7 +328,7 @@ stock bool:va_SetVehicleNumberPlate(vehicleid, const fmat[], GLOBAL_TAG_TYPES:..
328328
stock va_AddMenuItem(Menu:menuid, column, const fmat[], GLOBAL_TAG_TYPES:...)
329329
{
330330
if (YSI_CheckNumargs__(3))
331-
return AddMenuItem(menuid, column, __const(fmat));
331+
return AddMenuItem(menuid, column, fmat);
332332
return
333333
format(YSI_UNSAFE_HUGE_STRING, YSI_UNSAFE_HUGE_LENGTH, fmat, ___(3)),
334334
AddMenuItem(menuid, column, YSI_UNSAFE_HUGE_STRING);
@@ -337,7 +337,7 @@ stock bool:va_SetVehicleNumberPlate(vehicleid, const fmat[], GLOBAL_TAG_TYPES:..
337337
stock bool:va_SetMenuColumnHeader(Menu:menuid, column, const fmat[], GLOBAL_TAG_TYPES:...)
338338
{
339339
if (YSI_CheckNumargs__(3))
340-
return bool:SetMenuColumnHeader(menuid, column, __const(fmat));
340+
return bool:SetMenuColumnHeader(menuid, column, fmat);
341341
return
342342
format(YSI_UNSAFE_HUGE_STRING, YSI_UNSAFE_HUGE_LENGTH, fmat, ___(3)),
343343
bool:SetMenuColumnHeader(menuid, column, YSI_UNSAFE_HUGE_STRING);

YSI_Core/y_core/y_const_correct.inc

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,9 @@
4747
#if !defined SAMP_CONST_CORRECT
4848
// The libraries are not const-corret.
4949
#define SAMP_CONST_INCORRECT
50-
#if defined __PawnBuild
51-
#if __PawnBuild >= 9
52-
// But they should be.
53-
#undef __const
54-
#define __const __const_impl
55-
#endif
56-
#endif
50+
// But they should be.
51+
#undef __const
52+
#define __const __const_impl
5753
#endif
5854

5955
#if !defined __const_decl

YSI_Core/y_core/y_samp_natives.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ static stock const
159159

160160
stock SetTimerAddr(addr, time, bool:repeat)
161161
{
162-
return SetTimerEx(__const(YSI_gscTimerStub), time, repeat, __const(YSI_gcI), addr);
162+
return SetTimerEx(__const(YSI_gscTimerStub), time, repeat, YSI_gcI, addr);
163163
}
164164

165165
#if defined _ALS_SetTimer

YSI_Extra/y_inline_timers.inc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ static stock Timer_InlineCount(Func:func<>, time, count)
132132
{
133133
// Initial repeating timer, to set the time offset.
134134
//printf("delay = %d", timer);
135-
Indirect_SetMeta(func, SetTimerEx(&Timer_InlineRepeat<tF@_@:>, time, true, __const(YSI_gcI), _:func));
135+
Indirect_SetMeta(func, SetTimerEx(&Timer_InlineRepeat<tF@_@:>, time, true, YSI_gcI, _:func));
136136
// Call the function after setting the meta, incase it kills the timer.
137137
@.func();
138138
}
@@ -146,7 +146,7 @@ static stock Timer_InlineCount(Func:func<>, time, count)
146146
default:
147147
{
148148
// Call after meta.
149-
Indirect_SetMeta(func, SetTimerEx(&Timer_InlineCount<tF@_@:ii>, time, false, __const(YSI_gcIII), _:func, time, count));
149+
Indirect_SetMeta(func, SetTimerEx(&Timer_InlineCount<tF@_@:ii>, time, false, YSI_gcIII, _:func, time, count));
150150
@.func();
151151
}
152152
}
@@ -205,7 +205,7 @@ stock Timer_CreateCallback(Func:func<>, initialOrTime, timeOrCount = 0, count =
205205
// the initial offset time.
206206
// Repeat N times.
207207
Indirect_Claim(func);
208-
Indirect_SetMeta(func, SetTimerEx(&Timer_InlineCount<tF@_@:ii>, initialOrTime, false, __const(YSI_gcIII), _:func, timeOrCount, count));
208+
Indirect_SetMeta(func, SetTimerEx(&Timer_InlineCount<tF@_@:ii>, initialOrTime, false, YSI_gcIII, _:func, timeOrCount, count));
209209
return _:func;
210210
}
211211

YSI_Players/y_android/y_android_entry.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ public OnPlayerConnect(playerid)
159159
if (!Script_IsFilterscript())
160160
{
161161
YSI_SendClientCheck__(playerid, 0x48, 0, 0, 2);
162-
YSI_g_sTimers[playerid] = SetTimerEx(&OnAndroidTimer<i>, 10000, false, __const(YSI_gcI), playerid);
162+
YSI_g_sTimers[playerid] = SetTimerEx(&OnAndroidTimer<i>, 10000, false, YSI_gcI, playerid);
163163
}
164164
#if defined Android_OnPlayerConnect
165165
Android_OnPlayerConnect(playerid);

YSI_Players/y_users/y_users_impl.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ stock bool:User_ConfirmEmail(playerid, string:email[])
379379
}
380380
// Defer the call, so it looks like a callback in the same way as
381381
// confirming a password. Check the length first.
382-
SetTimerEx(__const("OnConfirmEmail"), 0, false, __const(YSI_gcII), playerid, len == end - start && strcmp(YSI_g_sUserEmail[playerid], email[start], false, len) == 0);
382+
SetTimerEx(__const("OnConfirmEmail"), 0, false, YSI_gcII, playerid, len == end - start && strcmp(YSI_g_sUserEmail[playerid], email[start], false, len) == 0);
383383
return true;
384384
}
385385
}

0 commit comments

Comments
 (0)