Add const (from a patch by Stephan Kulow <coolo@kde.org>)
authorJelmer Vernooij <jelmer@samba.org>
Wed, 2 Apr 2003 17:04:33 +0000 (17:04 +0000)
committerJelmer Vernooij <jelmer@samba.org>
Wed, 2 Apr 2003 17:04:33 +0000 (17:04 +0000)
(This used to be commit 8b5ad24231e5001e612c5fd4bbde2762caef5856)

source3/include/libsmbclient.h
source3/libsmb/libsmb_cache.c
source3/libsmb/libsmbclient.c

index 0c905edcbcc6053419e01e1f88a56f9ccbc4bcf7..a9f83cfbd3495aca7ed8297ad90f3edec9633839 100644 (file)
@@ -257,8 +257,8 @@ typedef int (*smbc_remove_unused_server_fn)(SMBCCTX * c, SMBCSRV *srv);
  *
  */ 
 typedef int (*smbc_add_cached_srv_fn)   (SMBCCTX * c, SMBCSRV *srv, 
-                                   char * server, char * share, 
-                                   char * workgroup, char * username);
+                                   const char * server, const char * share, 
+                                   const char * workgroup, const char * username);
 
 
 /**@ingroup callback
@@ -277,8 +277,9 @@ typedef int (*smbc_add_cached_srv_fn)   (SMBCCTX * c, SMBCSRV *srv,
  * @return          pointer to SMBCSRV on success. NULL on failure.
  *
  */ 
-typedef SMBCSRV * (*smbc_get_cached_srv_fn)   (SMBCCTX * c, char * server, 
-                                              char * share, char * workgroup, char * username);
+typedef SMBCSRV * (*smbc_get_cached_srv_fn)  (SMBCCTX * c, const char * server, 
+                                              const char * share, const char * workgroup, 
+                                                  const char * username);
 
 
 /**@ingroup callback
index b1620042f38e737c02a96cd44d5fd574a6dbce24..67dc686b4871ddbef5902dc7abbff8b47ca70775 100644 (file)
@@ -50,8 +50,8 @@ struct smbc_server_cache {
  * This function is only used if the external cache is not enabled 
  */
 static int smbc_add_cached_server(SMBCCTX * context, SMBCSRV * new,
-                                 char * server, char * share, 
-                                 char * workgroup, char * username)
+                                 const char * server, const char * share, 
+                                 const char * workgroup, const char * username)
 {
        struct smbc_server_cache * srvcache = NULL;
 
@@ -108,8 +108,8 @@ static int smbc_add_cached_server(SMBCCTX * context, SMBCSRV * new,
  * returns server_fd on success, -1 on error (not found)
  * This function is only used if the external cache is not enabled 
  */
-static SMBCSRV * smbc_get_cached_server(SMBCCTX * context, char * server, 
-                                 char * share, char * workgroup, char * user)
+static SMBCSRV * smbc_get_cached_server(SMBCCTX * context, const char * server, 
+                                 const char * share, const char * workgroup, const char * user)
 {
        struct smbc_server_cache * srv = NULL;
        
index f74a0be7f3d8978d15a158062e6713b315881651..1da55ed4bdcd9aaad7367791e56e4cc173924073 100644 (file)
@@ -350,7 +350,7 @@ int smbc_remove_unused_server(SMBCCTX * context, SMBCSRV * srv)
  */
 
 SMBCSRV *smbc_server(SMBCCTX *context,
-                    char *server, char *share, 
+                    const char *server, const char *share, 
                     char *workgroup, char *username, 
                     char *password)
 {
@@ -358,7 +358,8 @@ SMBCSRV *smbc_server(SMBCCTX *context,
        int auth_called = 0;
        struct cli_state c;
        struct nmb_name called, calling;
-       char *p, *server_n = server;
+       char *p;
+       const char *server_n = server;
        fstring group;
        pstring ipenv;
        struct in_addr ip;
@@ -1524,27 +1525,27 @@ static SMBCFILE *smbc_opendir_ctx(SMBCCTX *context, const char *fname)
        if (!context || !context->internal ||
            !context->internal->_initialized) {
 
-           fprintf(stderr, "no valid context\n");
+           DEBUG(4, ("no valid context\n"));
                errno = EINVAL;
                return NULL;
 
        }
 
        if (!fname) {
-           fprintf(stderr, "no valid fname\n");
+               DEBUG(4, ("no valid fname\n"));
                errno = EINVAL;
                return NULL;
 
        }
 
        if (smbc_parse_path(context, fname, server, share, path, user, password)) {
-           fprintf(stderr, "no valid path\n");
+           DEBUG(4, ("no valid path\n"));
                errno = EINVAL;
                return NULL;
 
        }
 
-       fprintf(stderr, "parsed path: fname='%s' server='%s' share='%s' path='%s'\n", fname, server, share, path);
+       DEBUG(4, ("parsed path: fname='%s' server='%s' share='%s' path='%s'\n", fname, server, share, path));
 
        if (user[0] == (char)0) fstrcpy(user, context->user);
 
@@ -1571,10 +1572,10 @@ static SMBCFILE *smbc_opendir_ctx(SMBCCTX *context, const char *fname)
        if (server[0] == (char)0) {
            struct in_addr server_ip;
 
-           fprintf(stderr, "empty server\n");
+           DEBUG(4, ("empty server\n"));
 
                if (share[0] != (char)0 || path[0] != (char)0) {
-                   fprintf(stderr, "share %d path %d\n", share[0], path[0]);
+                   DEBUG(4,("share %d path %d\n", share[0], path[0]));
                        errno = EINVAL;
                        if (dir) {
                                SAFE_FREE(dir->fname);
@@ -2759,7 +2760,7 @@ SMBCCTX * smbc_init_context(SMBCCTX * context)
                        slprintf(context->netbios_name, 16, "smbc%s%d", context->user, pid);
                }
        }
-       DEBUG(0,("Using netbios name %s.\n", context->netbios_name));
+       DEBUG(1,("Using netbios name %s.\n", context->netbios_name));
        
 
        if (!context->workgroup) {
@@ -2771,7 +2772,7 @@ SMBCCTX * smbc_init_context(SMBCCTX * context)
                        context->workgroup = strdup("samba");
                }
        }
-       DEBUG(0,("Using workgroup %s.\n", context->workgroup));
+       DEBUG(1,("Using workgroup %s.\n", context->workgroup));
                                        
        /* shortest timeout is 1 second */
        if (context->timeout > 0 && context->timeout < 1000)