[cmake-developers] Autogen subdirectories patches

Sebastian Holtermann seblist at xwmw.org
Wed Jul 27 11:49:40 EDT 2016


>> 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.

Some quick research (aka googling) revealed
http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_278
It seems '_' and '-' are safer choices.

>> +            // unexpected hexchar
>
> This raise an internal error, not just be a comment.

Is there an error exit function in CMake?
Or just exit(-1);

>> +          }
>> +        }
>> +        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.

Ok.

-Sebastian



More information about the cmake-developers mailing list