Skip to content

Commit ac8a680

Browse files
committed
From a contributor: Fix various compile warnings about questionable code
1 parent f9679dc commit ac8a680

File tree

11 files changed

+16
-31
lines changed

11 files changed

+16
-31
lines changed

jpilot-dump.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -776,6 +776,8 @@ static int dumptodo(void)
776776

777777
al = NULL;
778778
num = get_todos(&al, SORT_ASCENDING);
779+
if (num == 0)
780+
return (0);
779781

780782
for (tal=al; tal; tal = tal->next) {
781783
if ((tal->mtodo.rt != DELETED_PALM_REC) &&
@@ -1037,6 +1039,8 @@ static int dumpmemo(void)
10371039
al = NULL;
10381040
i = 0;
10391041
num = get_memos(&al, i);
1042+
if (num == 0)
1043+
return (0);
10401044

10411045
for (tal=al; tal; tal = tal->next) {
10421046
if ((tal->mmemo.rt != DELETED_PALM_REC) &&

jpilot-sync.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,7 @@ int main(int argc, char *argv[])
112112
/* enable internationalization(i18n) before printing any output */
113113
#if defined(ENABLE_NLS)
114114
# ifdef HAVE_LOCALE_H
115-
char *current_locale;
116-
current_locale = setlocale(LC_ALL, "");
115+
setlocale(LC_ALL, "");
117116
# endif
118117
bindtextdomain(EPN, LOCALEDIR);
119118
textdomain(EPN);

jpilot.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1538,11 +1538,6 @@ int main(int argc, char *argv[])
15381538
#endif
15391539
int pid;
15401540
int remote_sync = FALSE;
1541-
#if defined(ENABLE_NLS)
1542-
# ifdef HAVE_LOCALE_H
1543-
char *current_locale;
1544-
# endif
1545-
#endif
15461541

15471542
skip_plugins=FALSE;
15481543
skip_past_alarms=FALSE;
@@ -1561,7 +1556,7 @@ int main(int argc, char *argv[])
15611556
/* enable internationalization(i18n) before printing any output */
15621557
#if defined(ENABLE_NLS)
15631558
# ifdef HAVE_LOCALE_H
1564-
current_locale = setlocale(LC_ALL, "");
1559+
setlocale(LC_ALL, "");
15651560
# endif
15661561
bindtextdomain(EPN, LOCALEDIR);
15671562
textdomain(EPN);

libplugin.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,6 @@ int jp_pc_write(const char *DB_name, buf_rec *br)
318318
FILE *out;
319319
unsigned int next_unique_id;
320320
unsigned char packed_header[256];
321-
int len;
322321
char PC_name[FILENAME_MAX];
323322

324323
g_snprintf(PC_name, sizeof(PC_name), "%s.pc3", DB_name);
@@ -343,7 +342,7 @@ int jp_pc_write(const char *DB_name, buf_rec *br)
343342
header.rt=br->rt;
344343
header.attrib=br->attrib;
345344

346-
len = pack_header(&header, packed_header);
345+
pack_header(&header, packed_header);
347346
write_header(out, &header);
348347
fwrite(br->buf, header.rec_len, 1, out);
349348

@@ -756,9 +755,7 @@ static void jp_unpack_ntohl(unsigned long *l, unsigned char *src)
756755
static int pack_header(PC3RecordHeader *header, unsigned char *packed_header)
757756
{
758757
unsigned char *p;
759-
unsigned long l;
760758

761-
l=0;
762759
p=packed_header;
763760
/*
764761
* Header structure:

memo_gui.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -621,7 +621,7 @@ static void cb_memo_export_ok(GtkWidget *export_window, GtkWidget *clist,
621621
len=strlen(mmemo->memo.text) * 2 + 4;
622622
}
623623
if (len<256) len=256;
624-
printf("\"RAW %d %s\"\n", mmemo->attrib & 0x0F, memo_app_info.category.name[mmemo->attrib & 0x0F]);
624+
printf("\"RAW %d %s\"\n", mmemo->attrib & 0x0F, memo_app_info.category.name[mmemo->attrib & 0x0F]);
625625
utf = charset_p2newj(memo_app_info.category.name[mmemo->attrib & 0x0F], 16, char_set);
626626
str_to_csv_str(csv_text, utf);
627627
fprintf(out, "\"Memos > %s\"\n", csv_text);

otherconv.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,6 @@ void otherconv_free(void)
165165
*/
166166
char *other_to_UTF(const char *buf, int buf_len)
167167
{
168-
size_t rc;
169168
char *outbuf;
170169
gsize bytes_read;
171170
GError *err = NULL;
@@ -174,7 +173,7 @@ char *other_to_UTF(const char *buf, int buf_len)
174173
#ifdef OTHERCONV_DEBUG
175174
jp_logf(JP_LOG_DEBUG, "%s:%s reset iconv state...\n", __FILE__, __FUNCTION__);
176175
#endif
177-
rc = g_iconv(glob_frompda, NULL, NULL, NULL, NULL);
176+
g_iconv(glob_frompda, NULL, NULL, NULL, NULL);
178177
#ifdef OTHERCONV_DEBUG
179178
jp_logf(JP_LOG_DEBUG, "%s:%s converting [%s]\n", __FILE__, __FUNCTION__, buf);
180179
#endif

plugins.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ static int get_plugin_info(struct plugin_s *p, char *path)
239239
const char *err;
240240
char name[52];
241241
char db_name[52];
242-
int version, major_version, minor_version;
242+
int major_version, minor_version;
243243
void (*plugin_versionM)(int *major_version, int *minor_version);
244244

245245
p->full_path = NULL;
@@ -292,7 +292,6 @@ static int get_plugin_info(struct plugin_s *p, char *path)
292292
return EXIT_FAILURE;
293293
}
294294
plugin_versionM(&major_version, &minor_version);
295-
version=major_version*1000+minor_version;
296295
if ((major_version <= 0) && (minor_version < 99)) {
297296
jp_logf(JP_LOG_WARN, _("Plugin:[%s]\n"), path);
298297
jp_logf(JP_LOG_WARN, _("This plugin is version (%d.%d).\n"),

search_gui.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,6 @@ static int search_plugins(const char *needle, const GtkWidget *clist)
391391
GList *plugin_list, *temp_list;
392392
gchar *empty_line[] = { "","" };
393393
char str2[SEARCH_MAX_COLUMN_LEN+2];
394-
int found;
395394
int count;
396395
int case_sense;
397396
struct search_result *sr, *temp_sr;
@@ -401,7 +400,6 @@ static int search_plugins(const char *needle, const GtkWidget *clist)
401400
plugin_list = NULL;
402401
plugin_list = get_plugin_list();
403402

404-
found = 0;
405403
case_sense = GTK_TOGGLE_BUTTON(case_sense_checkbox)->active;
406404

407405
count = 0;

sync.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1162,7 +1162,6 @@ static int sync_fetch(int sd, unsigned int flags,
11621162
struct DBInfo info;
11631163
char db_copy_name[MAX_DBNAME];
11641164
GList *file_list;
1165-
GList *end_of_list;
11661165
int palmos_error;
11671166
int dbIndex;
11681167
pi_buffer_t *buffer;
@@ -1216,8 +1215,6 @@ static int sync_fetch(int sd, unsigned int flags,
12161215

12171216
rename_dbnames(palm_dbname);
12181217

1219-
end_of_list=NULL;
1220-
12211218
full_backup = flags & SYNC_FULL_BACKUP;
12221219

12231220
/* Fast sync still needs to fetch Saved Preferences before exiting */
@@ -1235,7 +1232,6 @@ static int sync_fetch(int sd, unsigned int flags,
12351232

12361233
start=cardno=0;
12371234
file_list=NULL;
1238-
end_of_list=NULL;
12391235

12401236
buffer = pi_buffer_new(32 * sizeof(struct DBInfo));
12411237

todo_gui.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1791,7 +1791,7 @@ void todo_clist_clear(GtkCList *clist)
17911791
void todo_update_clist(GtkWidget *clist, GtkWidget *tooltip_widget,
17921792
ToDoList **todo_list, int category, int main)
17931793
{
1794-
int num_entries, entries_shown, i;
1794+
int num_entries, entries_shown;
17951795
gchar *empty_line[] = { "","","","","" };
17961796
GdkPixmap *pixmap_note;
17971797
GdkPixmap *pixmap_check;
@@ -1852,7 +1852,7 @@ void todo_update_clist(GtkWidget *clist, GtkWidget *tooltip_widget,
18521852
comp_now=now->tm_year*380+now->tm_mon*31+now->tm_mday-1;
18531853

18541854
entries_shown=0;
1855-
for (temp_todo = *todo_list, i=0; temp_todo; temp_todo=temp_todo->next) {
1855+
for (temp_todo = *todo_list; temp_todo; temp_todo=temp_todo->next) {
18561856
if ( ((temp_todo->mtodo.attrib & 0x0F) != category) &&
18571857
category != CATEGORY_ALL) {
18581858
continue;
@@ -2177,8 +2177,6 @@ int todo_gui(GtkWidget *vbox, GtkWidget *hbox)
21772177
GtkWidget *vbox_temp;
21782178
GtkWidget *separator;
21792179
GtkWidget *label;
2180-
time_t ltime;
2181-
struct tm *now;
21822180
char str[MAX_RADIO_BUTTON_LEN];
21832181
int i;
21842182
GSList *group;
@@ -2249,8 +2247,8 @@ int todo_gui(GtkWidget *vbox, GtkWidget *hbox)
22492247
separator = gtk_hseparator_new();
22502248
gtk_box_pack_start(GTK_BOX(vbox1), separator, FALSE, FALSE, 5);
22512249

2252-
time(&ltime);
2253-
now = localtime(&ltime);
2250+
//time(&ltime);
2251+
//now = localtime(&ltime);
22542252

22552253
/* Make the 'Today is:' label */
22562254
glob_date_label = gtk_label_new(" ");

0 commit comments

Comments
 (0)