Ticket #243: const.patch

File const.patch, 2.3 KB (added by Nicolas, 16 years ago)

str-util-const.patch

  • lib/str_util.C

     
    296296    return argc;
    297297}
    298298
    299 static char x2c(char *what) {
     299static char x2c(const char *what) {
    300300    register char digit;
    301301
    302302    digit = (what[0] >= 'A' ? ((what[0] & 0xdf) - 'A')+10 : (what[0] - '0'));
     
    391391    url = buf;
    392392}
    393393
    394 void escape_url(char *in, char*out) {
     394void escape_url(const char *in, char*out) {
    395395    int x, y;
    396396    for (x=0, y=0; in[x]; ++x) {
    397397        if (isalnum(in[x])) {
     
    442442// Escape a URL for the project directory, cutting off the "http://",
    443443// converting everthing other than alphanumbers, ., - and _ to "_".
    444444//
    445 void escape_url_readable(char *in, char* out) {
     445void escape_url_readable(const char *in, char* out) {
    446446    int x, y;
    447     char *temp;
     447    const char *temp;
    448448
    449449    temp = strstr(in,"://");
    450450    if (temp) {
     
    502502
    503503// is the string a valid master URL, in canonical form?
    504504//
    505 bool valid_master_url(char* buf) {
    506     char* p, *q;
     505bool valid_master_url(const char* buf) {
     506    const char *p, *q;
    507507    size_t n;
    508508        bool bSSL = false;
    509509
     
    593593    return buf;
    594594}
    595595
    596 void escape_project_url(char *in, char* out) {
     596void escape_project_url(const char *in, char* out) {
    597597    escape_url_readable(in, out);
    598598    char& last = out[strlen(out)-1];
    599599    // remove trailing _
  • lib/str_util.h

     
    5252extern void unescape_url(std::string& url);
    5353extern void unescape_url(char *url);
    5454extern void escape_url(std::string& url);
    55 extern void escape_url(char *in, char*out);
    56 extern void escape_url_readable(char* in, char* out);
    57 extern void escape_project_url(char *in, char* out);
    58 extern bool valid_master_url(char*);
     55extern void escape_url(const char *in, char*out);
     56extern void escape_url_readable(const char* in, char* out);
     57extern void escape_project_url(const char *in, char* out);
     58extern bool valid_master_url(const char*);
    5959extern void canonicalize_master_url(char *url);
    6060extern void canonicalize_master_url(std::string&);
    6161#define safe_strcpy(x, y) strlcpy(x, y, sizeof(x))