r24801 by jghali - Rename byte() to to_byte() in order to avoid potential conflict with std::byte in c++17 mode

scribus-commit scribus-commit at lists.scribus.net
Mon Jan 10 20:38:52 UTC 2022


Author: jghali
Date: Mon Jan 10 20:38:51 2022
New Revision: 24801

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=24801
Log:
Rename byte() to to_byte() in order to avoid potential conflict with std::byte in c++17 mode

Modified:
    trunk/Scribus/scribus/third_party/prc/oPRCFile.cc

Modified: trunk/Scribus/scribus/third_party/prc/oPRCFile.cc
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24801&path=/trunk/Scribus/scribus/third_party/prc/oPRCFile.cc
==============================================================================
--- trunk/Scribus/scribus/third_party/prc/oPRCFile.cc	(original)
+++ trunk/Scribus/scribus/third_party/prc/oPRCFile.cc	Mon Jan 10 20:38:51 2022
@@ -74,7 +74,7 @@
 using namespace std;
 
 // Map [0,1] to [0,255]
-inline uint8_t byte(double r) 
+inline uint8_t to_byte(double r) 
 {
   if(r < 0.0) r=0.0;
   else if(r > 1.0) r=1.0;
@@ -449,9 +449,9 @@
               }
               if(!same_color && i>0)
               {
-                tess->rgba_vertices.push_back(byte(lit->color.red));
-                tess->rgba_vertices.push_back(byte(lit->color.green));
-                tess->rgba_vertices.push_back(byte(lit->color.blue));
+                tess->rgba_vertices.push_back(to_byte(lit->color.red));
+                tess->rgba_vertices.push_back(to_byte(lit->color.green));
+                tess->rgba_vertices.push_back(to_byte(lit->color.blue));
               }
             }
           }
@@ -593,23 +593,23 @@
           triangles++;
           if(!same_colour)
           {
-            tessFace->rgba_vertices.push_back(byte(C[1].R));
-            tessFace->rgba_vertices.push_back(byte(C[1].G));
-            tessFace->rgba_vertices.push_back(byte(C[1].B));
+            tessFace->rgba_vertices.push_back(to_byte(C[1].R));
+            tessFace->rgba_vertices.push_back(to_byte(C[1].G));
+            tessFace->rgba_vertices.push_back(to_byte(C[1].B));
             if(tessFace->is_rgba)
-              tessFace->rgba_vertices.push_back(byte(C[1].A));
+              tessFace->rgba_vertices.push_back(to_byte(C[1].A));
             
-            tessFace->rgba_vertices.push_back(byte(C[2].R));
-            tessFace->rgba_vertices.push_back(byte(C[2].G));
-            tessFace->rgba_vertices.push_back(byte(C[2].B));
+            tessFace->rgba_vertices.push_back(to_byte(C[2].R));
+            tessFace->rgba_vertices.push_back(to_byte(C[2].G));
+            tessFace->rgba_vertices.push_back(to_byte(C[2].B));
             if(tessFace->is_rgba)
-              tessFace->rgba_vertices.push_back(byte(C[2].A));
+              tessFace->rgba_vertices.push_back(to_byte(C[2].A));
             
-            tessFace->rgba_vertices.push_back(byte(C[3].R));
-            tessFace->rgba_vertices.push_back(byte(C[3].G));
-            tessFace->rgba_vertices.push_back(byte(C[3].B));
+            tessFace->rgba_vertices.push_back(to_byte(C[3].R));
+            tessFace->rgba_vertices.push_back(to_byte(C[3].G));
+            tessFace->rgba_vertices.push_back(to_byte(C[3].B));
             if(tessFace->is_rgba)
-              tessFace->rgba_vertices.push_back(byte(C[3].A));
+              tessFace->rgba_vertices.push_back(to_byte(C[3].A));
           }
         }
         else
@@ -620,23 +620,23 @@
           triangles++;
           if(!same_colour)
           {
-            tessFace->rgba_vertices.push_back(byte(C[0].R));
-            tessFace->rgba_vertices.push_back(byte(C[0].G));
-            tessFace->rgba_vertices.push_back(byte(C[0].B));
+            tessFace->rgba_vertices.push_back(to_byte(C[0].R));
+            tessFace->rgba_vertices.push_back(to_byte(C[0].G));
+            tessFace->rgba_vertices.push_back(to_byte(C[0].B));
             if(tessFace->is_rgba)
-              tessFace->rgba_vertices.push_back(byte(C[0].A));
+              tessFace->rgba_vertices.push_back(to_byte(C[0].A));
             
-            tessFace->rgba_vertices.push_back(byte(C[2].R));
-            tessFace->rgba_vertices.push_back(byte(C[2].G));
-            tessFace->rgba_vertices.push_back(byte(C[2].B));
+            tessFace->rgba_vertices.push_back(to_byte(C[2].R));
+            tessFace->rgba_vertices.push_back(to_byte(C[2].G));
+            tessFace->rgba_vertices.push_back(to_byte(C[2].B));
             if(tessFace->is_rgba)
-              tessFace->rgba_vertices.push_back(byte(C[2].A));
+              tessFace->rgba_vertices.push_back(to_byte(C[2].A));
             
-            tessFace->rgba_vertices.push_back(byte(C[3].R));
-            tessFace->rgba_vertices.push_back(byte(C[3].G));
-            tessFace->rgba_vertices.push_back(byte(C[3].B));
+            tessFace->rgba_vertices.push_back(to_byte(C[3].R));
+            tessFace->rgba_vertices.push_back(to_byte(C[3].G));
+            tessFace->rgba_vertices.push_back(to_byte(C[3].B));
             if(tessFace->is_rgba)
-              tessFace->rgba_vertices.push_back(byte(C[3].A));
+              tessFace->rgba_vertices.push_back(to_byte(C[3].A));
           }
           tess->triangulated_index.push_back(vertex_indices[3]);
           tess->triangulated_index.push_back(vertex_indices[1]);
@@ -644,23 +644,23 @@
           triangles++;
           if(!same_colour)
           {
-            tessFace->rgba_vertices.push_back(byte(C[3].R));
-            tessFace->rgba_vertices.push_back(byte(C[3].G));
-            tessFace->rgba_vertices.push_back(byte(C[3].B));
+            tessFace->rgba_vertices.push_back(to_byte(C[3].R));
+            tessFace->rgba_vertices.push_back(to_byte(C[3].G));
+            tessFace->rgba_vertices.push_back(to_byte(C[3].B));
             if(tessFace->is_rgba)
-              tessFace->rgba_vertices.push_back(byte(C[3].A));
+              tessFace->rgba_vertices.push_back(to_byte(C[3].A));
           
-            tessFace->rgba_vertices.push_back(byte(C[1].R));
-            tessFace->rgba_vertices.push_back(byte(C[1].G));
-            tessFace->rgba_vertices.push_back(byte(C[1].B));
+            tessFace->rgba_vertices.push_back(to_byte(C[1].R));
+            tessFace->rgba_vertices.push_back(to_byte(C[1].G));
+            tessFace->rgba_vertices.push_back(to_byte(C[1].B));
             if(tessFace->is_rgba)
-              tessFace->rgba_vertices.push_back(byte(C[1].A));
+              tessFace->rgba_vertices.push_back(to_byte(C[1].A));
           
-            tessFace->rgba_vertices.push_back(byte(C[0].R));
-            tessFace->rgba_vertices.push_back(byte(C[0].G));
-            tessFace->rgba_vertices.push_back(byte(C[0].B));
+            tessFace->rgba_vertices.push_back(to_byte(C[0].R));
+            tessFace->rgba_vertices.push_back(to_byte(C[0].G));
+            tessFace->rgba_vertices.push_back(to_byte(C[0].B));
             if(tessFace->is_rgba)
-              tessFace->rgba_vertices.push_back(byte(C[0].A));
+              tessFace->rgba_vertices.push_back(to_byte(C[0].A));
           }
         }
       }
@@ -1648,21 +1648,21 @@
     tessFace->rgba_vertices.reserve((tessFace->is_rgba?4:3)*3*nI);
     for(uint32_t i=0; i<nI; i++)
     {
-       tessFace->rgba_vertices.push_back(byte(C[CI[i][0]].R));
-       tessFace->rgba_vertices.push_back(byte(C[CI[i][0]].G));
-       tessFace->rgba_vertices.push_back(byte(C[CI[i][0]].B));
+       tessFace->rgba_vertices.push_back(to_byte(C[CI[i][0]].R));
+       tessFace->rgba_vertices.push_back(to_byte(C[CI[i][0]].G));
+       tessFace->rgba_vertices.push_back(to_byte(C[CI[i][0]].B));
        if(tessFace->is_rgba)
-       tessFace->rgba_vertices.push_back(byte(C[CI[i][0]].A));
-       tessFace->rgba_vertices.push_back(byte(C[CI[i][1]].R));
-       tessFace->rgba_vertices.push_back(byte(C[CI[i][1]].G));
-       tessFace->rgba_vertices.push_back(byte(C[CI[i][1]].B));
+       tessFace->rgba_vertices.push_back(to_byte(C[CI[i][0]].A));
+       tessFace->rgba_vertices.push_back(to_byte(C[CI[i][1]].R));
+       tessFace->rgba_vertices.push_back(to_byte(C[CI[i][1]].G));
+       tessFace->rgba_vertices.push_back(to_byte(C[CI[i][1]].B));
        if(tessFace->is_rgba)
-       tessFace->rgba_vertices.push_back(byte(C[CI[i][1]].A));
-       tessFace->rgba_vertices.push_back(byte(C[CI[i][2]].R));
-       tessFace->rgba_vertices.push_back(byte(C[CI[i][2]].G));
-       tessFace->rgba_vertices.push_back(byte(C[CI[i][2]].B));
+       tessFace->rgba_vertices.push_back(to_byte(C[CI[i][1]].A));
+       tessFace->rgba_vertices.push_back(to_byte(C[CI[i][2]].R));
+       tessFace->rgba_vertices.push_back(to_byte(C[CI[i][2]].G));
+       tessFace->rgba_vertices.push_back(to_byte(C[CI[i][2]].B));
        if(tessFace->is_rgba)
-       tessFace->rgba_vertices.push_back(byte(C[CI[i][2]].A));
+       tessFace->rgba_vertices.push_back(to_byte(C[CI[i][2]].A));
     }
   }
   tess->addTessFace(tessFace);
@@ -1792,37 +1792,37 @@
     for(uint32_t i=0; i<nI; i++)
     {
        // first triangle
-       tessFace->rgba_vertices.push_back(byte(C[CI[i][0]].R));
-       tessFace->rgba_vertices.push_back(byte(C[CI[i][0]].G));
-       tessFace->rgba_vertices.push_back(byte(C[CI[i][0]].B));
+       tessFace->rgba_vertices.push_back(to_byte(C[CI[i][0]].R));
+       tessFace->rgba_vertices.push_back(to_byte(C[CI[i][0]].G));
+       tessFace->rgba_vertices.push_back(to_byte(C[CI[i][0]].B));
        if(tessFace->is_rgba)
-       tessFace->rgba_vertices.push_back(byte(C[CI[i][0]].A));
-       tessFace->rgba_vertices.push_back(byte(C[CI[i][1]].R));
-       tessFace->rgba_vertices.push_back(byte(C[CI[i][1]].G));
-       tessFace->rgba_vertices.push_back(byte(C[CI[i][1]].B));
+       tessFace->rgba_vertices.push_back(to_byte(C[CI[i][0]].A));
+       tessFace->rgba_vertices.push_back(to_byte(C[CI[i][1]].R));
+       tessFace->rgba_vertices.push_back(to_byte(C[CI[i][1]].G));
+       tessFace->rgba_vertices.push_back(to_byte(C[CI[i][1]].B));
        if(tessFace->is_rgba)
-       tessFace->rgba_vertices.push_back(byte(C[CI[i][1]].A));
-       tessFace->rgba_vertices.push_back(byte(C[CI[i][3]].R));
-       tessFace->rgba_vertices.push_back(byte(C[CI[i][3]].G));
-       tessFace->rgba_vertices.push_back(byte(C[CI[i][3]].B));
+       tessFace->rgba_vertices.push_back(to_byte(C[CI[i][1]].A));
+       tessFace->rgba_vertices.push_back(to_byte(C[CI[i][3]].R));
+       tessFace->rgba_vertices.push_back(to_byte(C[CI[i][3]].G));
+       tessFace->rgba_vertices.push_back(to_byte(C[CI[i][3]].B));
        if(tessFace->is_rgba)
-       tessFace->rgba_vertices.push_back(byte(C[CI[i][3]].A));
+       tessFace->rgba_vertices.push_back(to_byte(C[CI[i][3]].A));
        // second triangle
-       tessFace->rgba_vertices.push_back(byte(C[CI[i][1]].R));
-       tessFace->rgba_vertices.push_back(byte(C[CI[i][1]].G));
-       tessFace->rgba_vertices.push_back(byte(C[CI[i][1]].B));
+       tessFace->rgba_vertices.push_back(to_byte(C[CI[i][1]].R));
+       tessFace->rgba_vertices.push_back(to_byte(C[CI[i][1]].G));
+       tessFace->rgba_vertices.push_back(to_byte(C[CI[i][1]].B));
        if(tessFace->is_rgba)
-       tessFace->rgba_vertices.push_back(byte(C[CI[i][1]].A));
-       tessFace->rgba_vertices.push_back(byte(C[CI[i][2]].R));
-       tessFace->rgba_vertices.push_back(byte(C[CI[i][2]].G));
-       tessFace->rgba_vertices.push_back(byte(C[CI[i][2]].B));
+       tessFace->rgba_vertices.push_back(to_byte(C[CI[i][1]].A));
+       tessFace->rgba_vertices.push_back(to_byte(C[CI[i][2]].R));
+       tessFace->rgba_vertices.push_back(to_byte(C[CI[i][2]].G));
+       tessFace->rgba_vertices.push_back(to_byte(C[CI[i][2]].B));
        if(tessFace->is_rgba)
-       tessFace->rgba_vertices.push_back(byte(C[CI[i][2]].A));
-       tessFace->rgba_vertices.push_back(byte(C[CI[i][3]].R));
-       tessFace->rgba_vertices.push_back(byte(C[CI[i][3]].G));
-       tessFace->rgba_vertices.push_back(byte(C[CI[i][3]].B));
+       tessFace->rgba_vertices.push_back(to_byte(C[CI[i][2]].A));
+       tessFace->rgba_vertices.push_back(to_byte(C[CI[i][3]].R));
+       tessFace->rgba_vertices.push_back(to_byte(C[CI[i][3]].G));
+       tessFace->rgba_vertices.push_back(to_byte(C[CI[i][3]].B));
        if(tessFace->is_rgba)
-       tessFace->rgba_vertices.push_back(byte(C[CI[i][3]].A));
+       tessFace->rgba_vertices.push_back(to_byte(C[CI[i][3]].A));
     }
   }
   tess->addTessFace(tessFace);
@@ -1910,11 +1910,11 @@
     tess->rgba_vertices.reserve((tess->is_rgba?4:3)*nCI);
     for(uint32_t i=0; i<nCI; i++)
     {
-       tess->rgba_vertices.push_back(byte(C[CI[i]].R));
-       tess->rgba_vertices.push_back(byte(C[CI[i]].G));
-       tess->rgba_vertices.push_back(byte(C[CI[i]].B));
+       tess->rgba_vertices.push_back(to_byte(C[CI[i]].R));
+       tess->rgba_vertices.push_back(to_byte(C[CI[i]].G));
+       tess->rgba_vertices.push_back(to_byte(C[CI[i]].B));
        if(tess->is_rgba)
-       tess->rgba_vertices.push_back(byte(C[CI[i]].A));
+       tess->rgba_vertices.push_back(to_byte(C[CI[i]].A));
     }
   }
   const uint32_t tess_index = add3DWireTess(tess);




More information about the scribus-commit mailing list