1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-07-22 17:18:39 +00:00

C++ modernize: Pragma once (#6264)

* Migrate cpp headers to pragma once
This commit is contained in:
Loïc Blot 2017-08-17 22:19:39 +02:00 committed by GitHub
parent c738d1eeab
commit 921151d97a
236 changed files with 288 additions and 1028 deletions

View file

@ -17,8 +17,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef AREA_STORE_H_
#define AREA_STORE_H_
#pragma once
#include "irr_v3d.h"
#include "noise.h" // for PcgRandom
@ -197,5 +196,3 @@ private:
};
#endif // USE_SPATIAL
#endif // AREA_STORE_H_

View file

@ -17,8 +17,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef AUTH_H
#define AUTH_H
#pragma once
/// Gets the base64 encoded legacy password db entry.
std::string translate_password(const std::string &name,
@ -46,5 +45,3 @@ std::string encode_srp_verifier(const std::string &verifier,
/// and salt components.
bool decode_srp_verifier_and_salt(const std::string &encoded,
std::string *verifier, std::string *salt);
#endif

View file

@ -1,10 +1,26 @@
#ifndef BASE64_HEADER
#define BASE64_HEADER
/*
Minetest
Copyright (C) 2013-2017 celeron55, Perttu Ahola <celeron55@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#pragma once
#include <string>
bool base64_is_valid(std::string const& s);
std::string base64_encode(unsigned char const* , unsigned int len);
std::string base64_decode(std::string const& s);
#endif // BASE64_HEADER

View file

@ -17,8 +17,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef BASICMACROS_HEADER
#define BASICMACROS_HEADER
#pragma once
#define ARRLEN(x) (sizeof(x) / sizeof((x)[0]))
@ -57,5 +56,3 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#define PP(x) "("<<(x).X<<","<<(x).Y<<","<<(x).Z<<")"
#define PP2(x) "("<<(x).X<<","<<(x).Y<<")"
#endif

View file

@ -17,8 +17,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef UTIL_CONTAINER_HEADER
#define UTIL_CONTAINER_HEADER
#pragma once
#include "../irrlichttypes.h"
#include "../exceptions.h"
@ -301,6 +300,3 @@ private:
// we can't use std::deque here, because its iterators get invalidated
std::list<K> m_queue;
};
#endif

View file

@ -17,8 +17,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef UTIL_DIRECTIONTABLES_HEADER
#define UTIL_DIRECTIONTABLES_HEADER
#pragma once
#include "../irrlichttypes.h"
#include "../irr_v3d.h"
@ -84,5 +83,3 @@ enum DirectionWallmounted {
DWM_ZP,
DWM_ZN,
};
#endif

View file

@ -17,8 +17,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef ENRICHEDSTRING_HEADER
#define ENRICHEDSTRING_HEADER
#pragma once
#include <string>
#include <vector>
@ -87,5 +86,3 @@ private:
bool m_has_background = false;
irr::video::SColor m_background;
};
#endif

View file

@ -17,8 +17,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef HEX_HEADER
#define HEX_HEADER
#pragma once
#include <string>
@ -57,5 +56,3 @@ static inline bool hex_digit_decode(char hexdigit, unsigned char &value)
return false;
return true;
}
#endif

View file

@ -17,8 +17,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef UTIL_NUMERIC_HEADER
#define UTIL_NUMERIC_HEADER
#pragma once
#include "basic_macros.h"
#include "../irrlichttypes.h"
@ -363,5 +362,3 @@ inline u32 npot2(u32 orig) {
orig |= orig >> 16;
return orig + 1;
}
#endif

View file

@ -17,8 +17,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef UTIL_POINTEDTHING_HEADER
#define UTIL_POINTEDTHING_HEADER
#pragma once
#include "../irrlichttypes.h"
#include "../irr_v3d.h"
@ -98,6 +97,3 @@ struct PointedThing
bool operator==(const PointedThing &pt2) const;
bool operator!=(const PointedThing &pt2) const;
};
#endif

View file

@ -17,8 +17,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef UTIL_POINTER_HEADER
#define UTIL_POINTER_HEADER
#pragma once
#include "../irrlichttypes.h"
#include "../debug.h" // For assert()
@ -227,6 +226,3 @@ inline SharedBuffer<u8> SharedBufferFromString(const char *string)
SharedBuffer<u8> b((u8*)string, strlen(string)+1);
return b;
}
#endif

View file

@ -17,8 +17,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef UTIL_SERIALIZE_HEADER
#define UTIL_SERIALIZE_HEADER
#pragma once
#include "../irrlichttypes_bloated.h"
#include "../exceptions.h" // for SerializationError
@ -657,5 +656,3 @@ inline void putRawData(std::vector<u8> *dest, const void *src, size_t len)
{
dest->insert(dest->end(), (u8 *)src, (u8 *)src + len);
}
#endif

View file

@ -24,7 +24,8 @@ SOFTWARE.
*/
#ifndef SHA1_HEADER
#pragma once
typedef unsigned int Uint32;
class SHA1
@ -51,6 +52,3 @@ public:
static void storeBigEndianUint32(unsigned char *byte, Uint32 num);
static void hexPrinter(unsigned char *c, int l);
};
#define SHA1_HEADER
#endif

View file

@ -56,8 +56,7 @@
* [including the GNU Public Licence.]
*/
#ifndef HEADER_SHA_H
#define HEADER_SHA_H
#pragma once
#include <stddef.h>
@ -153,5 +152,3 @@ void SHA256_Transform(SHA256_CTX *c, const unsigned char *data);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -53,8 +53,7 @@
* hash & prime number pairings.
*/
#ifndef SRP_H
#define SRP_H
#pragma once
struct SRPVerifier;
struct SRPUser;
@ -190,5 +189,3 @@ void srp_user_process_challenge(struct SRPUser *usr,
/* 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);
#endif /* Include Guard */

View file

@ -17,8 +17,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef STRFND_HEADER
#define STRFND_HEADER
#pragma once
#include <string>
@ -77,6 +76,3 @@ public:
typedef BasicStrfnd<char> Strfnd;
typedef BasicStrfnd<wchar_t> WStrfnd;
#endif

View file

@ -17,8 +17,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef UTIL_STRING_HEADER
#define UTIL_STRING_HEADER
#pragma once
#include "irrlichttypes_bloated.h"
#include <stdlib.h>
@ -648,6 +647,3 @@ inline const std::string duration_to_string(int sec)
return ss.str();
}
#endif

View file

@ -17,8 +17,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef UTIL_THREAD_HEADER
#define UTIL_THREAD_HEADER
#pragma once
#include "../irrlichttypes.h"
#include "../threading/thread.h"
@ -228,6 +227,3 @@ protected:
private:
Semaphore m_update_sem;
};
#endif

View file

@ -17,8 +17,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef UTIL_TIMETAKER_HEADER
#define UTIL_TIMETAKER_HEADER
#pragma once
#include "../irrlichttypes.h"
#include "../gettime.h"
@ -49,6 +48,3 @@ private:
TimePrecision m_precision;
u64 *m_result = nullptr;
};
#endif