summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 08c0551)
raw | patch | inline | side by side (parent: 08c0551)
author | Max Kellermann <max@duempel.org> | |
Mon, 15 Sep 2008 10:27:29 +0000 (12:27 +0200) | ||
committer | Max Kellermann <max@duempel.org> | |
Mon, 15 Sep 2008 10:27:29 +0000 (12:27 +0200) |
Although they are allowedd in C99, try to avoid them. Move variable
declarations to the top of the current scope.
declarations to the top of the current scope.
src/screen_lyrics.c | patch | blob | history | |
src/screen_search.c | patch | blob | history | |
src/src_lyrics.c | patch | blob | history |
diff --git a/src/screen_lyrics.c b/src/screen_lyrics.c
index 8943d4f22b75ebeed18561c782ffc8f566349987..2c770ff595cd874e541012625f9c2c67b6e6167b 100644 (file)
--- a/src/screen_lyrics.c
+++ b/src/screen_lyrics.c
char title[512];
static char path[1024];
FILE *lyr_file;
+ int i;
+ char line_buf[1024];
get_text_line(&lyr_text, 0, artist, 512);
get_text_line(&lyr_text, 1, title, 512);
if (lyr_file == NULL)
return -1;
- int i;
- char line_buf[1024];
-
for (i = 3; i <= lyr_text.text->len; i++) {
if(get_text_line(&lyr_text, i, line_buf, 1024) == -1);
fputs(line_buf, lyr_file);
{
mpd_Status *status = ((retrieval_spec*)c)->client->status;
mpd_Song *cur = ((retrieval_spec*)c)->client->song;
+ char artist[MAX_SONGNAME_LENGTH];
+ char title[MAX_SONGNAME_LENGTH];
+
//mpdclient_update((mpdclient_t*)c);
if(!(IS_PAUSED(status->state)||IS_PLAYING(status->state))) {
}
- char artist[MAX_SONGNAME_LENGTH];
- char title[MAX_SONGNAME_LENGTH];
lock=2;
result = 0;
if ((idx == lyr_text.lines->len && lyr_text.lines->len > 4) ||
((lyr_text.lines->len == 0 || lyr_text.lines->len == 4) &&
idx == 0)) {
- *highlight=3;
src_lyr* selected = g_array_index(src_lyr_stack, src_lyr*, src_selection);
+ *highlight=3;
if (selected != NULL)
return selected->description;
return "";
diff --git a/src/screen_search.c b/src/screen_search.c
index 982fe34e0138e645da87f4518e2a9761e97d90f3..dd2353c000f6fa4a8fdc00b2fc923f531fbc5f50 100644 (file)
--- a/src/screen_search.c
+++ b/src/screen_search.c
i=0;
j=0;
while (strv[i] && strlen(strv[i]) > 0 && i < 9) {
- D("strv[%d] = \"%s\"\n", i, strv[i]);
-
int id = search_get_tag_id(strv[i]);
if (id == -1) {
if (table[j]) {
if (advanced_search_mode && j > 0) {
+ int iter;
+ mpd_InfoEntity *entity;
+
/*-----------------------------------------------------------------------
* NOTE (again): This code exists to test a new search ui,
* Its ugly and MUST be redesigned before the next release!
/** stupid - but this is just a test...... (fulhack) */
mpd_startSearch(c->connection, FALSE);
- int iter;
for(iter = 0; iter < 10; iter++) {
mpd_addConstraintSearch(c->connection, table[iter], arg[iter]);
}
fl = g_malloc0(sizeof(mpdclient_filelist_t));
- mpd_InfoEntity *entity;
-
while ((entity=mpd_getNextInfoEntity(c->connection))) {
filelist_entry_t *entry = g_malloc0(sizeof(filelist_entry_t));
diff --git a/src/src_lyrics.c b/src/src_lyrics.c
index 4d41aea3752db1aba0459a9c076bbd75b2ae1cd3..448c301ad562f1ae04d955c0008dbcf706e931ff 100644 (file)
--- a/src/src_lyrics.c
+++ b/src/src_lyrics.c
int get_text_line(formed_text *text, int num, char *dest, int len)
{
+ int linelen;
+
memset(dest, '\0', len*sizeof(char));
if (num >= text->lines->len - 1)
return -1;
- int linelen;
+
if (num == 0) {
linelen = g_array_index(text->lines, int, num);
memcpy(dest, text->text->str, linelen*sizeof(char));
int src_lyr_init(void)
{
+ int i = 0;
+
src_lyr_stack_init ();
- int i = 0;
while (g_array_index (src_lyr_stack, src_lyr*, i) != NULL) {
src_lyr *i_stack;
i_stack = g_array_index (src_lyr_stack, src_lyr*, i);
static int src_lyr_load_plugin_file(const char *file)
{
GString *path;
+ src_lyr *new_src;
+ src_lyr_plugin_register register_func;
+
path = g_string_new (PLUGIN_DIR_SYSTEM);
g_string_append (path, "/");
g_string_append (path, file);
- src_lyr_plugin_register register_func;
- src_lyr *new_src = malloc (sizeof (src_lyr));
+ new_src = malloc(sizeof(src_lyr));
new_src->module = g_module_open (path->str, G_MODULE_BIND_LAZY);
if (!g_module_symbol (new_src->module, "register_me", (gpointer*) ®ister_func))
return -1;
static int src_lyr_plugins_load(void)
{
GDir *plugin_dir;
+ GString *user_dir_path;
plugin_dir = g_dir_open (PLUGIN_DIR_SYSTEM, 0, NULL);
if (plugin_dir == NULL)
return -1;
src_lyr_plugins_load_from_dir (plugin_dir);
- GString *user_dir_path;
user_dir_path = g_string_new (g_get_home_dir());
g_string_append (user_dir_path, PLUGIN_DIR_USER);