]> granicus.if.org Git - graphviz/commitdiff
clang-format fc-fix.cpp
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Fri, 1 Apr 2022 00:41:55 +0000 (17:41 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 2 Apr 2022 22:52:08 +0000 (15:52 -0700)
Given the prior commit rewrote every byte in this file, we may as well also fix
the odd white space decisions here while we are at it. Though it is unclear who
if anyone uses this tool any more.

ci/clang_format.py
windows/cmd/fc-fix/fc-fix.cpp

index a1c03656ec462ab45eea7ba19610d680677185c0..f6c235245c7454d3ef15656030e2b3f0f3ca407e 100644 (file)
@@ -875,7 +875,6 @@ EXCLUDE = (
   "tclpkg/tkstubs/tkStubImg.c",
   "tclpkg/tkstubs/tkStubLib.c",
   "tests/unit_tests/lib/common/command_line.c",
-  "windows/cmd/fc-fix/fc-fix.cpp",
   "windows/cmd/lefty/dot2l/dotparse.c",
   "windows/cmd/lefty/dot2l/dotparse.h",
   "windows/gvedit/Application.h",
index ec9b28424ebd844be8106934ae8539113ccb8330..18901ab15b0d4f4e088b87af5b940a646de9cef0 100644 (file)
-//---------------------------------------------------------------------------
-
-
-
-#include <windows.h>
-
-#include <stdio.h>
-
+#include "fc-fix.h"
+#include <fstream>
+#include <iostream>
 #include <shellapi.h>
-
 #include <shlobj.h>
-
-#include <string>
-
+#include <stdio.h>
 #include <string.h>
-
-#include <iostream>
-
-#include <fstream>
-
-#include "fc-fix.h"
-
-
-
-
+#include <string>
+#include <windows.h>
 
 using namespace std;
 
-
-
-
-
-
-
 #pragma hdrstop
 
-
-
-
-
-//---------------------------------------------------------------------------
-
-
-
-
-
 /*
-
-        To have fontconfig work right , it requires some config files located at \\etc\\fonts\\ of
-
-        where fc functions are called .We also need to insert windows font directory to fc config file
-
+        To have fontconfig work right , it requires some config files located at
+   \\etc\\fonts\\ of
+        where fc functions are called .We also need to insert windows font
+   directory to fc config file
 */
 
+int fix_fontconfig(TCHAR *baseDir) {
+  char B[1024];
+  string FontFolder = "";
+  string fcConfigFile = "";
+  string BB = "";
 
+  // retrieve font directory
+  ::SHGetSpecialFolderPath(NULL, B, CSIDL_FONTS, 0);
 
-int fix_fontconfig(TCHAR* baseDir)
-
-{
-
-        char B[1024];
-
-        string FontFolder="";
-
-        string fcConfigFile="";
-
-               string BB="";
-
-               //retrieve font directory
-
-               ::SHGetSpecialFolderPath( NULL,B , CSIDL_FONTS , 0 );
-
-                //check if directory already exists
-
-
-
-               //set fc config file
-
-               fcConfigFile.append(baseDir);
+  // check if directory already exists
+  // set fc config file
+  fcConfigFile.append(baseDir);
+  fcConfigFile.append("\\etc\\fonts\\fonts.conf");
 
-               fcConfigFile.append("\\etc\\fonts\\fonts.conf");
+  cout << fcConfigFile;
 
-               cout << fcConfigFile;
+  ifstream file(fcConfigFile.c_str(), ios::in);
+  try {
+    if (file) {
+      while (!file.eof()) {
+        BB.push_back(file.get());
+      }
+      file.close();
 
-               
+      //                cout << BB;
 
-               ifstream file (fcConfigFile.c_str(),ios::in);
-
-               try{
-
-
-
-             if (file)
-
-               {
-
-                       while (!file.eof())
-
-                       {
-
-                               BB.push_back(file.get());
-
-                       }
-
-                       file.close();
-
-       //               cout << BB;
-
-       //               cout << "\n" <<"position of found text:" <<BB.find("#WINDOWSFONTDIR#",0 );
-
-                       size_t a=BB.find("#WINDOWSFONTDIR#",0 );
-
-                       if (a !=string::npos)
-
-                               BB.replace ( a , strlen(B),B );
-
-                       std::ofstream out(fcConfigFile.c_str());
-
-                       out<< BB <<'\n';
-
-                       out.close();
-
-
-
-               }
-
-               }
-
-               catch (...)
-
-               {
-
-
-
-                   ;
-
-
-
-               }
-
-               return 0;
+      //                cout << "\n" <<"position of found text:"
+      //<<BB.find("#WINDOWSFONTDIR#",0 );
 
+      size_t a = BB.find("#WINDOWSFONTDIR#", 0);
+      if (a != string::npos)
+        BB.replace(a, strlen(B), B);
 
+      std::ofstream out(fcConfigFile.c_str());
+      out << BB << '\n';
+      out.close();
+    }
+  } catch (...) {
+    ;
+  }
 
+  return 0;
 }
 
+UINT __stdcall fc_fix(MSIHANDLE hInstall) {
+  char vbuff[500] = {0};
+  DWORD vlen = 500;
 
+  UINT gp = MsiGetPropertyA(hInstall, "CustomActionData", vbuff, &vlen);
+  fix_fontconfig(vbuff);
 
-
-
-
-
-
-
-
-
-
-
-//---------------------------------------------------------------------------
-
-
-
-
-
-
-
-UINT __stdcall fc_fix (MSIHANDLE hInstall)
-
-{
-
-    char vbuff [500] = {0};
-
-    DWORD vlen = 500;
-
-    UINT gp = MsiGetPropertyA(hInstall, "CustomActionData", vbuff, &vlen);
-
-    fix_fontconfig(vbuff);
-
-    return 0;
-
+  return 0;
 }
-