Commit 111c638c authored by Ehsan Akhgari's avatar Ehsan Akhgari
Browse files

Bug 710940 - Make sure our implementation of get_current_cs does not return...

Bug 710940 - Make sure our implementation of get_current_cs does not return null, in order to respect hunspell's assumptions; r=smaug

--HG--
extra : rebase_source : b9396975701b71ba188e4242527d979b6b7f4334
parent 9b3cf342
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -36,7 +36,7 @@
******* END LICENSE BLOCK *******

Hunspell Version:   1.3.2
Additional Patches: 694002, 710967
Additional Patches: 694002, 710967, 710940

Hunspell Author: László Németh
MySpell Author: Kevin Hendricks & David Einstein
+12 −7
Original line number Diff line number Diff line
@@ -5523,7 +5523,14 @@ struct cs_info * get_current_cs(const char * es) {
// conversion tables static in this file, create them when needed
// with help the mozilla backend.
struct cs_info * get_current_cs(const char * es) {
  struct cs_info *ccs;
  struct cs_info *ccs = new cs_info[256];
  // Initialze the array with dummy data so that we wouldn't need
  // to return null in case of failures.
  for (int i = 0; i <= 0xff; ++i) {
    ccs[i].ccase = false;
    ccs[i].clower = i;
    ccs[i].cupper = i;
  }

  nsCOMPtr<nsIUnicodeEncoder> encoder; 
  nsCOMPtr<nsIUnicodeDecoder> decoder; 
@@ -5531,21 +5538,19 @@ struct cs_info * get_current_cs(const char * es) {
  nsresult rv;
  nsCOMPtr<nsICharsetConverterManager> ccm = do_GetService(kCharsetConverterManagerCID, &rv);
  if (NS_FAILED(rv))
    return nsnull;
    return ccs;

  rv = ccm->GetUnicodeEncoder(es, getter_AddRefs(encoder));
  if (NS_FAILED(rv))
    return nsnull;
    return ccs;
  encoder->SetOutputErrorBehavior(encoder->kOnError_Signal, nsnull, '?');
  rv = ccm->GetUnicodeDecoder(es, getter_AddRefs(decoder));
  if (NS_FAILED(rv))
    return nsnull;
    return ccs;
  decoder->SetInputErrorBehavior(decoder->kOnError_Signal);

  if (NS_FAILED(rv))
    return nsnull;

  ccs = new cs_info[256];
    return ccs;

  for (unsigned int i = 0; i <= 0xff; ++i) {
    bool success = false;