From b7c74cd5b22618d544a3f4ae124985d4837e3a22 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 4 Jun 2015 22:12:13 +0000 Subject: new mir_snprintf templates without SIZEOF git-svn-id: http://svn.miranda-ng.org/main/trunk@14002 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Alarms/src/alarmlist.cpp | 78 ++++++++++++++++++++-------------------- 1 file changed, 39 insertions(+), 39 deletions(-) (limited to 'plugins/Alarms/src/alarmlist.cpp') diff --git a/plugins/Alarms/src/alarmlist.cpp b/plugins/Alarms/src/alarmlist.cpp index 71e5171469..0c0d224de1 100644 --- a/plugins/Alarms/src/alarmlist.cpp +++ b/plugins/Alarms/src/alarmlist.cpp @@ -189,38 +189,38 @@ void LoadAlarms() { for(int i = 0; i < num_alarms; i++) { memset(&alarm, 0, sizeof(ALARM)); - mir_snprintf(buff, SIZEOF(buff), "Title%d", i); + mir_snprintf(buff, "Title%d", i); if (!db_get_ts(0, MODULE, buff, &dbv)) { alarm.szTitle = mir_tstrdup(dbv.ptszVal); db_free(&dbv); } - mir_snprintf(buff, SIZEOF(buff), "Desc%d", i); + mir_snprintf(buff, "Desc%d", i); if (!db_get_ts(0, MODULE, buff, &dbv)) { alarm.szDesc = mir_tstrdup(dbv.ptszVal); db_free(&dbv); } - mir_snprintf(buff, SIZEOF(buff), "Occ%d", i); + mir_snprintf(buff, "Occ%d", i); alarm.occurrence = (Occurrence)db_get_w(0, MODULE, buff, 0); - mir_snprintf(buff, SIZEOF(buff), "STHour%d", i); + mir_snprintf(buff, "STHour%d", i); alarm.time.wHour = db_get_w(0, MODULE, buff, 0); - mir_snprintf(buff, SIZEOF(buff), "STMinute%d", i); + mir_snprintf(buff, "STMinute%d", i); alarm.time.wMinute = db_get_w(0, MODULE, buff, 0); - mir_snprintf(buff, SIZEOF(buff), "STSecond%d", i); + mir_snprintf(buff, "STSecond%d", i); alarm.time.wSecond = db_get_w(0, MODULE, buff, 0); switch(alarm.occurrence) { case OC_ONCE: - mir_snprintf(buff, SIZEOF(buff), "STYear%d", i); + mir_snprintf(buff, "STYear%d", i); alarm.time.wYear = db_get_w(0, MODULE, buff, 0); - mir_snprintf(buff, SIZEOF(buff), "STMonth%d", i); + mir_snprintf(buff, "STMonth%d", i); alarm.time.wMonth = db_get_w(0, MODULE, buff, 0); - mir_snprintf(buff, SIZEOF(buff), "STDay%d", i); + mir_snprintf(buff, "STDay%d", i); alarm.time.wDay = db_get_w(0, MODULE, buff, 0); break; case OC_WEEKLY: - mir_snprintf(buff, SIZEOF(buff), "STDayOfWeek%d", i); + mir_snprintf(buff, "STDayOfWeek%d", i); alarm.time.wDayOfWeek = db_get_w(0, MODULE, buff, 0); break; case OC_WEEKDAYS: @@ -228,26 +228,26 @@ void LoadAlarms() { case OC_DAILY: break; case OC_MONTHLY: - mir_snprintf(buff, SIZEOF(buff), "STDay%d", i); + mir_snprintf(buff, "STDay%d", i); alarm.time.wDay = db_get_w(0, MODULE, buff, 0); break; case OC_YEARLY: - mir_snprintf(buff, SIZEOF(buff), "STMonth%d", i); + mir_snprintf(buff, "STMonth%d", i); alarm.time.wMonth = db_get_w(0, MODULE, buff, 0); - mir_snprintf(buff, SIZEOF(buff), "STDay%d", i); + mir_snprintf(buff, "STDay%d", i); alarm.time.wDay = db_get_w(0, MODULE, buff, 0); break; } if (UpdateAlarm(alarm.time, alarm.occurrence)) { - mir_snprintf(buff, SIZEOF(buff), "ActionFlags%d", i); + mir_snprintf(buff, "ActionFlags%d", i); alarm.action = (unsigned short)db_get_dw(0, MODULE, buff, AAF_POPUP | AAF_SOUND); if (alarm.action & AAF_COMMAND) { - mir_snprintf(buff, SIZEOF(buff), "ActionCommand%d", i); + mir_snprintf(buff, "ActionCommand%d", i); if (!db_get_ts(0, MODULE, buff, &dbv)) { alarm.szCommand = mir_tstrdup(dbv.ptszVal); db_free(&dbv); - mir_snprintf(buff, SIZEOF(buff), "ActionParams%d", i); + mir_snprintf(buff, "ActionParams%d", i); if (!db_get_ts(0, MODULE, buff, &dbv)) { alarm.szCommandParams = mir_tstrdup(dbv.ptszVal); db_free(&dbv); @@ -255,22 +255,22 @@ void LoadAlarms() { } } - mir_snprintf(buff, SIZEOF(buff), "SoundNum%d", i); + mir_snprintf(buff, "SoundNum%d", i); alarm.sound_num = (int)db_get_b(0, MODULE, buff, 1); - mir_snprintf(buff, SIZEOF(buff), "Snoozer%d", i); + mir_snprintf(buff, "Snoozer%d", i); alarm.snoozer = db_get_b(0, MODULE, buff, 0) == 1; - mir_snprintf(buff, SIZEOF(buff), "Hidden%d", i); + mir_snprintf(buff, "Hidden%d", i); alarm.flags |= (db_get_b(0, MODULE, buff, 0) == 1 ? ALF_HIDDEN : 0); - mir_snprintf(buff, SIZEOF(buff), "Suspended%d", i); + mir_snprintf(buff, "Suspended%d", i); alarm.flags |= (db_get_b(0, MODULE, buff, 0) == 1 ? ALF_SUSPENDED : 0); - mir_snprintf(buff, SIZEOF(buff), "NoStartup%d", i); + mir_snprintf(buff, "NoStartup%d", i); alarm.flags |= (db_get_b(0, MODULE, buff, 0) == 1 ? ALF_NOSTARTUP : 0); - mir_snprintf(buff, SIZEOF(buff), "Flags%d", i); + mir_snprintf(buff, "Flags%d", i); alarm.flags = db_get_dw(0, MODULE, buff, alarm.flags); alarm.id = next_alarm_id++; @@ -288,18 +288,18 @@ void SaveAlarms() { ALARM *i; for(alarms.reset(); i = alarms.current(); alarms.next(), index++) { - mir_snprintf(buff, SIZEOF(buff), "Title%d", index); + mir_snprintf(buff, "Title%d", index); db_set_ts(0, MODULE, buff, i->szTitle); - mir_snprintf(buff, SIZEOF(buff), "Desc%d", index); + mir_snprintf(buff, "Desc%d", index); db_set_ts(0, MODULE, buff, i->szDesc); - mir_snprintf(buff, SIZEOF(buff), "Occ%d", index); + mir_snprintf(buff, "Occ%d", index); db_set_w(0, MODULE, buff, i->occurrence); - mir_snprintf(buff, SIZEOF(buff), "STHour%d", index); + mir_snprintf(buff, "STHour%d", index); db_set_w(0, MODULE, buff, i->time.wHour); - mir_snprintf(buff, SIZEOF(buff), "STMinute%d", index); + mir_snprintf(buff, "STMinute%d", index); db_set_w(0, MODULE, buff, i->time.wMinute); - mir_snprintf(buff, SIZEOF(buff), "STSecond%d", index); + mir_snprintf(buff, "STSecond%d", index); db_set_w(0, MODULE, buff, i->time.wSecond); switch(i->occurrence) { @@ -308,41 +308,41 @@ void SaveAlarms() { case OC_WEEKDAYS: break; case OC_WEEKLY: - mir_snprintf(buff, SIZEOF(buff), "STDayOfWeek%d", index); + mir_snprintf(buff, "STDayOfWeek%d", index); db_set_w(0, MODULE, buff, i->time.wDayOfWeek); break; case OC_ONCE: - mir_snprintf(buff, SIZEOF(buff), "STYear%d", index); + mir_snprintf(buff, "STYear%d", index); db_set_w(0, MODULE, buff, i->time.wYear); case OC_YEARLY: - mir_snprintf(buff, SIZEOF(buff), "STMonth%d", index); + mir_snprintf(buff, "STMonth%d", index); db_set_w(0, MODULE, buff, i->time.wMonth); case OC_MONTHLY: - mir_snprintf(buff, SIZEOF(buff), "STDay%d", index); + mir_snprintf(buff, "STDay%d", index); db_set_w(0, MODULE, buff, i->time.wDay); break; } - mir_snprintf(buff, SIZEOF(buff), "ActionFlags%d", index); + mir_snprintf(buff, "ActionFlags%d", index); db_set_dw(0, MODULE, buff, i->action); if (i->action & AAF_COMMAND) { if (mir_tstrlen(i->szCommand)) { - mir_snprintf(buff, SIZEOF(buff), "ActionCommand%d", index); + mir_snprintf(buff, "ActionCommand%d", index); db_set_ts(0, MODULE, buff, i->szCommand); if (mir_tstrlen(i->szCommandParams)) { - mir_snprintf(buff, SIZEOF(buff), "ActionParams%d", index); + mir_snprintf(buff, "ActionParams%d", index); db_set_ts(0, MODULE, buff, i->szCommandParams); } } } - mir_snprintf(buff, SIZEOF(buff), "SoundNum%d", index); + mir_snprintf(buff, "SoundNum%d", index); db_set_b(0, MODULE, buff, i->sound_num); - mir_snprintf(buff, SIZEOF(buff), "Snoozer%d", index); + mir_snprintf(buff, "Snoozer%d", index); db_set_b(0, MODULE, buff, i->snoozer ? 1 : 0); - mir_snprintf(buff, SIZEOF(buff), "Flags%d", index); + mir_snprintf(buff, "Flags%d", index); db_set_dw(0, MODULE, buff, i->flags); } db_set_w(0, MODULE, "Count", index); @@ -521,7 +521,7 @@ void DoAlarm(ALARM *alarm) if (alarm->action & AAF_SOUND) { if (alarm->sound_num > 0 && alarm->sound_num <= 3) { char buff[128]; - mir_snprintf(buff, SIZEOF(buff), "Triggered%d", alarm->sound_num); + mir_snprintf(buff, "Triggered%d", alarm->sound_num); SkinPlaySound(buff); } else if (alarm->sound_num == 4) { if (alarm->szTitle != NULL && alarm->szTitle[0] != '\0') { -- cgit v1.2.3