diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2020-08-24 13:15:00 +0300 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2020-08-24 13:15:00 +0300 |
commit | 455a635080a1c1c4b164af3060836f0d8c1b3c1c (patch) | |
tree | bc77c492e9b7187d8b277d2a1cd024902c8ae3eb /src/gmrequest.c | |
parent | fbf36dfbf77701d647f0133f1532ebc42eb05e32 (diff) |
Updated for the_Foundation API changes
Diffstat (limited to 'src/gmrequest.c')
-rw-r--r-- | src/gmrequest.c | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/src/gmrequest.c b/src/gmrequest.c index c231e1f3..ebb66a84 100644 --- a/src/gmrequest.c +++ b/src/gmrequest.c | |||
@@ -299,13 +299,13 @@ static void requestFinished_GmRequest_(iAnyObject *obj) { | |||
299 | 299 | ||
300 | static const iBlock *aboutPageSource_(iRangecc path) { | 300 | static const iBlock *aboutPageSource_(iRangecc path) { |
301 | const iBlock *src = NULL; | 301 | const iBlock *src = NULL; |
302 | if (equalCase_Rangecc(&path, "lagrange")) { | 302 | if (equalCase_Rangecc(path, "lagrange")) { |
303 | return &blobLagrange_Embedded; | 303 | return &blobLagrange_Embedded; |
304 | } | 304 | } |
305 | if (equalCase_Rangecc(&path, "help")) { | 305 | if (equalCase_Rangecc(path, "help")) { |
306 | return &blobHelp_Embedded; | 306 | return &blobHelp_Embedded; |
307 | } | 307 | } |
308 | if (equalCase_Rangecc(&path, "version")) { | 308 | if (equalCase_Rangecc(path, "version")) { |
309 | return &blobVersion_Embedded; | 309 | return &blobVersion_Embedded; |
310 | } | 310 | } |
311 | return src; | 311 | return src; |
@@ -321,10 +321,10 @@ static const iBlock *replaceVariables_(const iBlock *block) { | |||
321 | const iRangei span = m.range; | 321 | const iRangei span = m.range; |
322 | const iRangecc name = capturedRange_RegExpMatch(&m, 1); | 322 | const iRangecc name = capturedRange_RegExpMatch(&m, 1); |
323 | iRangecc repl = iNullRange; | 323 | iRangecc repl = iNullRange; |
324 | if (equal_Rangecc(&name, "APP_VERSION")) { | 324 | if (equal_Rangecc(name, "APP_VERSION")) { |
325 | repl = range_CStr(LAGRANGE_APP_VERSION); | 325 | repl = range_CStr(LAGRANGE_APP_VERSION); |
326 | } | 326 | } |
327 | else if (startsWith_Rangecc(&name, "BT:")) { /* block text */ | 327 | else if (startsWith_Rangecc(name, "BT:")) { /* block text */ |
328 | repl = range_String(collect_String(renderBlockChars_Text( | 328 | repl = range_String(collect_String(renderBlockChars_Text( |
329 | &fontFiraSansRegular_Embedded, | 329 | &fontFiraSansRegular_Embedded, |
330 | 11, /* should be larger if shaded */ | 330 | 11, /* should be larger if shaded */ |
@@ -332,7 +332,7 @@ static const iBlock *replaceVariables_(const iBlock *block) { | |||
332 | &(iString){ iBlockLiteral( | 332 | &(iString){ iBlockLiteral( |
333 | name.start + 3, size_Range(&name) - 3, size_Range(&name) - 3) }))); | 333 | name.start + 3, size_Range(&name) - 3, size_Range(&name) - 3) }))); |
334 | } | 334 | } |
335 | else if (startsWith_Rangecc(&name, "ST:")) { /* shaded text */ | 335 | else if (startsWith_Rangecc(name, "ST:")) { /* shaded text */ |
336 | repl = range_String(collect_String(renderBlockChars_Text( | 336 | repl = range_String(collect_String(renderBlockChars_Text( |
337 | &fontSymbola_Embedded, | 337 | &fontSymbola_Embedded, |
338 | 20, | 338 | 20, |
@@ -340,42 +340,42 @@ static const iBlock *replaceVariables_(const iBlock *block) { | |||
340 | &(iString){ iBlockLiteral( | 340 | &(iString){ iBlockLiteral( |
341 | name.start + 3, size_Range(&name) - 3, size_Range(&name) - 3) }))); | 341 | name.start + 3, size_Range(&name) - 3, size_Range(&name) - 3) }))); |
342 | } | 342 | } |
343 | else if (equal_Rangecc(&name, "ALT")) { | 343 | else if (equal_Rangecc(name, "ALT")) { |
344 | #if defined (iPlatformApple) | 344 | #if defined (iPlatformApple) |
345 | repl = range_CStr("\u2325"); | 345 | repl = range_CStr("\u2325"); |
346 | #else | 346 | #else |
347 | repl = range_CStr("Alt"); | 347 | repl = range_CStr("Alt"); |
348 | #endif | 348 | #endif |
349 | } | 349 | } |
350 | else if (equal_Rangecc(&name, "ALT+")) { | 350 | else if (equal_Rangecc(name, "ALT+")) { |
351 | #if defined (iPlatformApple) | 351 | #if defined (iPlatformApple) |
352 | repl = range_CStr("\u2325"); | 352 | repl = range_CStr("\u2325"); |
353 | #else | 353 | #else |
354 | repl = range_CStr("Alt+"); | 354 | repl = range_CStr("Alt+"); |
355 | #endif | 355 | #endif |
356 | } | 356 | } |
357 | else if (equal_Rangecc(&name, "CTRL")) { | 357 | else if (equal_Rangecc(name, "CTRL")) { |
358 | #if defined (iPlatformApple) | 358 | #if defined (iPlatformApple) |
359 | repl = range_CStr("\u2318"); | 359 | repl = range_CStr("\u2318"); |
360 | #else | 360 | #else |
361 | repl = range_CStr("Ctrl"); | 361 | repl = range_CStr("Ctrl"); |
362 | #endif | 362 | #endif |
363 | } | 363 | } |
364 | else if (equal_Rangecc(&name, "CTRL+")) { | 364 | else if (equal_Rangecc(name, "CTRL+")) { |
365 | #if defined (iPlatformApple) | 365 | #if defined (iPlatformApple) |
366 | repl = range_CStr("\u2318"); | 366 | repl = range_CStr("\u2318"); |
367 | #else | 367 | #else |
368 | repl = range_CStr("Ctrl+"); | 368 | repl = range_CStr("Ctrl+"); |
369 | #endif | 369 | #endif |
370 | } | 370 | } |
371 | else if (equal_Rangecc(&name, "SHIFT")) { | 371 | else if (equal_Rangecc(name, "SHIFT")) { |
372 | #if defined (iPlatformApple) | 372 | #if defined (iPlatformApple) |
373 | repl = range_CStr("\u21e7"); | 373 | repl = range_CStr("\u21e7"); |
374 | #else | 374 | #else |
375 | repl = range_CStr("Shift"); | 375 | repl = range_CStr("Shift"); |
376 | #endif | 376 | #endif |
377 | } | 377 | } |
378 | else if (equal_Rangecc(&name, "SHIFT+")) { | 378 | else if (equal_Rangecc(name, "SHIFT+")) { |
379 | #if defined (iPlatformApple) | 379 | #if defined (iPlatformApple) |
380 | repl = range_CStr("\u21e7"); | 380 | repl = range_CStr("\u21e7"); |
381 | #else | 381 | #else |
@@ -403,7 +403,7 @@ void submit_GmRequest(iGmRequest *d) { | |||
403 | init_Url(&url, &d->url); | 403 | init_Url(&url, &d->url); |
404 | /* Check for special protocols. */ | 404 | /* Check for special protocols. */ |
405 | /* TODO: If this were a library, these could be handled via callbacks. */ | 405 | /* TODO: If this were a library, these could be handled via callbacks. */ |
406 | if (equalCase_Rangecc(&url.protocol, "about")) { | 406 | if (equalCase_Rangecc(url.protocol, "about")) { |
407 | const iBlock *src = aboutPageSource_(url.path); | 407 | const iBlock *src = aboutPageSource_(url.path); |
408 | if (src) { | 408 | if (src) { |
409 | d->resp.statusCode = success_GmStatusCode; | 409 | d->resp.statusCode = success_GmStatusCode; |
@@ -419,7 +419,7 @@ void submit_GmRequest(iGmRequest *d) { | |||
419 | iNotifyAudience(d, finished, GmRequestFinished); | 419 | iNotifyAudience(d, finished, GmRequestFinished); |
420 | return; | 420 | return; |
421 | } | 421 | } |
422 | else if (equalCase_Rangecc(&url.protocol, "file")) { | 422 | else if (equalCase_Rangecc(url.protocol, "file")) { |
423 | iString *path = collect_String(urlDecode_String(collect_String(newRange_String(url.path)))); | 423 | iString *path = collect_String(urlDecode_String(collect_String(newRange_String(url.path)))); |
424 | iFile * f = new_File(path); | 424 | iFile * f = new_File(path); |
425 | if (open_File(f, readOnly_FileMode)) { | 425 | if (open_File(f, readOnly_FileMode)) { |
@@ -457,7 +457,7 @@ void submit_GmRequest(iGmRequest *d) { | |||
457 | iNotifyAudience(d, finished, GmRequestFinished); | 457 | iNotifyAudience(d, finished, GmRequestFinished); |
458 | return; | 458 | return; |
459 | } | 459 | } |
460 | else if (equalCase_Rangecc(&url.protocol, "data")) { | 460 | else if (equalCase_Rangecc(url.protocol, "data")) { |
461 | d->resp.statusCode = success_GmStatusCode; | 461 | d->resp.statusCode = success_GmStatusCode; |
462 | iString *src = collectNewCStr_String(url.protocol.start + 5); | 462 | iString *src = collectNewCStr_String(url.protocol.start + 5); |
463 | iRangecc header = { constBegin_String(src), constBegin_String(src) }; | 463 | iRangecc header = { constBegin_String(src), constBegin_String(src) }; |
@@ -468,8 +468,8 @@ void submit_GmRequest(iGmRequest *d) { | |||
468 | setRange_String(&d->resp.meta, header); | 468 | setRange_String(&d->resp.meta, header); |
469 | /* Check what's in the header. */ { | 469 | /* Check what's in the header. */ { |
470 | iRangecc entry = iNullRange; | 470 | iRangecc entry = iNullRange; |
471 | while (nextSplit_Rangecc(&header, ";", &entry)) { | 471 | while (nextSplit_Rangecc(header, ";", &entry)) { |
472 | if (equal_Rangecc(&entry, "base64")) { | 472 | if (equal_Rangecc(entry, "base64")) { |
473 | isBase64 = iTrue; | 473 | isBase64 = iTrue; |
474 | } | 474 | } |
475 | } | 475 | } |