1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359
|
Author: Thorsten Glaser <tg@mirbsd.org>
Origin: https://www.mirbsd.org/cvs.cgi/ports/audio/morse2ascii/patches/
Forwarded: no
Description: Fixes some undefined behaviour reported by gcc with pedantic
build flags and valgrind
--- a/abbreviations.h
+++ b/abbreviations.h
@@ -1,6 +1,6 @@
typedef struct {
- char *code;
- char *str;
+ const char *code;
+ const char *str;
} abbreviations_t;
abbreviations_t abbreviations[] = {
--- a/morse2ascii.c
+++ b/morse2ascii.c
@@ -66,8 +66,8 @@ int do_mono(i16 *smp, int samples, int c
void do_dcbias(i16 *smp, int samples);
void do_normalize(i16 *smp, int samples);
int do_reduce(i16 *smp, int samples, int *freq);
-void my_err(u8 *err);
-void std_err(void);
+void my_err(const u8 *err) __attribute__((__noreturn__));
+void std_err(void) __attribute__((__noreturn__));
@@ -229,6 +229,7 @@ int main(int argc, char *argv[]) {
}
beep = do_beeps(smp, samples, &beeps);
+ free(smp);
goto_beep2morse:
if(beeps < 0) {
@@ -264,10 +265,10 @@ int morse_output(u8 *beep) {
qa = 0;
u8 old,
*p,
- *l,
- *s,
- *z,
- *x;
+ *l;
+ const u8 *s;
+ const u8 *z;
+ const u8 *x;
p = beep;
while(*p) {
@@ -642,13 +643,13 @@ u8 *do_beeps(i16 *smp, int samples, int
while(i < beeps) {
if(beep[i]) {
for(tmp = 0; (i < beeps) && beep[i]; tmp++, i++);
- if(tmp <= med_on) beep[j++] = DOT;
- else if(tmp > med_on) beep[j++] = DASH;
+ if(tmp <= (u32)med_on) beep[j++] = DOT;
+ else if(tmp > (u32)med_on) beep[j++] = DASH;
} else {
for(tmp = 0; (i < beeps) && !beep[i]; tmp++, i++);
- if(tmp <= med_off) beep[j++] = GAP;
- else if(tmp >= max_off) beep[j++] = MEDIUMGAP;
- else if(tmp > med_off) beep[j++] = SHORTGAP;
+ if(tmp <= (u32)med_off) beep[j++] = GAP;
+ else if(tmp >= (u32)max_off) beep[j++] = MEDIUMGAP;
+ else if(tmp > (u32)med_off) beep[j++] = SHORTGAP;
}
}
beeps = j;
@@ -830,7 +831,7 @@ int do_reduce(i16 *smp, int samples, int
-void my_err(u8 *err) {
+void my_err(const u8 *err) {
fprintf(stderr, "\nError: %s\n", err);
exit(1);
}
--- a/mywav.h
+++ b/mywav.h
@@ -51,6 +51,21 @@ typedef struct {
} mywav_fmtchunk;
+int mywav_fwi08(FILE *fd, int num);
+int mywav_fwi16(FILE *fd, int num);
+int mywav_fwi32(FILE *fd, int num);
+int mywav_fwmem(FILE *fd, const uint8_t *mem, int size);
+int mywav_fwchunk(FILE *fd, mywav_chunk *chunk);
+int mywav_fwfmtchunk(FILE *fd, mywav_fmtchunk *fmtchunk);
+int mywav_fri08(FILE *fd, uint8_t *num);
+int mywav_fri16(FILE *fd, uint16_t *num);
+int mywav_fri32(FILE *fd, uint32_t *num);
+int mywav_frmem(FILE *fd, uint8_t *mem, int size);
+int mywav_frchunk(FILE *fd, mywav_chunk *chunk);
+int mywav_frfmtchunk(FILE *fd, mywav_fmtchunk *fmtchunk);
+int mywav_seekchunk(FILE *fd, const uint8_t *find);
+int mywav_data(FILE *fd, mywav_fmtchunk *fmt);
+int mywav_writehead(FILE *fd, mywav_fmtchunk *fmt, uint32_t data_size, uint8_t *more, int morelen);
/* FILE WRITING */
@@ -83,7 +98,7 @@ int mywav_fwi32(FILE *fd, int num) {
// data
-int mywav_fwmem(FILE *fd, uint8_t *mem, int size) {
+int mywav_fwmem(FILE *fd, const uint8_t *mem, int size) {
if(size) {
if(fwrite(mem, size, 1, fd) != 1) return(-1);
}
@@ -185,7 +200,7 @@ int mywav_frfmtchunk(FILE *fd, mywav_fmt
/* MYWAV MAIN FUNCTIONS */
-int mywav_seekchunk(FILE *fd, uint8_t *find) {
+int mywav_seekchunk(FILE *fd, const uint8_t *find) {
mywav_chunk chunk;
if(fseek(fd, sizeof(mywav_chunk) + 4, SEEK_SET) < 0) return(-1);
--- a/qcodes.h
+++ b/qcodes.h
@@ -1,11 +1,11 @@
// may exist some errors, sorry
typedef struct {
- char *code;
- char *question;
- char *question_choices;
- char *answer;
- char *answer_choices;
+ const char *code;
+ const char *question;
+ const char *question_choices;
+ const char *answer;
+ const char *answer_choices;
} qcodes_t;
qcodes_t qcodes[] = {
@@ -37,7 +37,7 @@ qcodes_t qcodes[] = {
{ "QAZ", "Are you experiencing communication difficulties through flying in a storm?", NULL, "I am experiencing communication difficulties through flying in a storm", NULL }, // Note: Attention is invited to the possible supplementary use of signals QAR, QBE, QCS, QRM, QRN, QRX, QSZ or the signal CL to amplify the meaning associated with signal QAZ.
{ "QBA", "What is the horizontal visibility at...(place)?", NULL, "The horizontal visibility at... (place) at...hours is... (distance figures and units).", NULL },
{ "QBB", "What is the amount, type and height above official aerodrome elevation of the base of the cloud (at...(place)?", NULL, "The amount, type and height above official aerodrome elevation of the base of the cloud at... (place) at...hours is: ...eighths (...type) at...(figures and units)* height above official aerodrome elevation.", NULL }, // NOTE: The cloud amount, type (if reported) and vertical distance information is reported in sequence if several cloud layers are present, the order of reporting being from low to high levels in accordance with the following cloud layer specifications: a) the lowest individual layer of any amount; b) the next higher individual layer the amount of which is three-eighths or more (to the nearest eighth); c) the next higher individual layer the amount of which is five-eighths or more (to the nearest eighth). EXAMPLE: = QBB CYUL 1300 2 300 FT 3 1500 FT 6 9000 FT =
- { "QBC", "Report meteorological conditions as observed from your aircraft at... (position or zone) at...hours at...(figures and units) height above...(datum).", NULL, "The meteorological conditions as observed from my aircraft at... (position or zone) at...hours at...(figures and units) height above...(datum) are..." }, // Note: The information may be given in AIREP, or Q Code form. When given in Q Code, the following sequence of Q signal QBC answer (or advice) forms is used: QMX, QNY, QAO, QDF, QMI, QFT and QNI.", NULL },
+ { "QBC", "Report meteorological conditions as observed from your aircraft at... (position or zone) at...hours at...(figures and units) height above...(datum).", NULL, "The meteorological conditions as observed from my aircraft at... (position or zone) at...hours at...(figures and units) height above...(datum) are...", NULL }, // Note: The information may be given in AIREP, or Q Code form. When given in Q Code, the following sequence of Q signal QBC answer (or advice) forms is used: QMX, QNY, QAO, QDF, QMI, QFT and QNI.", NULL },
{ "QBD", "How much fuel have you remaining (expressed as hours and/or minutes of consumption)?", NULL, "Fuel remaining is...(hours and/or minutes of consumption).", NULL },
{ "QBE", NULL, NULL, "I am about to wind in my aerial.", NULL },
{ "QBF", "Are you flying in cloud?", NULL, "I am flying in cloud at... (figures and units) height above...(datum) (and I am ascending (descending) to...(figures and units) height above that datum).", NULL },
@@ -54,7 +54,7 @@ qcodes_t qcodes[] = {
{ "QBQ", NULL, NULL, NULL, NULL },
{ "QBR", NULL, NULL, NULL, NULL },
{ "QBS", NULL, NULL, "Ascend (or descend) to... (figures and units) height above...(datum) before encountering instrument meteorological conditions or if visibility falls below... (figures and units of distance) and advise.", NULL },
- { "QBT", "How far, along the runway, from the approach end, can the observer at the runway threshold see the runway lights which will be in operation for my landing (at...(place))?", NULL, "At...hours, the observer at the threshold of runway number... could see the runway lights in operation for your landing (at...(place)) for a distance of...(figures and units) from the approach end." }, // Note: If the station inquired of is not equipped to make the special observation requested, the reply to QBT IMI is given by the signal QNO.", NULL },
+ { "QBT", "How far, along the runway, from the approach end, can the observer at the runway threshold see the runway lights which will be in operation for my landing (at...(place))?", NULL, "At...hours, the observer at the threshold of runway number... could see the runway lights in operation for your landing (at...(place)) for a distance of...(figures and units) from the approach end.", NULL }, // Note: If the station inquired of is not equipped to make the special observation requested, the reply to QBT IMI is given by the signal QNO.", NULL },
{ "QBU", NULL, NULL, NULL, NULL },
{ "QBV", "Have you reached the... (figures and units) height above...(datum) (or... (area or place))?", NULL, "I have reached the...(figures and units) height above...(datum) (or...(area or place)). or Report reaching the...(figures and units) height above... (datum) (or...(area or place)).", NULL },
{ "QBW", NULL, NULL, NULL, NULL },
@@ -92,7 +92,7 @@ qcodes_t qcodes[] = {
{ "QDC", NULL, NULL, NULL, NULL },
{ "QDD", NULL, NULL, NULL, NULL },
{ "QDE", NULL, NULL, NULL, NULL },
- { "QDF", "What is your D-Value at...(position)?", /* "What is the D-Value at... (place or position) at...hours) for the...millibar level?" */ NULL, "My D-Value at...(position) at... (figures and units) height above the 1013.2 millibars datum is...(D-Value figures and units)... *(specify plus or minus)." }, // or The D-Value at...(place or position) at hours for the...millibar level is...(D-Value figures and units...*(specify plus or minus)." }, // Note: When the true altitude (radio altitude) is greater than the pressure altitude PS (plus) is used and when it is less MS (minus) is used."
+ { "QDF", "What is your D-Value at...(position)?", /* "What is the D-Value at... (place or position) at...hours) for the...millibar level?" */ NULL, "My D-Value at...(position) at... (figures and units) height above the 1013.2 millibars datum is...(D-Value figures and units)... *(specify plus or minus).", NULL }, // or The D-Value at...(place or position) at hours for the...millibar level is...(D-Value figures and units...*(specify plus or minus)." }, // Note: When the true altitude (radio altitude) is greater than the pressure altitude PS (plus) is used and when it is less MS (minus) is used."
{ "QDG", NULL, NULL, NULL, NULL },
{ "QDH", NULL, NULL, NULL, NULL },
{ "QDI", NULL, NULL, NULL, NULL },
@@ -125,7 +125,7 @@ qcodes_t qcodes[] = {
{ "QEJ", "May I/you assume position for take-off?", NULL, "Cleared to hold at take-off position for runway number... and am holding.", NULL },
{ "QEK", "Are you ready for immediate take-off?", NULL, "I am ready for immediate take-off.", NULL },
{ "QEL", "May I take-off (and make a... hand turn after take-off)?", NULL, "You are cleared to take-off (turn as follows after take-off...).", NULL },
- { "QEM", "What is the condition of the landing surface at...(place)?", NULL, "The condition of the landing surface at...(place) is..." }, // Note: The information is given by sending appropriate NOTAM Code groups."
+ { "QEM", "What is the condition of the landing surface at...(place)?", NULL, "The condition of the landing surface at...(place) is...", NULL }, // Note: The information is given by sending appropriate NOTAM Code groups."
{ "QEN", "Shall I hold my position?", NULL, "Hold your position.", NULL },
{ "QEO", "Shall I/you clear the runway (or landing area)?", NULL, "Clear the runway (or landing area).", NULL },
{ "QEP", NULL, NULL, NULL, NULL },
@@ -139,9 +139,9 @@ qcodes_t qcodes[] = {
{ "QEX", NULL, NULL, NULL, NULL },
{ "QEY", NULL, NULL, NULL, NULL },
{ "QEZ", NULL, NULL, NULL, NULL },
- { "QFA", "What is the meteorological forecast for...(flight, route, section of route or zone) for the period...hours until ...hours?", NULL, "The meteorological forecast for...(flight, route, section of route or zone) for the period...hours until hours.is " }, // Note: When the forecast is given in Q Code the following sequence of Q signal answer (or advice) forms is to be given: QAO, QMX, QMI, QNY, QBA, QMW, QFT and QNI."
+ { "QFA", "What is the meteorological forecast for...(flight, route, section of route or zone) for the period...hours until ...hours?", NULL, "The meteorological forecast for...(flight, route, section of route or zone) for the period...hours until hours.is ", NULL }, // Note: When the forecast is given in Q Code the following sequence of Q signal answer (or advice) forms is to be given: QAO, QMX, QMI, QNY, QBA, QMW, QFT and QNI."
{ "QFB", NULL, NULL, "The... % lights are out of order.", "1) approach 2) runway 3) approach and runway" },
- { "QFC", "What is the amount, the type and the height above...(datum) of the base of the cloud at...(place, position or zone)?", NULL, "At...(place, position or zone) the base of the cloud is... eighths...type at...(figures and units) height above... (datum)." }, // Note: If several cloud layers or masses are present, the lowest is reported first."
+ { "QFC", "What is the amount, the type and the height above...(datum) of the base of the cloud at...(place, position or zone)?", NULL, "At...(place, position or zone) the base of the cloud is... eighths...type at...(figures and units) height above... (datum).", NULL }, // Note: If several cloud layers or masses are present, the lowest is reported first."
{ "QFD", "%", "1) Is the...visual beacon(at...(place)) in operation? 2) Will you switch on the... visual beacon (at...(place))? 3) Will you extinguish the aerodrome visual beacon (at...(place)) until I have landed?", "%", "1) The...visual beacon (at... (place)) is in operation. 2) I will switch on the... visual beacon (at...(place)). 3) I will extinguish the aerodrome visual beacon (at... (place)) until your landing is completed." },
{ "QFE", "(At...(place)) what is the present atmospheric pressure at official aerodrome elevation?", NULL, "At...(place) the atmospheric pressure at official aerodrome elevation is (or was observed at...hours to be) ...millibars.", NULL },
{ "QFF", "(At...(place)) what is the present atmospheric pressure converted to mean sea level in accordance with meteorological practice?", NULL, "At...(place) the atmospheric pressure converted to mean sea level in accordance with meteorological practice is (or was determined at...hours to be) ...millibars.", NULL },
@@ -154,22 +154,22 @@ qcodes_t qcodes[] = {
{ "QFM", "What height above..(datum)... %", "1) should I maintain? 2) are you maintaining? 3) do you intend cruising at?", "%", "1) Maintain (or fly at)... (figures and units) height above...(datum). 2) I am maintaining...(figures and units) height above ...(datum). 3) I intend cruising at... (figures and units) height above...(datum)." },
{ "QFN", NULL, NULL, NULL, NULL },
{ "QFO", "May I land immediately?", NULL, "You may land immediately.", NULL },
- { "QFP", "Will you give me the latest information concerning... facility (at...(place))?", NULL, "The latest information concerning...facility (at... (place)) is as follows..." }, // Note: The information is given by sending appropriate NOTAM Code groups."
+ { "QFP", "Will you give me the latest information concerning... facility (at...(place))?", NULL, "The latest information concerning...facility (at... (place)) is as follows...", NULL }, // Note: The information is given by sending appropriate NOTAM Code groups."
{ "QFQ", "Are the approach and runway lights lit?", NULL, "The approach and runway lights are lit.", NULL },
{ "QFR", "Does my landing gear appear damaged?", NULL, "Your landing gear appears damaged.", NULL },
{ "QFS", "Is the...radio facility at...(place) in operation?", NULL, "The...radio facility at...(place) is in operation (or will be in operation in...hours).", NULL },
{ "QFT", "Between what heights above...(datum) has ice formation been observed (at...(position or zone))?", NULL, "Ice formation has been observed at ...(position or zone) in the type of...and with an accretion rate of...between...(figures and units) and...(figures and units) heights above...(datum).", NULL },
- { "QFU", "What is the magnetic direction (or number) of the runway to be used?", NULL, "The magnetic direction (or number) of the runway to be used is..." }, // Note: The runway number is indicated by a two-figure group and the magnetic direction by a three-figure group."
+ { "QFU", "What is the magnetic direction (or number) of the runway to be used?", NULL, "The magnetic direction (or number) of the runway to be used is...", NULL }, // Note: The runway number is indicated by a two-figure group and the magnetic direction by a three-figure group."
{ "QFV", "Are the floodlights switched on?", NULL, "The floodlights are switched on.", NULL },
{ "QFW", "What is the length of the runway in use in...(units)?", NULL, "The length of runway...now in use is...(figures and units).", NULL },
{ "QFX", NULL, NULL, "I am working (or am going to work) on a fixed aerial.", NULL },
- { "QFY", "Please report the present meteorological landing conditions (at...(place)).", NULL, "The present meteorological landing conditions at...(place) are..." }, // Note: When given in Q Code the information is sent in the following sequence: QAN, QBA, QNY, QBB, QNH, and/or QFE and, if necessary, QMU, QNT, QBJ. It is not normally necessary to precede the QAN, QBA, QNY and QBB information by these Q signals but this may be done if considered desirable."
- { "QFZ", "What is the aerodrome meteorological forecast for...(place) for the period...hours until...hours?", NULL, "The aerodrome meteorological forecast for...(place) for the period...hours until...hours is..." }, // Note: When given in Q Code the following sequence of Q signal answer (or advice) forms is to be used: QAN, QBA, QNY, QBB and, if necessary, QMU, QNT and QBJ.
+ { "QFY", "Please report the present meteorological landing conditions (at...(place)).", NULL, "The present meteorological landing conditions at...(place) are...", NULL }, // Note: When given in Q Code the information is sent in the following sequence: QAN, QBA, QNY, QBB, QNH, and/or QFE and, if necessary, QMU, QNT, QBJ. It is not normally necessary to precede the QAN, QBA, QNY and QBB information by these Q signals but this may be done if considered desirable."
+ { "QFZ", "What is the aerodrome meteorological forecast for...(place) for the period...hours until...hours?", NULL, "The aerodrome meteorological forecast for...(place) for the period...hours until...hours is...", NULL }, // Note: When given in Q Code the following sequence of Q signal answer (or advice) forms is to be used: QAN, QBA, QNY, QBB and, if necessary, QMU, QNT and QBJ.
{ "QGA", NULL, NULL, NULL, NULL },
{ "QGB", NULL, NULL, NULL, NULL },
{ "QGC", NULL, NULL, "There are obstructions to the... of runway...", NULL },
{ "QGD", "Are there on my track any obstructions whose elevation equals or exceeds my altitude?", NULL, "There are obstructions on your track ...(figures and units) height above...(datum).", NULL },
- { "QGE", "What is my distance to your station (or to...)?", NULL, "Your distance to my station (or to...) is...(distance figures and units)." }, // Note: This signal is normally used in conjunction with one of the signals QDM, QDR, QTE or QUJ.
+ { "QGE", "What is my distance to your station (or to...)?", NULL, "Your distance to my station (or to...) is...(distance figures and units).", NULL }, // Note: This signal is normally used in conjunction with one of the signals QDM, QDR, QTE or QUJ.
{ "QGF", NULL, NULL, NULL, NULL },
{ "QGG", NULL, NULL, NULL, NULL },
{ "QGH", "May I land using... (procedure or facility)?", NULL, "You may land using...(procedure or facility).", NULL },
@@ -343,7 +343,7 @@ qcodes_t qcodes[] = {
{ "QMU", "What is the surface temperature at...(place) and what is the dew point temperature at that place?", NULL, "The surface temperature at...(place) at ... hours is...degrees and the dew point temperature at that time and place is...degrees.", NULL },
{ "QMV", NULL, NULL, NULL, NULL },
{ "QMW", "At...(position or zone) what is (are) the height(s) above...(datum) of the zero Celsius isotherm(s)?", NULL, "At...(position or zone) the zero Celsius isotherm(s) is (are) at...(figures and units) height(s) above ...(datum).", NULL },
- { "QMX", "What is the air temperature (at... (position or zone)) (at...hours) at the... (figures and units) height above... (datum)?", NULL, "At...(position or zone) at... hours the air temperature is...(degrees and units) at... (figures and units) height above...(datum)." }, // Note: Aircraft reporting QMX information will transmit the temperature figures as corrected for airspeed.
+ { "QMX", "What is the air temperature (at... (position or zone)) (at...hours) at the... (figures and units) height above... (datum)?", NULL, "At...(position or zone) at... hours the air temperature is...(degrees and units) at... (figures and units) height above...(datum).", NULL }, // Note: Aircraft reporting QMX information will transmit the temperature figures as corrected for airspeed.
{ "QMY", NULL, NULL, NULL, NULL },
{ "QMZ", "Have you any amendments to the flight forecast in respect of section of route yet to be traversed?", NULL, "The following amendment(s) should be made to the flight forecast... (If no amendments, signal QMZ NIL.)", NULL },
{ "QNA", NULL, NULL, NULL, NULL },
@@ -370,7 +370,7 @@ qcodes_t qcodes[] = {
{ "QNV", NULL, NULL, NULL, NULL },
{ "QNW", NULL, NULL, NULL, NULL },
{ "QNX", NULL, NULL, NULL, NULL },
- { "QNY", "What is the present weather and the intensity thereof at...(place, position or zone)?", NULL, "The present weather and intensity thereof at...(place, position or zone) at...hours is..." }, // (See Notes a) and b)). Notes: a) When present weather information is transmitted by a ground station, the information shall be selected from the present weather table (Table III) in PANSMET (Doc 7605- MET/526). If none of these conditions prevail the reply shall be QNY NIL.
+ { "QNY", "What is the present weather and the intensity thereof at...(place, position or zone)?", NULL, "The present weather and intensity thereof at...(place, position or zone) at...hours is...", NULL }, // (See Notes a) and b)). Notes: a) When present weather information is transmitted by a ground station, the information shall be selected from the present weather table (Table III) in PANSMET (Doc 7605- MET/526). If none of these conditions prevail the reply shall be QNY NIL.
{ "QNZ", NULL, NULL, NULL, NULL },
{ "QOA", "Can you communicate by radiotelegraphy (500 kHz)?", NULL, "I can communicate by radiotelegraphy (500 kHz)." /*(MARITIME USE ONLY)*/, NULL },
{ "QOB", "Can you communicate by radiotelephony (2182 kHz)?", NULL, "I can communicate by radiotelephony (2182 kHz)." /*(MARITIME USE ONLY)*/, NULL },
@@ -479,7 +479,7 @@ qcodes_t qcodes[] = {
{ "QUK", "Can you tell me the condition of the sea observed at... (place or coordinates)?", NULL, "The sea at...(place or coordinates) is...", NULL }, // Aeronautical Note: Stations of the international aeronautical telecommunication service will complete the answer, information or advice form by the use of a numbered alternative as given hereunder, selected according to the average wave height as obtained from the larger well formed waves of the wave system being observed. If observed height coincides with one of the limits, report the lower numbered alternative, e.g. waves with a mean maximum height of 4 meters are to be reported as "5". Number Height Meters Feet (approx.) 0 Calm-glassy 0 0 1 Calm- rippled 0 - 0.1 0 - 1/3 2 Smooth Wavelets 0.1 - 0.5 1/3 - 1 2/3 3 Slight 0.5 - 1.25 1 2/3 - 4 4 Moderate 1.25 - 2.5 4 - 8 5 Rough 2.5 - 4 8 - 13 6 Very Rough 4 - 6 13 - 20 7 High 6 - 9 20 - 30 8 Very High 9 - 14 30 - 45 9 Phenomenal Over 14 Over 45", NULL },
{ "QUL", "Can you tell me the swell observed at...(place or coordinates)?", NULL, "The swell at...(place or coordinates) is...", NULL }, // Aeronautical Note: Stations of the international aeronautical telecommunication service will complete the answer, information or advice form by the use of the following numbered alternatives: Number Length of Swell Height Number Length of Swell Height 0 - - 5 Long Moderate 1 Short or Average Low 6 Short Heavy 2 Long Low 7 Average Heavy 3 Short Moderate 8 Long Heavy 4 Average Moderate 9 Confused - Additionally, stations of the international aeronautical telecommunication service may indicate the direction of swell by the use of the appropriate cardinal or quandrantal point abbreviation N, NE, E, SE, etc. following the numbered alternate for indicating swell condition. The descriptions in the above numbered alternatives are as follows: Length of Swell Meters Feet (Approx.) Short 0 - 100 0- 300 Average 100 - 200 300 - 600 Long Over 200 Over 600 Height of Swell Meters Feet (Approx.) Low 0 - 2 0 - 7 Moderate 2 - 4 7 - 13 Heavy Over 4 Over 13 When there is no swell, the numbered alternative "0" is used; when the swell is such that the length and height of the swell waves cannot be determined, the numbered alternative "9" is used.", NULL },
{ "QUM", "May I resume normal working?", NULL, "Normal working may be resumed.", NULL },
- { "QUN", "Will vessels in my immediate vicinity (or in the vicinity of...latitude ...longitude(or of...)) please indicate their position, TRUE course and speed?", NULL, "My position, TRUE course and speed are..." },
+ { "QUN", "Will vessels in my immediate vicinity (or in the vicinity of...latitude ...longitude(or of...)) please indicate their position, TRUE course and speed?", NULL, "My position, TRUE course and speed are...", NULL },
{ "QUO", "Shall I search for... % in the vicinity of... latitude...longitude (or according to any other indication)?", "1) aircraft, 2) ship, 3) survival craft", "Please search for... % in the vicinity of...latitude... longitude (or according to any other indication).", "1) aircraft, 2) ship, 3) survival craft" },
{ "QUP", "Will you indicate your position by... %", "1) searchlight? 2) black smoke trail? 3) pyrotechnic lights?", "My position is indicated by... %.", "1) searchlight. 2) black smoke trail. 3) pyrotechnic lights." },
{ "QUQ", "Shall I train my searchlight nearly vertical on a cloud, occulting if possible and, if your aircraft is seen or heard, deflect the beam up wind and on the water (or land) to facilitate your landing?", NULL, "Please train your searchlight on a cloud, occulting if possible and, if my aircraft is seen or heard, deflect the beam up wind and on the water (or land) to facilitate my landing.", NULL },
--- a/resample2.c
+++ b/resample2.c
@@ -36,7 +36,6 @@
#define FFSIGN(a) ((a) > 0 ? 1 : -1)
#define FFMAX(a,b) ((a) > (b) ? (a) : (b))
#define FFMIN(a,b) ((a) > (b) ? (b) : (a))
-#define av_mallocz malloc
#define av_freep free
#ifndef CONFIG_RESAMPLE_HP
@@ -81,6 +80,12 @@ typedef struct AVResampleContext{
int linear;
}AVResampleContext;
+void av_build_filter(FELEM *filter, double factor, int tap_count, int phase_count, int scale, int type);
+AVResampleContext *av_resample_init(int out_rate, int in_rate, int filter_size, int phase_shift, int linear, double cutoff);
+void av_resample_close(AVResampleContext *c);
+void av_resample_compensate(AVResampleContext *c, int sample_delta, int compensation_distance);
+int av_resample(AVResampleContext *c, short *dst, short *src, int *consumed, int src_size, int dst_size, int update_ctx);
+
/**
* 0th order modified bessel function of the first kind.
*/
@@ -198,7 +203,7 @@ void av_build_filter(FELEM *filter, doub
* Note, if either rate is not an integer then simply scale both rates up so they are.
*/
AVResampleContext *av_resample_init(int out_rate, int in_rate, int filter_size, int phase_shift, int linear, double cutoff){
- AVResampleContext *c= av_mallocz(sizeof(AVResampleContext));
+ AVResampleContext *c= calloc(sizeof(AVResampleContext), 1);
double factor= FFMIN(out_rate * cutoff / in_rate, 1.0);
int phase_count= 1<<phase_shift;
@@ -206,8 +211,9 @@ AVResampleContext *av_resample_init(int
c->phase_mask= phase_count-1;
c->linear= linear;
- c->filter_length= FFMAX((int)ceil(filter_size/factor), 1);
- c->filter_bank= av_mallocz(c->filter_length*(phase_count+1)*sizeof(FELEM));
+ c->filter_length = ceil(filter_size / factor);
+ c->filter_length = FFMAX(c->filter_length, 1);
+ c->filter_bank= calloc(c->filter_length*(phase_count+1), sizeof(FELEM));
av_build_filter(c->filter_bank, factor, c->filter_length, phase_count, 1<<FILTER_SHIFT, WINDOW_TYPE);
memcpy(&c->filter_bank[c->filter_length*phase_count+1], c->filter_bank, (c->filter_length-1)*sizeof(FELEM));
c->filter_bank[c->filter_length*phase_count]= c->filter_bank[c->filter_length - 1];
@@ -255,29 +261,29 @@ void av_resample_compensate(AVResampleCo
*/
int av_resample(AVResampleContext *c, short *dst, short *src, int *consumed, int src_size, int dst_size, int update_ctx){
int dst_index, i;
- int index= c->index;
+ int indexv= c->index;
int frac= c->frac;
int dst_incr_frac= c->dst_incr % c->src_incr;
int dst_incr= c->dst_incr / c->src_incr;
int compensation_distance= c->compensation_distance;
if(compensation_distance == 0 && c->filter_length == 1 && c->phase_shift==0){
- int64_t index2= ((int64_t)index)<<32;
+ int64_t index2= ((int64_t)indexv)<<32;
int64_t incr= (1LL<<32) * c->dst_incr / c->src_incr;
- dst_size= FFMIN(dst_size, (src_size-1-index) * (int64_t)c->src_incr / c->dst_incr);
+ dst_size= FFMIN(dst_size, (src_size-1-indexv) * (int64_t)c->src_incr / c->dst_incr);
for(dst_index=0; dst_index < dst_size; dst_index++){
dst[dst_index] = src[index2>>32];
index2 += incr;
}
frac += dst_index * dst_incr_frac;
- index += dst_index * dst_incr;
- index += frac / c->src_incr;
+ indexv += dst_index * dst_incr;
+ indexv += frac / c->src_incr;
frac %= c->src_incr;
}else{
for(dst_index=0; dst_index < dst_size; dst_index++){
- FELEM *filter= c->filter_bank + c->filter_length*(index & c->phase_mask);
- int sample_index= index >> c->phase_shift;
+ FELEM *filter= c->filter_bank + c->filter_length*(indexv & c->phase_mask);
+ int sample_index= indexv >> c->phase_shift;
FELEM2 val=0;
if(sample_index < 0){
@@ -306,10 +312,10 @@ int av_resample(AVResampleContext *c, sh
#endif
frac += dst_incr_frac;
- index += dst_incr;
+ indexv += dst_incr;
if(frac >= c->src_incr){
frac -= c->src_incr;
- index++;
+ indexv++;
}
if(dst_index + 1 == compensation_distance){
@@ -319,8 +325,8 @@ int av_resample(AVResampleContext *c, sh
}
}
}
- *consumed= FFMAX(index, 0) >> c->phase_shift;
- if(index>=0) index &= c->phase_mask;
+ *consumed= FFMAX(indexv, 0) >> c->phase_shift;
+ if(indexv>=0) indexv &= c->phase_mask;
if(compensation_distance){
compensation_distance -= dst_index;
@@ -328,7 +334,7 @@ int av_resample(AVResampleContext *c, sh
}
if(update_ctx){
c->frac= frac;
- c->index= index;
+ c->index= indexv;
c->dst_incr= dst_incr_frac + c->src_incr*dst_incr;
c->compensation_distance= compensation_distance;
}
|