[cmake-developers] Autogen subdirectories patches

Ben Boeckel ben.boeckel at kitware.com
Wed Jul 27 11:11:57 EDT 2016


On Tue, Jul 26, 2016 at 23:38:34 +0200, Sebastian Holtermann wrote:
> Doing so I found that Base64 allows '+' and '/' as characters which is 
> bad for directory names obviously.
> For now these characters get replaced with 'A' and 'B'.

'_' and '@' would be better replacements (with comments why they are
used) since 'A' and 'B' are already characters in Base64.

> +            // unexpected hexchar

This raise an internal error, not just be a comment.

> +          }
> +        }
> +        hashBytes[ii] = hbyte[0] | (hbyte[1] << 4);
> +      }
> +    }
> +    // Convert hash bytes to Base64 text string
> +    {
> +      std::vector<unsigned char> base64Bytes(hashBytes.size() * 2, 0);
> +      cmsysBase64_Encode(&hashBytes[0], hashBytes.size(), &base64Bytes[0], 0);
> +      checksumBase64 = reinterpret_cast<const char*>(&base64Bytes[0]);
> +      // Base64 allows '+' and '/' characters. Replace these.

This comment should indicate it is because the string is used as part of
a path and that these characters tend to cause problems in paths.

--Ben


More information about the cmake-developers mailing list