Author: tilman
Date: Sun Feb 23 08:39:48 2025
New Revision: 1923998
URL: http://svn.apache.org/viewvc?rev=1923998&view=rev
Log:
PDFBOX-5961: refactor
Modified:
pdfbox/branches/3.0/fontbox/src/main/java/org/apache/fontbox/cmap/CMap.java
Modified:
pdfbox/branches/3.0/fontbox/src/main/java/org/apache/fontbox/cmap/CMap.java
URL:
http://svn.apache.org/viewvc/pdfbox/branches/3.0/fontbox/src/main/java/org/apache/fontbox/cmap/CMap.java?rev=1923998&r1=1923997&r2=1923998&view=diff
==============================================================================
--- pdfbox/branches/3.0/fontbox/src/main/java/org/apache/fontbox/cmap/CMap.java
(original)
+++ pdfbox/branches/3.0/fontbox/src/main/java/org/apache/fontbox/cmap/CMap.java
Sun Feb 23 08:39:48 2025
@@ -350,24 +350,24 @@ public class CMap
*/
void addCharMapping(byte[] codes, String unicode)
{
- if (codes.length == 1)
+ switch (codes.length)
{
- charToUnicodeOneByte.put(CMapStrings.getIndexValue(codes),
unicode);
- unicodeToByteCodes.put(unicode, CMapStrings.getByteValue(codes));
// clone needed, bytes is modified later
- }
- else if (codes.length == 2)
- {
- charToUnicodeTwoBytes.put(CMapStrings.getIndexValue(codes),
unicode);
- unicodeToByteCodes.put(unicode, CMapStrings.getByteValue(codes));
// clone needed, bytes is modified later
- }
- else if (codes.length == 3 || codes.length == 4)
- {
- charToUnicodeMoreBytes.put(toInt(codes), unicode);
- unicodeToByteCodes.put(unicode, codes.clone());
- }
- else
- {
- LOG.warn("Mappings with more than 4 bytes aren't supported yet");
+ case 1:
+ charToUnicodeOneByte.put(CMapStrings.getIndexValue(codes),
unicode);
+ unicodeToByteCodes.put(unicode,
CMapStrings.getByteValue(codes)); // clone needed, bytes is modified later
+ break;
+ case 2:
+ charToUnicodeTwoBytes.put(CMapStrings.getIndexValue(codes),
unicode);
+ unicodeToByteCodes.put(unicode,
CMapStrings.getByteValue(codes)); // clone needed, bytes is modified later
+ break;
+ case 3:
+ case 4:
+ charToUnicodeMoreBytes.put(toInt(codes), unicode);
+ unicodeToByteCodes.put(unicode, codes.clone());
+ break;
+ default:
+ LOG.warn("Mappings with more than 4 bytes aren't supported
yet");
+ break;
}
// fixme: ugly little hack
if (SPACE.equals(unicode))