Cleanup: fix more comments/guards (and add check script).
authorCarl Hetherington <cth@carlh.net>
Tue, 6 Feb 2024 23:51:08 +0000 (00:51 +0100)
committerCarl Hetherington <cth@carlh.net>
Thu, 18 Apr 2024 10:11:43 +0000 (12:11 +0200)
21 files changed:
scripts/check-boilerplate [new file with mode: 0755]
src/asset_list.h
src/chromaticity.h
src/colour_conversion.h
src/dcp_time.h
src/interop_subtitle_asset.h
src/j2k_picture_asset_writer.h
src/language_tag.h
src/locale_convert.h
src/mono_j2k_picture_asset.h
src/mono_j2k_picture_frame.h
src/name_format.h
src/pkl.h
src/reel.h
src/reel_markers_asset.h
src/reel_smpte_subtitle_asset.h
src/rgb_xyz.h
src/stereo_j2k_picture_asset.h
src/stereo_j2k_picture_asset_reader.h
src/stereo_j2k_picture_frame.h
src/verify_j2k.h

diff --git a/scripts/check-boilerplate b/scripts/check-boilerplate
new file mode 100755 (executable)
index 0000000..311f95b
--- /dev/null
@@ -0,0 +1,23 @@
+#!/usr/bin/python
+
+import glob
+import os
+import sys
+
+for file in glob.glob('src/*.h'):
+    for line in open(file).readlines():
+        if line.find('@file') != -1:
+            filename = line.strip().split()[2]
+            if filename != file:
+                print(f'AWOOGA: {file} {filename}')
+                sys.exit(1)
+        elif line.find('ifndef') != -1:
+            guard = line.strip().split()[1]
+            if not guard.startswith('LIBDCP'):
+                print(f'AWOOGA: {file} {guard}')
+                sys.exit(1)
+            correct_guard = 'LIBDCP_' + os.path.basename(file).upper().replace('.', '_')
+            if guard != correct_guard:
+                print(f'AWOOGA: {file} {guard} {correct_guard}')
+                sys.exit(1)
+
index 5c50495d23a8b45233981c38e59d3a8dbf58618f..29563a8a0d95f67fbba439f5524830317687659c 100644 (file)
@@ -32,8 +32,8 @@
 */
 
 
-#ifndef DCP_ASSET_LIST_H
-#define DCP_ASSET_LIST_H
+#ifndef LIBDCP_ASSET_LIST_H
+#define LIBDCP_ASSET_LIST_H
 
 
 #include "types.h"
index 41bb8fdac52ce93c1e68d5a9a14b6a5b6ec8ab87..52edd7bfa3c01de4ba76108795954f5755ead170 100644 (file)
@@ -37,8 +37,8 @@
  */
 
 
-#ifndef DCP_CHROMATICITY_H
-#define DCP_CHROMATICITY_H
+#ifndef LIBDCP_CHROMATICITY_H
+#define LIBDCP_CHROMATICITY_H
 
 
 #include <cmath>
index 8501699a4af67ff5ffb1f91d148a13ddaa99de85..29140541c43165153f322ec2b40cd2498109d0c1 100644 (file)
@@ -37,8 +37,8 @@
  */
 
 
-#ifndef DCP_COLOUR_CONVERSION_H
-#define DCP_COLOUR_CONVERSION_H
+#ifndef LIBDCP_COLOUR_CONVERSION_H
+#define LIBDCP_COLOUR_CONVERSION_H
 
 
 #include "chromaticity.h"
index 506dafdafe857496f85f04517363f9cb8d219f1d..21b59921e478879b261f592ef72a6b77520f67c4 100644 (file)
@@ -37,8 +37,8 @@
  */
 
 
-#ifndef LIBDCP_TIME_H
-#define LIBDCP_TIME_H
+#ifndef LIBDCP_DCP_TIME_H
+#define LIBDCP_DCP_TIME_H
 
 
 #include "types.h"
index f63740d54fcbd4c793071f0ed68722b407bbcc63..ad1c68a7a7286a2a0ea3d0f6495f02ce5ecec527 100644 (file)
@@ -37,8 +37,8 @@
  */
 
 
-#ifndef DCP_INTEROP_SUBTITLE_ASSET_H
-#define DCP_INTEROP_SUBTITLE_ASSET_H
+#ifndef LIBDCP_INTEROP_SUBTITLE_ASSET_H
+#define LIBDCP_INTEROP_SUBTITLE_ASSET_H
 
 
 #include "subtitle_asset.h"
index d441c06d3917b29369c11f831d852bb3faebd23a..a6f5b6d2d821748ae48ce176136e966c64e9a094 100644 (file)
 */
 
 
-/** @file  src/picture_asset_writer.h
+/** @file  src/j2k_picture_asset_writer.h
  *  @brief J2KPictureAssetWriter and FrameInfo classes.
  */
 
 
-#ifndef LIBDCP_PICTURE_ASSET_WRITER_H
-#define LIBDCP_PICTURE_ASSET_WRITER_H
+#ifndef LIBDCP_J2K_PICTURE_ASSET_WRITER_H
+#define LIBDCP_J2K_PICTURE_ASSET_WRITER_H
 
 
 #include "asset_writer.h"
index 6f46c16bcadac3780e469b4fe99ad8a19f33cd97..3232dda9fd316faddfa2d356eac07b7c7e5c90e6 100644 (file)
@@ -32,7 +32,7 @@
 */
 
 
-/** @file  src/language_tag.cc
+/** @file  src/language_tag.h
  *  @brief LanguageTag class
  */
 
index 37510a96d32ca08e046335af1991b98e6147b3ed..1323e7042b63d6b696c9aadaff2b92e300dbc487 100644 (file)
@@ -32,7 +32,7 @@
 */
 
 
-/** @file  src/locale_convert.cc
+/** @file  src/locale_convert.h
  *  @brief Methods to convert to/from string using the current locale
  */
 
index f7cae5dc5e635a266d7be101a5ddb8dcaa0143fb..d716b8ff0c7fdb951b4fd7110d8a86c209a861af 100644 (file)
@@ -37,8 +37,8 @@
  */
 
 
-#ifndef LIBDCP_J2K_MONO_PICTURE_ASSET_H
-#define LIBDCP_J2K_MONO_PICTURE_ASSET_H
+#ifndef LIBDCP_MONO_J2K_PICTURE_ASSET_H
+#define LIBDCP_MONO_J2K_PICTURE_ASSET_H
 
 
 #include "j2k_picture_asset.h"
index 4459a3edc57eff1d53e2e113f9cda1d717b1534f..f08e734360fb9d760714a99e070bc3b82581a42e 100644 (file)
 */
 
 
-/** @file  src/mono_picture_frame.h
+/** @file  src/mono_j2k_picture_frame.h
  *  @brief MonoJ2KPictureFrame class
  */
 
 
-#ifndef LIBDCP_MONO_PICTURE_FRAME_H
-#define LIBDCP_MONO_PICTURE_FRAME_H
+#ifndef LIBDCP_MONO_J2K_PICTURE_FRAME_H
+#define LIBDCP_MONO_J2K_PICTURE_FRAME_H
 
 
 #include "asset_reader.h"
index 6401fe8206ea3dd75d17465aa8859e88a91e3a39..3eb0277b6d720165cbf5c62cfa4cf763428d8456 100644 (file)
@@ -37,8 +37,8 @@
  */
 
 
-#ifndef LIBDCP_NAME_FORMAT
-#define LIBDCP_NAME_FORMAT
+#ifndef LIBDCP_NAME_FORMAT_H
+#define LIBDCP_NAME_FORMAT_H
 
 
 #include <string>
index d0a111887394478fcff17b0c60a0585fbb28ff95..8844305741344f65a3d87fa5b5b34e0d4f769edf 100644 (file)
--- a/src/pkl.h
+++ b/src/pkl.h
@@ -32,7 +32,7 @@
 */
 
 
-/** @file  src/pkl.cc
+/** @file  src/pkl.h
  *  @brief PKL class
  */
 
index 52f41bfaa5c670c83565650c1e98057587dce37f..df6d12a97ad8f83afdc1c7f54fe22dfcbd519854 100644 (file)
@@ -32,7 +32,7 @@
 */
 
 
-/** @file  src/reel.cc
+/** @file  src/reel.h
  *  @brief Reel class
  */
 
index 1e87957af917f4626996ce9e32a11ec1cbe4b4ec..e2b65585f0135ffb5ee2517470406bd3cf2de69e 100644 (file)
@@ -32,7 +32,7 @@
 */
 
 
-/** @file  src/reel_markers_asset.cc
+/** @file  src/reel_markers_asset.h
  *  @brief ReelMarkersAsset class
  */
 
index 2a097309ef452c3a3585ce7b620561ec2e6a3ec3..49b6000bdf827d4c3fd68b9fa20a49d5e422520a 100644 (file)
@@ -32,8 +32,8 @@
 */
 
 
-/** @file  src/reel_interop_subtitle_asset.h
- *  @brief ReelInteropSubtitleAsset class
+/** @file  src/reel_smpte_subtitle_asset.h
+ *  @brief ReelSMPTESubtitleAsset class
  */
 
 
index c41fdee0d104fb2c4888ca692cbed97417ae27c3..315295eaba0e1cd4edb1db598308bda2c913e67d 100644 (file)
@@ -32,7 +32,7 @@
 */
 
 
-/** @file  rgb_xyz.h
+/** @file  src/rgb_xyz.h
  *  @brief Conversion between RGB and XYZ
  */
 
index f4c5d9e01c1696fd263de1c086c499f5f2ec41c3..7ef86ec570caab7000d059129b1a194b3e4c520e 100644 (file)
 */
 
 
-/** @file  src/stereo_picture_asset.h
+/** @file  src/stereo_j2k_picture_asset.h
  *  @brief StereoJ2KPictureAsset class
  */
 
 
-#ifndef LIBDCP_STEREO_PICTURE_ASSET_H
-#define LIBDCP_STEREO_PICTURE_ASSET_H
+#ifndef LIBDCP_STEREO_J2K_PICTURE_ASSET_H
+#define LIBDCP_STEREO_J2K_PICTURE_ASSET_H
 
 
 #include "j2k_picture_asset.h"
index 5d1968e04b18880a6255a4c8aac088779c89b7bd..e4812a8eddb1e41f85e2366f5030b674e005b001 100644 (file)
 */
 
 
-/** @file  src/stereo_picture_asset_reader.h
+/** @file  src/stereo_j2k_picture_asset_reader.h
  *  @brief StereoJ2KPictureAssetReader typedef
  */
 
 
-#ifndef LIBDCP_STEREO_PICTURE_ASSET_READER_H
-#define LIBDCP_STEREO_PICTURE_ASSET_READER_H
+#ifndef LIBDCP_STEREO_J2K_PICTURE_ASSET_READER_H
+#define LIBDCP_STEREO_J2K_PICTURE_ASSET_READER_H
 
 
 #include "asset_reader.h"
index 0c171c66fa6370315eecee6d24b6d84c1fdb71ff..193960f3058691da09467e817d0d5723b3872945 100644 (file)
 */
 
 
-/** @file  src/stereo_picture_frame.h
+/** @file  src/stereo_j2k_picture_frame.h
  *  @brief StereoJ2KPictureFrame class
  */
 
 
-#ifndef LIBDCP_STEREO_PICTURE_FRAME_H
-#define LIBDCP_STEREO_PICTURE_FRAME_H
+#ifndef LIBDCP_STEREO_J2K_PICTURE_FRAME_H
+#define LIBDCP_STEREO_J2K_PICTURE_FRAME_H
 
 
 #include "asset_reader.h"
index 58c8f4b7efdfb03293c86e298033bcfc31155a1d..dbfc488be285abf30516b77258cd86de25a7e520 100644 (file)
@@ -37,8 +37,8 @@
  */
 
 
-#ifndef LIBDCP_VERIFY_J2K
-#define LIBDCP_VERIFY_J2K
+#ifndef LIBDCP_VERIFY_J2K_H
+#define LIBDCP_VERIFY_J2K_H
 
 
 #include "verify.h"