1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-20 04:02:27 +00:00

*Cough cough*, declare variables before anything, because gcc 2.95.4

in RELENG_4 is not C99 compliant.
This commit is contained in:
Clive Lin 2004-11-21 13:42:25 +00:00
parent b3180215a4
commit c4a4284f05
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=122072
5 changed files with 213 additions and 0 deletions

View File

@ -0,0 +1,58 @@
--- src/minidict.c~ Sun Nov 21 20:58:43 2004
+++ src/minidict.c Sun Nov 21 21:00:12 2004
@@ -195,12 +195,12 @@
int do_CH_search(gchar word[256],int begin,int end)
{
- g_print("CH search \n");
int i ;
int flag=0;
//init 0
CH_line_index = 0;
+ g_print("CH search \n");
for(i=begin;i<=end;i++)
{
@@ -228,12 +228,12 @@
//search EN successfully,show result
void dict_show_EN_success()
{
- g_print("search successfully !\n");
gchar result_str[256];
gchar ps1_str[256];
gchar ps2_str[256];
gchar ps3_str[256];
+ g_print("search successfully !\n");
strcpy(result_str,"");
strcpy(ps1_str,"");
strcpy(ps2_str,"");
@@ -260,13 +260,13 @@
//search CH successfully,show result
void dict_show_CH_success()
{
- g_print("search successfully !\n");
int i;
struct line_st myline;
gchar result_str[256];
gchar ps1_str[256];
+ g_print("search successfully !\n");
strcpy(result_str,"");
strcpy(ps1_str,"");
@@ -315,11 +315,10 @@
//search dict
static void dict_search()
{
- g_print("dict search!!\n");
gchar word[256];
int flag;
-
+ g_print("dict search!!\n");
strcpy(word,gtk_entry_get_text(GTK_ENTRY(input_entry)));
if( (word[0] & 0x80) == 0x80 )

View File

@ -0,0 +1,58 @@
--- src/readword.c~ Sun Nov 21 20:55:42 2004
+++ src/readword.c Sun Nov 21 20:58:22 2004
@@ -26,13 +26,14 @@
gboolean return_val = 0;
- int n,i;
+ int n=0,i;
if(have_data_file && word && g_ascii_isalpha(word[0]))
{
- n=strlen(word);
gchar *lowerword = (gchar *)g_malloc(n+1);
+ gchar *filename;
+ n=strlen(word);
for (i=0;i < n;i++)
{
@@ -40,7 +41,7 @@
}
lowerword[n] = '\0';
- gchar *filename = g_strdup_printf(
+ filename = g_strdup_printf(
RP_TTS_DIR"%c/%s.wav",
lowerword[0],lowerword);
@@ -61,9 +62,11 @@
int n,i;
if (word && g_ascii_isalpha(word[0]))
{
- n=strlen(word);
gchar *lowerword = (gchar *)g_malloc(n+1);
+ gchar *filename;
+ int fd;
+ n=strlen(word);
for (i=0;i < n;i++)
{
@@ -72,15 +75,12 @@
lowerword[n] = '\0';
-
- gchar *filename;
-
filename = g_strdup_printf(
RP_TTS_DIR"%c/%s.wav",
lowerword[0],lowerword);
//gnome_sound_play(filename);
- int fd = esd_open_sound(NULL);
+ fd = esd_open_sound(NULL);
if (fd >= 0)
{
esd_play_file(NULL,filename, 0);

View File

@ -0,0 +1,12 @@
--- src/sentencewin.c~ Sun Nov 21 20:55:21 2004
+++ src/sentencewin.c Sun Nov 21 20:55:28 2004
@@ -114,8 +114,8 @@
//sentence read aloudly
static void sentence_read()
{
- g_print("sentence read!!\n");
gchar word[256];
+ g_print("sentence read!!\n");
strcpy(word,gtk_entry_get_text(GTK_ENTRY(input_entry)));

View File

@ -0,0 +1,48 @@
--- src/testgame.c~ Sun Nov 21 21:00:23 2004
+++ src/testgame.c Sun Nov 21 21:01:21 2004
@@ -42,14 +42,12 @@
{
GtkWidget *vbox,*hbox,*h_line;
GtkWidget *text_label,*xpm_label;
+ gchar temp[10];
// init
r_num=0;w_num=0;t_num=0;
counter = S_conf.test_counter;
- gchar temp[10];
-
-
/* test window */
test_win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_title(GTK_WINDOW(test_win),"Test Game");
@@ -262,7 +260,6 @@
//test start
static void test_start()
{
- g_print("start button clicked!\n");
// clean up
//gtk_entry_set_text(GTK_ENTRY(input_entry),"");
@@ -271,6 +268,7 @@
//gchar temp[10];
gchar prompt_str[256];
+ g_print("start button clicked!\n");
randnum = rand() % word_count;// 0< random num < word_count
S_state.word_index = randnum;
@@ -391,12 +389,12 @@
//test counter over,show result
static void test_over()
{
- g_print("counter over!\n");
gchar str[256];
gchar temp[256];
float percent;
+ g_print("counter over!\n");
if(t_num == 0)
percent = 0.0000;
else

View File

@ -0,0 +1,37 @@
--- src/wordfile.c~ Sun Nov 21 21:01:43 2004
+++ src/wordfile.c Sun Nov 21 21:02:37 2004
@@ -44,12 +44,11 @@
//read wordfile to wordbook[][],10000 words limition
void init_wordbook()
{
+ gchar * strtemp;//temp string
+ gchar str[256];//temp string
word_count = 0;
S_state.word_index = 0;
- gchar * strtemp;//temp string
- gchar str[256];//temp string
-
g_print("init wordbook!\n");
//open word file
@@ -91,16 +90,14 @@
//get S_line from wordfile
void read_line()
{
+ gchar line[256],EN_word[256],TK_word[256],CH_word[256],*p;
+ gint n;// count for line
+
if(S_state.word_index <= 0 )
gtk_widget_set_sensitive(back_button,0);
else
gtk_widget_set_sensitive(back_button,1);
-
- gchar line[256],EN_word[256],TK_word[256],CH_word[256],*p;
-
- gint n;// count for line
-
// '#' is special char defined by me,to show TK_word is end
TK_word[0]='#';