Skip to content

Commit

Permalink
isValidProductKey() doesn't need (complete).
Browse files Browse the repository at this point in the history
  • Loading branch information
icculus committed Apr 25, 2009
1 parent a1fbbe5 commit 80ebbde
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 11 deletions.
2 changes: 1 addition & 1 deletion gui.h
Expand Up @@ -273,7 +273,7 @@ const MojoGui *MOJOGUI_ENTRY_POINT(int rev, const MojoSetupEntryPoints *e) \
#ifdef isValidProductKey
#undef isValidProductKey
#endif
#define isValidProductKey(x,y,z) entry->isValidProductKey(x,y,z)
#define isValidProductKey(x,y) entry->isValidProductKey(x,y)

#endif

Expand Down
4 changes: 2 additions & 2 deletions gui_gtkplus2.c
Expand Up @@ -219,7 +219,7 @@ static void signal_productkey_changed(GtkEditable *edit, gpointer user_data)
{
const char *fmt = (const char *) user_data;
char *key = (char *) gtk_editable_get_chars(edit, 0, -1);
const gboolean okay = isValidProductKey(fmt, key, false);
const gboolean okay = isValidProductKey(fmt, key);
g_free(key);
gtk_widget_set_sensitive(next, okay);
} // if
Expand Down Expand Up @@ -829,7 +829,7 @@ static int MojoGui_gtkplus2_productkey(const char *desc, const char *fmt,

str = gtk_editable_get_chars(GTK_EDITABLE(productkey), 0, -1);
// should never be invalid ("next" should be disabled in that case).
assert( (retval <= 0) || ((str) && (isValidProductKey(fmt, str, true))) );
assert( (retval <= 0) || ((str) && (isValidProductKey(fmt, str))) );
assert(strlen(str) < buflen);
strcpy(buf, (char *) str);
g_free(str);
Expand Down
2 changes: 1 addition & 1 deletion gui_stdio.c
Expand Up @@ -536,7 +536,7 @@ static int MojoGui_stdio_productkey(const char *desc, const char *fmt,
if ((len == 0) && (defval != NULL))
strcpy(buf, defval);

if (isValidProductKey(fmt, buf, true))
if (isValidProductKey(fmt, buf))
{
retval = 1;
getout = true;
Expand Down
2 changes: 1 addition & 1 deletion gui_www.c
Expand Up @@ -1050,7 +1050,7 @@ static int MojoGui_www_productkey(const char *desc, const char *fmt,
else
{
snprintf(buf, buflen, "%s", keyval);
if (isValidProductKey(fmt, buf, true))
if (isValidProductKey(fmt, buf))
retval = 1;
// !!! FIXME: must try again if invalid key.
} // else
Expand Down
4 changes: 2 additions & 2 deletions mojosetup.c
Expand Up @@ -951,7 +951,7 @@ uint8 *decodeImage(const uint8 *data, uint32 size, uint32 *w, uint32 *h)
} // decodeImage


boolean isValidProductKey(const char *fmt, const char *key, const int complete)
boolean isValidProductKey(const char *fmt, const char *key)
{
if (fmt == NULL)
return true;
Expand Down Expand Up @@ -999,7 +999,7 @@ boolean isValidProductKey(const char *fmt, const char *key, const int complete)
} // switch
} // while

return ((*key == '\0') || (!complete)); // valid, or valid so far.
return (*key == '\0');
} // isValidProductKey


Expand Down
6 changes: 2 additions & 4 deletions universal.h
Expand Up @@ -237,10 +237,8 @@ uint8 *decodeImage(const uint8 *data, uint32 size, uint32 *w, uint32 *h);
// See if a given string is in a valid product key format.
// (fmt) points to a string that would be a Setup.ProductKey.format.
// (key) is the key as it currently stands. It might be partially entered.
// (complete) is false if the key is still being typed in, true if this is
// the final key the user is entering.
// Returns true if the key is valid for the format, false otherwise.
boolean isValidProductKey(const char *fmt, const char *key, const int complete);
boolean isValidProductKey(const char *fmt, const char *key);

// See if a given flag was on the command line
//
Expand Down Expand Up @@ -372,7 +370,7 @@ typedef struct MojoSetupEntryPoints
uint32 (*utf8codepoint)(const char **_str);
int (*utf8len)(const char *str);
char **(*splitText)(const char *text, int scrw, int *_count, int *_w);
boolean (*isValidProductKey)(const char *f, const char *k, const int comp);
boolean (*isValidProductKey)(const char *f, const char *k);
} MojoSetupEntryPoints;
extern MojoSetupEntryPoints GEntryPoints;

Expand Down

0 comments on commit 80ebbde

Please sign in to comment.