1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-08-01 17:38:41 +00:00

Delete clang-format files and comments (#14079)

This commit is contained in:
Gary Miguel 2023-12-15 01:23:44 -08:00 committed by GitHub
parent 64b59184d1
commit da832a295e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
24 changed files with 0 additions and 702 deletions

View file

@ -50,7 +50,6 @@ void ActiveObjectMgr::step(
}
}
// clang-format off
bool ActiveObjectMgr::registerObject(std::unique_ptr<ClientActiveObject> obj)
{
assert(obj); // Pre-condition
@ -93,7 +92,6 @@ void ActiveObjectMgr::removeObject(u16 id)
obj->removeFromScene(true);
}
// clang-format on
void ActiveObjectMgr::getActiveObjects(const v3f &origin, f32 max_d,
std::vector<DistanceSortedActiveObject> &dest)
{

View file

@ -47,7 +47,6 @@ struct MeshCollector
// offset: offset added to vertices
MeshCollector(const v3f center_pos, v3f offset = v3f()) : m_center_pos(center_pos), offset(offset) {}
// clang-format off
void append(const TileSpec &material,
const video::S3DVertex *vertices, u32 numVertices,
const u16 *indices, u32 numIndices);
@ -55,10 +54,8 @@ struct MeshCollector
const video::S3DVertex *vertices, u32 numVertices,
const u16 *indices, u32 numIndices,
v3f pos, video::SColor c, u8 light_source);
// clang-format on
private:
// clang-format off
void append(const TileLayer &material,
const video::S3DVertex *vertices, u32 numVertices,
const u16 *indices, u32 numIndices,
@ -68,7 +65,6 @@ private:
const u16 *indices, u32 numIndices,
v3f pos, video::SColor c, u8 light_source,
u8 layernum, bool use_scale = false);
// clang-format on
PreMeshBuffer &findBuffer(const TileLayer &layer, u8 layernum, u32 numVertices);
};

View file

@ -108,10 +108,8 @@ bool parseModContents(ModSpec &spec)
if (info.exists("depends")) {
mod_conf_has_depends = true;
std::string dep = info.get("depends");
// clang-format off
dep.erase(std::remove_if(dep.begin(), dep.end(),
static_cast<int (*)(int)>(&std::isspace)), dep.end());
// clang-format on
for (const auto &dependency : str_split(dep, ',')) {
spec.depends.insert(dependency);
}
@ -120,10 +118,8 @@ bool parseModContents(ModSpec &spec)
if (info.exists("optional_depends")) {
mod_conf_has_depends = true;
std::string dep = info.get("optional_depends");
// clang-format off
dep.erase(std::remove_if(dep.begin(), dep.end(),
static_cast<int (*)(int)>(&std::isspace)), dep.end());
// clang-format on
for (const auto &dependency : str_split(dep, ',')) {
spec.optdepends.insert(dependency);
}

View file

@ -455,7 +455,6 @@ bool GUIEditBox::processKey(const SEvent &event)
bool GUIEditBox::onKeyUp(const SEvent &event, s32 &mark_begin, s32 &mark_end)
{
// clang-format off
if (m_multiline || (m_word_wrap && m_broken_text.size() > 1)) {
s32 lineNo = getLineFromPos(m_cursor_pos);
s32 mb = (m_mark_begin == m_mark_end) ? m_cursor_pos :
@ -481,13 +480,11 @@ bool GUIEditBox::onKeyUp(const SEvent &event, s32 &mark_begin, s32 &mark_end)
return true;
}
// clang-format on
return false;
}
bool GUIEditBox::onKeyDown(const SEvent &event, s32 &mark_begin, s32 &mark_end)
{
// clang-format off
if (m_multiline || (m_word_wrap && m_broken_text.size() > 1)) {
s32 lineNo = getLineFromPos(m_cursor_pos);
s32 mb = (m_mark_begin == m_mark_end) ? m_cursor_pos :
@ -513,7 +510,6 @@ bool GUIEditBox::onKeyDown(const SEvent &event, s32 &mark_begin, s32 &mark_end)
return true;
}
// clang-format on
return false;
}

View file

@ -199,14 +199,12 @@ bool GUIPasswordChange::processInput()
bool GUIPasswordChange::OnEvent(const SEvent &event)
{
if (event.EventType == EET_KEY_INPUT_EVENT) {
// clang-format off
if ((event.KeyInput.Key == KEY_ESCAPE ||
event.KeyInput.Key == KEY_CANCEL) &&
event.KeyInput.PressedDown) {
quitMenu();
return true;
}
// clang-format on
if (event.KeyInput.Key == KEY_RETURN && event.KeyInput.PressedDown) {
acceptInput();
if (processInput())

View file

@ -155,7 +155,6 @@ bool GUIScrollBar::OnEvent(const SEvent &event)
if (event.MouseInput.Event == EMIE_LMOUSE_LEFT_UP)
is_dragging = false;
// clang-format off
if (!dragged_by_slider) {
if (is_inside) {
dragged_by_slider = slider_rect.isPointInside(p);
@ -167,7 +166,6 @@ bool GUIScrollBar::OnEvent(const SEvent &event)
return is_inside;
}
}
// clang-format on
const s32 new_pos = getPosFromMousePos(p);
const s32 old_pos = scroll_pos;

View file

@ -29,7 +29,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "touchscreengui.h"
#endif
// clang-format off
GUIModalMenu::GUIModalMenu(gui::IGUIEnvironment* env, gui::IGUIElement* parent,
s32 id, IMenuManager *menumgr, bool remap_dbl_click) :
IGUIElement(gui::EGUIET_ELEMENT, env, parent, id,
@ -57,7 +56,6 @@ GUIModalMenu::GUIModalMenu(gui::IGUIEnvironment* env, gui::IGUIElement* parent,
m_doubleclickdetect[0].pos = v2s32(0, 0);
m_doubleclickdetect[1].pos = v2s32(0, 0);
}
// clang-format on
GUIModalMenu::~GUIModalMenu()
{
@ -110,7 +108,6 @@ void GUIModalMenu::quitMenu()
#endif
}
// clang-format off
bool GUIModalMenu::DoubleClickDetection(const SEvent &event)
{
/* The following code is for capturing double-clicks of the mouse button
@ -160,7 +157,6 @@ bool GUIModalMenu::DoubleClickDetection(const SEvent &event)
return false;
}
// clang-format on
static bool isChild(gui::IGUIElement *tocheck, gui::IGUIElement *parent)
{
@ -236,7 +232,6 @@ void GUIModalMenu::leave()
bool GUIModalMenu::preprocessEvent(const SEvent &event)
{
#ifdef __ANDROID__
// clang-format off
// display software keyboard when clicking edit boxes
if (event.EventType == EET_MOUSE_INPUT_EVENT &&
event.MouseInput.Event == EMIE_LMOUSE_PRESSED_DOWN) {

View file

@ -144,9 +144,6 @@ public:
}
};
// clang-format off
// ^ dislikes long lines
/** Constructs a shared pointer as a *secondary* reference to an object
*
* This function is intended to make a temporary reference to an object which
@ -205,5 +202,3 @@ irr_ptr<T> make_irr(Args&&... args)
{
return irr_ptr<T>(new T(std::forward<Args>(args)...));
}
// clang-format on

View file

@ -193,7 +193,6 @@ void LuaCamera::Register(lua_State *L)
registerClass(L, className, methods, metamethods);
}
// clang-format off
const char LuaCamera::className[] = "Camera";
const luaL_Reg LuaCamera::methods[] = {
luamethod(LuaCamera, set_camera_mode),
@ -208,4 +207,3 @@ const luaL_Reg LuaCamera::methods[] = {
{0, 0}
};
// clang-format on

View file

@ -115,7 +115,6 @@ ModChannel *ModChannelRef::getobject(lua_State *L, ModChannelRef *ref)
return getGameDef(L)->getModChannel(ref->m_modchannel_name);
}
// clang-format off
const char ModChannelRef::className[] = "ModChannelRef";
const luaL_Reg ModChannelRef::methods[] = {
luamethod(ModChannelRef, leave),
@ -123,4 +122,3 @@ const luaL_Reg ModChannelRef::methods[] = {
luamethod(ModChannelRef, send_all),
{0, 0},
};
// clang-format on

View file

@ -59,7 +59,6 @@ void PlayerMetaRef::Register(lua_State *L)
// lua_register(L, className, create_object);
}
// clang-format off
const char PlayerMetaRef::className[] = "PlayerMetaRef";
const luaL_Reg PlayerMetaRef::methods[] = {
luamethod(MetaDataRef, contains),
@ -76,4 +75,3 @@ const luaL_Reg PlayerMetaRef::methods[] = {
luamethod(MetaDataRef, equals),
{0,0}
};
// clang-format on

View file

@ -69,7 +69,6 @@ void ActiveObjectMgr::step(
}
}
// clang-format off
bool ActiveObjectMgr::registerObject(std::unique_ptr<ServerActiveObject> obj)
{
assert(obj); // Pre-condition
@ -126,7 +125,6 @@ void ActiveObjectMgr::removeObject(u16 id)
m_active_objects.erase(id); // `it` can be invalid now
}
// clang-format on
void ActiveObjectMgr::getObjectsInsideRadius(const v3f &pos, float radius,
std::vector<ServerActiveObject *> &result,
std::function<bool(ServerActiveObject *obj)> include_obj_cb)

View file

@ -49,7 +49,6 @@ ServerModManager::ServerModManager(const std::string &worldpath):
configuration.checkConflictsAndDeps();
}
// clang-format off
// This function cannot be currenctly easily tested but it should be ASAP
void ServerModManager::loadMods(ServerScripting *script)
{
@ -75,7 +74,6 @@ void ServerModManager::loadMods(ServerScripting *script)
script->on_mods_loaded();
}
// clang-format on
const ModSpec *ServerModManager::getModSpec(const std::string &modname) const
{
for (const auto &mod : configuration.getMods()) {

View file

@ -92,7 +92,6 @@ void UnitSAO::getBonePosition(const std::string &bone, v3f *position, v3f *rotat
}
}
// clang-format off
void UnitSAO::sendOutdatedData()
{
if (!m_armor_groups_sent) {
@ -123,7 +122,6 @@ void UnitSAO::sendOutdatedData()
m_messages_out.emplace(getId(), true, generateUpdateAttachmentCommand());
}
}
// clang-format on
void UnitSAO::setAttachment(int parent_id, const std::string &bone, v3f position,
v3f rotation, bool force_visible)

View file

@ -44,13 +44,11 @@ enum class OverrideTarget : override_t
SPECIAL_5 = 1 << 12,
SPECIAL_6 = 1 << 13,
// clang-format off
SIDES = LEFT | RIGHT | FRONT | BACK,
ALL_FACES = TOP | BOTTOM | SIDES,
ALL_SPECIAL = SPECIAL_1 | SPECIAL_2 | SPECIAL_3 | SPECIAL_4 | SPECIAL_5 | SPECIAL_6,
NODE_TARGETS = ALL_FACES | ALL_SPECIAL,
ITEM_TARGETS = INVENTORY | WIELD,
// clang-format on
};
struct TextureOverride

View file

@ -32,7 +32,6 @@
// float, return the float.
f32 u32Tof32Slow(u32 i)
{
// clang-format off
int exp = (i >> 23) & 0xFF;
u32 sign = i & 0x80000000UL;
u32 imant = i & 0x7FFFFFUL;
@ -56,7 +55,6 @@ f32 u32Tof32Slow(u32 i)
return sign ? -ldexpf((f32)(imant | 0x800000UL), exp - 150) :
ldexpf((f32)(imant | 0x800000UL), exp - 150);
// clang-format on
}
// Given a float, return an unsigned 32-bit integer representing the f32
@ -94,7 +92,6 @@ u32 f32Tou32Slow(f32 f)
// - The endianness of f32s and integers must match.
FloatType getFloatSerializationType()
{
// clang-format off
const f32 cf = -22220490.f;
const u32 cu = 0xCBA98765UL;
if (std::numeric_limits<f32>::is_iec559 && sizeof(cf) == 4 &&
@ -132,5 +129,4 @@ FloatType getFloatSerializationType()
}
return FLOATTYPE_SLOW;
// clang-format on
}

View file

@ -26,7 +26,6 @@
*
*/
// clang-format off
#include <cstddef>
@ -37,7 +36,6 @@
#include <ctime>
#endif
// clang-format on
#include <cstdlib>
#include <cstring>
@ -80,7 +78,6 @@ void *(*srp_alloc)(size_t) = &malloc;
void *(*srp_realloc)(void *, size_t) = &realloc;
void (*srp_free)(void *) = &free;
// clang-format off
void srp_set_memory_functions(
void *(*new_srp_alloc)(size_t),
void *(*new_srp_realloc)(void *, size_t),
@ -90,7 +87,6 @@ void srp_set_memory_functions(
srp_realloc = new_srp_realloc;
srp_free = new_srp_free;
}
// clang-format on
typedef struct {
mpz_t N;
@ -261,7 +257,6 @@ struct SRPUser {
unsigned char session_key[SHA512_DIGEST_LENGTH];
};
// clang-format off
static int hash_init(SRP_HashAlgorithm alg, HashCTX *c)
{
switch (alg) {
@ -357,7 +352,6 @@ static size_t hash_length(SRP_HashAlgorithm alg)
default: return 0;
};
}
// clang-format on
inline static int mpz_num_bytes(const mpz_t op)
{
@ -588,7 +582,6 @@ static SRP_Result init_random()
*
***********************************************************************************************************/
// clang-format off
SRP_Result srp_create_salted_verification_key( SRP_HashAlgorithm alg,
SRP_NGType ng_type, const char *username_for_verifier,
const unsigned char *password, size_t len_password,
@ -600,7 +593,6 @@ SRP_Result srp_create_salted_verification_key( SRP_HashAlgorithm alg,
mpz_t v; mpz_init(v);
mpz_t x; mpz_init(x);
// clang-format on
NGConstant *ng = new_ng(ng_type, n_hex, g_hex);
@ -646,7 +638,6 @@ error_and_exit:
goto cleanup_and_exit;
}
// clang-format off
/* Out: bytes_B, len_B.
*
@ -671,7 +662,6 @@ struct SRPVerifier *srp_verifier_new(SRP_HashAlgorithm alg,
mpz_t tmp1; mpz_init(tmp1);
mpz_t tmp2; mpz_init(tmp2);
mpz_t tmp3; mpz_init(tmp3);
// clang-format on
size_t ulen = strlen(username) + 1;
NGConstant *ng = new_ng(ng_type, n_hex, g_hex);
struct SRPVerifier *ver = 0;
@ -922,13 +912,11 @@ size_t srp_user_get_session_key_length(struct SRPUser *usr)
return hash_length(usr->hash_alg);
}
// clang-format off
/* Output: username, bytes_A, len_A */
SRP_Result srp_user_start_authentication(struct SRPUser *usr, char **username,
const unsigned char *bytes_a, size_t len_a,
unsigned char **bytes_A, size_t *len_A)
{
// clang-format on
if (bytes_a) {
mpz_from_bin(bytes_a, len_a, usr->a);
} else {
@ -956,7 +944,6 @@ error_and_exit:
return SRP_ERR;
}
// clang-format off
/* Output: bytes_M. Buffer length is SHA512_DIGEST_LENGTH */
void srp_user_process_challenge(struct SRPUser *usr,
const unsigned char *bytes_s, size_t len_s,
@ -972,7 +959,6 @@ void srp_user_process_challenge(struct SRPUser *usr,
mpz_t tmp2; mpz_init(tmp2);
mpz_t tmp3; mpz_init(tmp3);
mpz_t tmp4; mpz_init(tmp4);
// clang-format on
*len_M = 0;
*bytes_M = 0;
@ -996,7 +982,6 @@ void srp_user_process_challenge(struct SRPUser *usr,
srp_dbg_num(v, "Client calculated v: ");
// clang-format off
/* S = (B - k*(g^x)) ^ (a + ux) */
mpz_mul(tmp1, u, x);
mpz_add(tmp2, usr->a, tmp1); /* tmp2 = (a + ux) */
@ -1004,7 +989,6 @@ void srp_user_process_challenge(struct SRPUser *usr,
mpz_mulm(tmp3, k, tmp1, usr->ng->N, tmp4); /* tmp3 = k*(g^x) */
mpz_subm(tmp1, B, tmp3, usr->ng->N, tmp4); /* tmp1 = (B - K*(g^x)) */
mpz_powm(usr->S, tmp1, tmp2, usr->ng->N);
// clang-format on
if (!hash_num(usr->hash_alg, usr->S, usr->session_key)) goto cleanup_and_exit;

View file

@ -79,8 +79,6 @@ typedef enum {
SRP_OK,
} SRP_Result;
// clang-format off
/* Sets the memory functions used by srp.
* Note: this doesn't set the memory functions used by gmp,
* but it is supported to have different functions for srp and gmp.
@ -130,8 +128,6 @@ struct SRPVerifier* srp_verifier_new(SRP_HashAlgorithm alg, SRP_NGType ng_type,
unsigned char** bytes_B, size_t *len_B,
const char* n_hex, const char* g_hex);
// clang-format on
void srp_verifier_delete(struct SRPVerifier *ver);
// srp_verifier_verify_session must have been called before
@ -170,8 +166,6 @@ const unsigned char *srp_user_get_session_key(struct SRPUser *usr, size_t *key_l
size_t srp_user_get_session_key_length(struct SRPUser *usr);
// clang-format off
/* Output: username, bytes_A, len_A.
* If you don't want it get written, set username to NULL.
* If bytes_a == NULL, random data is used for a. */
@ -185,7 +179,6 @@ void srp_user_process_challenge(struct SRPUser *usr,
const unsigned char *bytes_s, size_t len_s,
const unsigned char *bytes_B, size_t len_B,
unsigned char **bytes_M, size_t *len_M);
// clang-format on
/* bytes_HAMK must be exactly srp_user_get_session_key_length() bytes in size */
void srp_user_verify_session(struct SRPUser *usr, const unsigned char *bytes_HAMK);