speechd-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

invalid conversion from ‘int’ to enum


From: Cameron Wong
Subject: invalid conversion from ‘int’ to enum
Date: Sat, 5 Dec 2009 14:24:54 +0800

Hello,

I am trying to write a new module basing on flite.c. But I write it in
C++. When I build the module, it complains:
ekho.cc:80: error: invalid conversion from ?int? to ?EPunctMode?
ekho.cc:80: error: invalid conversion from ?int? to ?ESpellMode?
ekho.cc:80: error: invalid conversion from ?int? to ?ECapLetRecogn?

The problem lies in following code:
 msg_settings_old.punctuation_mode = -1;\
 msg_settings_old.spelling_mode = -1;\
 msg_settings_old.cap_let_recogn = -1;\

I don't understand the code, but should we use a new enum value
instead of -1? Thanks!

Cameron Wong

/***** some related source code in fdset.h and module_utils *****/

#define CLEAN_OLD_SETTINGS_TABLE()\
 msg_settings_old.rate = -101;\
 msg_settings_old.pitch = -101;\
 msg_settings_old.volume = -101;\
 msg_settings_old.punctuation_mode = -1;\
 msg_settings_old.spelling_mode = -1;\
 msg_settings_old.cap_let_recogn = -1;\
 msg_settings_old.language = NULL;      \
 msg_settings_old.voice = NO_VOICE;\
 msg_settings_old.synthesis_voice = NULL;

...

   EPunctMode punctuation_mode;
   ESpellMode spelling_mode;
   ECapLetRecogn cap_let_recogn;

...
typedef enum
   {
       RECOGN_NONE = 0,
       RECOGN_SPELL = 1,
       RECOGN_ICON = 2
   }ECapLetRecogn;

typedef enum
   {
       PUNCT_NONE = 0,
       PUNCT_ALL = 1,
       PUNCT_SOME = 2
   }EPunctMode;

typedef enum
   {
       SPELLING_OFF = 0,
       SPELLING_ON = 1
   }ESpellMode;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]