Fossil SCM

Fix a couple of C++-isms in my_page.c and tagview.c. Remove the return value from autosync().

drh 2008-05-07 17:38 trunk
Commit 908009fdc446c4c3a109f70652b431fdd149db19
3 files changed +8 -4 +4 -6 +1 -1
+8 -4
--- src/my_page.c
+++ src/my_page.c
@@ -80,16 +80,19 @@
8080
{
8181
int uid = g.userUid;
8282
char * sql = mprintf( "SELECT login,cap,info FROM user WHERE uid=%d",
8383
uid );
8484
Stmt st;
85
+ char const *uname;
86
+ char const *ucap;
87
+ char const *uinfo;
8588
db_prepare( &st, sql );
8689
free( sql );
8790
db_step(&st);
88
- char const * uname = db_column_text( &st, 0 );
89
- char const * ucap = db_column_text( &st, 1 );
90
- char const * uinfo = db_column_text( &st, 2 );
91
+ uname = db_column_text( &st, 0 );
92
+ ucap = db_column_text( &st, 1 );
93
+ uinfo = db_column_text( &st, 2 );
9194
9295
@ <h2>Welcome, %s(uname)!</h2>
9396
@ Your user ID is: %d(uid)<br/>
9497
@ Your Fossil permissions are: [%s(ucap)]
9598
@ [TODO: explain these]<br/>
@@ -125,16 +128,17 @@
125128
126129
/*
127130
** WEBPAGE: /my
128131
*/
129132
void mypage_page(void){
133
+ const char *name;
130134
login_check_credentials();
131135
if( !g.okRdWiki ){
132136
login_needed();
133137
}
134138
style_header("Your Home");
135
- char const * name = P("name");
139
+ name = P("name");
136140
if( name )
137141
{
138142
if( 0 == strcmp(name,"tickets") )
139143
{
140144
@ TODO: Tickets page.
141145
--- src/my_page.c
+++ src/my_page.c
@@ -80,16 +80,19 @@
80 {
81 int uid = g.userUid;
82 char * sql = mprintf( "SELECT login,cap,info FROM user WHERE uid=%d",
83 uid );
84 Stmt st;
 
 
 
85 db_prepare( &st, sql );
86 free( sql );
87 db_step(&st);
88 char const * uname = db_column_text( &st, 0 );
89 char const * ucap = db_column_text( &st, 1 );
90 char const * uinfo = db_column_text( &st, 2 );
91
92 @ <h2>Welcome, %s(uname)!</h2>
93 @ Your user ID is: %d(uid)<br/>
94 @ Your Fossil permissions are: [%s(ucap)]
95 @ [TODO: explain these]<br/>
@@ -125,16 +128,17 @@
125
126 /*
127 ** WEBPAGE: /my
128 */
129 void mypage_page(void){
 
130 login_check_credentials();
131 if( !g.okRdWiki ){
132 login_needed();
133 }
134 style_header("Your Home");
135 char const * name = P("name");
136 if( name )
137 {
138 if( 0 == strcmp(name,"tickets") )
139 {
140 @ TODO: Tickets page.
141
--- src/my_page.c
+++ src/my_page.c
@@ -80,16 +80,19 @@
80 {
81 int uid = g.userUid;
82 char * sql = mprintf( "SELECT login,cap,info FROM user WHERE uid=%d",
83 uid );
84 Stmt st;
85 char const *uname;
86 char const *ucap;
87 char const *uinfo;
88 db_prepare( &st, sql );
89 free( sql );
90 db_step(&st);
91 uname = db_column_text( &st, 0 );
92 ucap = db_column_text( &st, 1 );
93 uinfo = db_column_text( &st, 2 );
94
95 @ <h2>Welcome, %s(uname)!</h2>
96 @ Your user ID is: %d(uid)<br/>
97 @ Your Fossil permissions are: [%s(ucap)]
98 @ [TODO: explain these]<br/>
@@ -125,16 +128,17 @@
128
129 /*
130 ** WEBPAGE: /my
131 */
132 void mypage_page(void){
133 const char *name;
134 login_check_credentials();
135 if( !g.okRdWiki ){
136 login_needed();
137 }
138 style_header("Your Home");
139 name = P("name");
140 if( name )
141 {
142 if( 0 == strcmp(name,"tickets") )
143 {
144 @ TODO: Tickets page.
145
+4 -6
--- src/sync.c
+++ src/sync.c
@@ -37,21 +37,20 @@
3737
#endif /* INTERFACE */
3838
3939
/*
4040
** If the respository is configured for autosyncing, then do an
4141
** autosync. This will be a pull if the argument is true or a push
42
-** if the argument is false. Return true if the autosync is done
43
-** and false if autosync is not requested for the current repository.
42
+** if the argument is false.
4443
*/
45
-int autosync(int flags){
44
+void autosync(int flags){
4645
const char *zUrl;
4746
if( db_get_boolean("autosync", 0)==0 ){
48
- return 0;
47
+ return;
4948
}
5049
zUrl = db_get("last-sync-url", 0);
5150
if( zUrl==0 ){
52
- return 0; /* No default server */
51
+ return; /* No default server */
5352
}
5453
url_parse(zUrl);
5554
if( g.urlIsFile ){
5655
return 0; /* Network sync only */
5756
}
@@ -60,11 +59,10 @@
6059
}else{
6160
printf("Autosync: http://%s%s\n", g.urlName, g.urlPath);
6261
}
6362
url_enable_proxy("via proxy: ");
6463
client_sync((flags & AUTOSYNC_PUSH)!=0, 1, 0);
65
- return 1;
6664
}
6765
6866
/*
6967
** This routine processes the command-line argument for push, pull,
7068
** and sync. If a command-line argument is given, that is the URL
7169
--- src/sync.c
+++ src/sync.c
@@ -37,21 +37,20 @@
37 #endif /* INTERFACE */
38
39 /*
40 ** If the respository is configured for autosyncing, then do an
41 ** autosync. This will be a pull if the argument is true or a push
42 ** if the argument is false. Return true if the autosync is done
43 ** and false if autosync is not requested for the current repository.
44 */
45 int autosync(int flags){
46 const char *zUrl;
47 if( db_get_boolean("autosync", 0)==0 ){
48 return 0;
49 }
50 zUrl = db_get("last-sync-url", 0);
51 if( zUrl==0 ){
52 return 0; /* No default server */
53 }
54 url_parse(zUrl);
55 if( g.urlIsFile ){
56 return 0; /* Network sync only */
57 }
@@ -60,11 +59,10 @@
60 }else{
61 printf("Autosync: http://%s%s\n", g.urlName, g.urlPath);
62 }
63 url_enable_proxy("via proxy: ");
64 client_sync((flags & AUTOSYNC_PUSH)!=0, 1, 0);
65 return 1;
66 }
67
68 /*
69 ** This routine processes the command-line argument for push, pull,
70 ** and sync. If a command-line argument is given, that is the URL
71
--- src/sync.c
+++ src/sync.c
@@ -37,21 +37,20 @@
37 #endif /* INTERFACE */
38
39 /*
40 ** If the respository is configured for autosyncing, then do an
41 ** autosync. This will be a pull if the argument is true or a push
42 ** if the argument is false.
 
43 */
44 void autosync(int flags){
45 const char *zUrl;
46 if( db_get_boolean("autosync", 0)==0 ){
47 return;
48 }
49 zUrl = db_get("last-sync-url", 0);
50 if( zUrl==0 ){
51 return; /* No default server */
52 }
53 url_parse(zUrl);
54 if( g.urlIsFile ){
55 return 0; /* Network sync only */
56 }
@@ -60,11 +59,10 @@
59 }else{
60 printf("Autosync: http://%s%s\n", g.urlName, g.urlPath);
61 }
62 url_enable_proxy("via proxy: ");
63 client_sync((flags & AUTOSYNC_PUSH)!=0, 1, 0);
 
64 }
65
66 /*
67 ** This routine processes the command-line argument for push, pull,
68 ** and sync. If a command-line argument is given, that is the URL
69
+1 -1
--- src/tagview.c
+++ src/tagview.c
@@ -139,19 +139,19 @@
139139
140140
/*
141141
** WEBPAGE: /tagview
142142
*/
143143
void tagview_page(void){
144
+ char const * check = 0;
144145
login_check_credentials();
145146
if( !g.okRdWiki ){
146147
login_needed();
147148
}
148149
style_header("Tags");
149150
login_anonymous_available();
150151
tagview_page_search_miniform();
151152
@ <hr/>
152
- char const * check = 0;
153153
if( 0 != (check = P("tagid")) ){
154154
tagview_page_tag_by_id( atoi(check) );
155155
}else if( 0 != (check = P("like")) ){
156156
tagview_page_list_tags( check );
157157
}else if( 0 != (check = P("name")) ){
158158
--- src/tagview.c
+++ src/tagview.c
@@ -139,19 +139,19 @@
139
140 /*
141 ** WEBPAGE: /tagview
142 */
143 void tagview_page(void){
 
144 login_check_credentials();
145 if( !g.okRdWiki ){
146 login_needed();
147 }
148 style_header("Tags");
149 login_anonymous_available();
150 tagview_page_search_miniform();
151 @ <hr/>
152 char const * check = 0;
153 if( 0 != (check = P("tagid")) ){
154 tagview_page_tag_by_id( atoi(check) );
155 }else if( 0 != (check = P("like")) ){
156 tagview_page_list_tags( check );
157 }else if( 0 != (check = P("name")) ){
158
--- src/tagview.c
+++ src/tagview.c
@@ -139,19 +139,19 @@
139
140 /*
141 ** WEBPAGE: /tagview
142 */
143 void tagview_page(void){
144 char const * check = 0;
145 login_check_credentials();
146 if( !g.okRdWiki ){
147 login_needed();
148 }
149 style_header("Tags");
150 login_anonymous_available();
151 tagview_page_search_miniform();
152 @ <hr/>
 
153 if( 0 != (check = P("tagid")) ){
154 tagview_page_tag_by_id( atoi(check) );
155 }else if( 0 != (check = P("like")) ){
156 tagview_page_list_tags( check );
157 }else if( 0 != (check = P("name")) ){
158

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button